Fix logic for installing a routing file

In Ansible, a "string"|bool jinja2 filter does not result to a true
value as presented below:

~$ ansible localhost -e foo="string" -m debug -a "msg={{foo|bool}}"
localhost | SUCCESS => {
    "msg": false
}

Only a "true" string results in a boolean True value

~$ ansible localhost -e foo="true" -m debug -a "msg={{foo|bool}}"
localhost | SUCCESS => {
    "msg": true
}

as such, the routing files where never installed for the RedHat
distributions. We fix this logic by simply leaving this variable
undefined for the distributions who don't need it.

Change-Id: I0af0ad47487365ad593c5550d2c7e05f650e7174
This commit is contained in:
Markos Chandras 2017-05-04 11:33:24 +01:00
parent 9f8e9e1a96
commit 389d631500
2 changed files with 2 additions and 6 deletions

View File

@ -288,8 +288,8 @@
group: "root"
mode: "0644"
when:
- lxc_container_route_interface | bool
- lxc_container_default_route_interfaces | bool
- lxc_container_route_interface is defined
- lxc_container_default_route_interfaces is defined
- item.value.static_routes is defined
with_dict: "{{ container_networks | default({}) }}"
delegate_to: "{{ physical_host }}"

View File

@ -18,10 +18,6 @@
# Ansible iterator type is `with_dict`.
lxc_container_interface: debian-interface.cfg.j2
# Notice this is already resolved in the debian interface file
lxc_container_route_interface: false
lxc_container_default_route_interfaces: false
# Note this is a used in an iterable and requires the <item.value.interface> variable
lxc_container_interface_target: "/etc/network/interfaces.d/{{ item.value.interface }}.cfg"