Fix unqualified Ansible boolean variables

When using boolean variables in conditional tests, those variables
should be filtered as '|bool'. Otherwise, they are being evaluated as
a string and return True in any case.

Change-Id: I1e3642cb2d33d839e4808ae79ae991175e32dd0f
Signed-off-by: Gael Chamoulaud <gchamoul@redhat.com>
This commit is contained in:
Gael Chamoulaud 2017-04-05 16:25:53 +02:00
parent 6ea85ddc83
commit c377337673
18 changed files with 33 additions and 33 deletions

View File

@ -10,6 +10,6 @@
become: yes
shell: >
"{{ working_dir }}"/adjust-interface-mtus.sh
when: step_adjust_mtu
when: step_adjust_mtu|bool

View File

@ -10,6 +10,6 @@
become: yes
shell: >
"{{ working_dir }}"/allow-traffic-for-controller.sh
when: network_isolation and undercloud_type == "baremetal"
when: network_isolation|bool and undercloud_type == "baremetal"

View File

@ -9,6 +9,6 @@
- name: Run install upstream ipxe script
shell: >
"{{ working_dir }}"/install-upstream-ipxe.sh
when: step_install_upstream_ipxe
when: step_install_upstream_ipxe|bool

View File

@ -3,4 +3,4 @@
set -o pipefail &&
{{ baremetal_provisioning_script }} 2>&1 {{ timestamper_cmd }} >
{{ baremetal_provisioning_log }}
when: step_provide_undercloud
when: step_provide_undercloud|bool

View File

@ -154,4 +154,4 @@
shell: >-
rm -rf {{ images_working_dir }}/overcloud-full.d {{ images_working_dir }}/ironic-python-agent.d/
sudo chown $USER: {{ images_working_dir }}/overcloud-full.* {{ images_working_dir }}/ironic-python-agent.*
when: cleanup_images_working_dir| bool
when: cleanup_images_working_dir|bool

View File

@ -3,7 +3,7 @@
set -eux
{% if build_image_isolated %}
{% if build_image_isolated|bool %}
# NOTE(trown): DIB expects /dev/pts to exist and libguestfs is not mounting the guest with it
# so we just manually mount it in the guest
# This will be fixed when https://www.redhat.com/archives/libguestfs/2016-December/msg00024.html

View File

@ -14,13 +14,13 @@
mode: 0755
- name: Copy neutron l3 ha heat template
when: enable_pacemaker and number_of_controllers|int < 3
when: enable_pacemaker|bool and number_of_controllers|int < 3
template:
src: "neutronl3ha.yaml.j2"
dest: "{{ working_dir }}/neutronl3ha.yaml"
- name: Copy composable services file
when: composable_services
when: composable_services|bool
template:
src: "overcloud_services.yaml.j2"
dest: "{{ working_dir }}/overcloud_services.yaml"

View File

@ -4,4 +4,4 @@
{{ working_dir }}/overcloud-deploy.sh 2>&1 {{ timestamper_cmd }} > {{ deploy_log }}
register: deploy_script_result
ignore_errors: True
when: step_deploy_overcloud
when: step_deploy_overcloud|bool

View File

@ -32,7 +32,7 @@ tar xvfp {{ overcloud_full_tar_name }}
## * Upload images to glance.
## ::
openstack overcloud image upload {% if bash_deploy_ramdisk %}--old-deploy-image{% endif %} {% if whole_disk_images|bool %}--whole-disk{% endif %}
openstack overcloud image upload {% if bash_deploy_ramdisk|bool %}--old-deploy-image{% endif %} {% if whole_disk_images|bool %}--whole-disk{% endif %}
{% endif %}
@ -130,7 +130,7 @@ sudo mistral-db-manage populate
{% endif %}
{% if step_introspect %}
{% if step_introspect|bool %}
## * Introspect hardware attributes of nodes.
## ::

View File

@ -1,6 +1,6 @@
---
# tasks file for ansible-role-tripleo-ssl
- when: ssl_overcloud
- when: ssl_overcloud|bool
block:
- name: Ensure rpm requirements for ssl are installed
yum: name={{ item }} state=latest

View File

@ -17,19 +17,19 @@
ovs-vsctl add-port br-ctlplane {{ network_isolation_vlan }} tag={{ network_isolation_vlan_tag }} \
-- set interface {{ network_isolation_vlan }} type=internal;
fi
when: network_isolation
when: network_isolation|bool
- name: set vlan up
ignore_errors: yes
become: yes
shell: >
ip l set dev {{ network_isolation_vlan }} up; ip addr add {{ network_isolation_ipv4_cidr }} dev {{ network_isolation_vlan }};
when: network_isolation
when: network_isolation|bool
- name: allow traffic for the controller
become: yes
shell: >
sudo iptables -A BOOTSTACK_MASQ -s {{ network_isolation_ipv4_cidr }} ! \
-d {{ network_isolation_ipv4_cidr }} -j MASQUERADE -t nat
when: network_isolation
when: network_isolation|bool

View File

@ -4,22 +4,22 @@
- overcloud-upgrade-scripts
- include: pre-undercloud.yml
when: step_pre_undercloud_upgrade
when: step_pre_undercloud_upgrade|bool
tags:
- pre-upgrade-undercloud
- include: upgrade-undercloud.yml
when: step_upgrade_undercloud
when: step_upgrade_undercloud|bool
tags:
- upgrade-undercloud
- include: pre-overcloud.yml
when: step_pre_overcloud_upgrade and target_upgrade_version in ['mitaka', 'newton']
when: step_pre_overcloud_upgrade|bool and target_upgrade_version in ['mitaka', 'newton']
tags:
- pre-upgrade-overcloud
- include: upgrade-overcloud.yml
when: step_upgrade_overcloud
when: step_upgrade_overcloud|bool
tags:
- upgrade-overcloud

View File

@ -3,7 +3,7 @@
become: yes
file: path=/etc/yum.repos.d/{{ item }} state=absent
with_items: "{{ repos }}"
when: step_pre_undercloud_upgrade
when: step_pre_undercloud_upgrade|bool
- name: Execute upgrade repo script
become: yes
@ -11,7 +11,7 @@
set -o pipefail &&
{{ upgrade_working_dir }}/upgrade-undercloud-repo.sh 2>&1 {{ timestamper_cmd }} >
upgrade-undercloud-repo.sh.log
when: step_pre_undercloud_upgrade
when: step_pre_undercloud_upgrade|bool
- name: Clean yum cache
become: yes

View File

@ -4,4 +4,4 @@
set -o pipefail &&
{{ upgrade_working_dir }}/overcloud-upgrade.sh 2>&1 {{ timestamper_cmd }} >
{{ upgrade_log }}
when: step_upgrade_overcloud
when: step_upgrade_overcloud|bool

View File

@ -36,7 +36,7 @@ if heat stack-show overcloud | grep "stack_status " | egrep "(CREATE|UPDATE)_COM
echo "execute aodh upgrade"
openstack overcloud deploy --templates {{ tht_dir }} \
-e tripleo-heat-templates/overcloud-resource-registry-puppet.yaml \
{% if network_isolation == true %}
{% if network_isolation|bool %}
-e {{ tht_dir }}/environments/network-isolation.yaml \
-e {{ tht_dir }}/environments/net-single-nic-with-vlans.yaml \
-e ~/network-environment.yaml \
@ -52,7 +52,7 @@ if heat stack-show overcloud | grep "stack_status " | egrep "(CREATE|UPDATE)_COM
echo "execute keystone upgrade"
openstack overcloud deploy --templates {{ tht_dir }} \
-e tripleo-heat-templates/overcloud-resource-registry-puppet.yaml \
{% if network_isolation == true %}
{% if network_isolation|bool %}
-e {{ tht_dir }}/environments/network-isolation.yaml \
-e {{ tht_dir }}/environments/net-single-nic-with-vlans.yaml \
-e ~/network-environment.yaml \
@ -70,7 +70,7 @@ if heat stack-show overcloud | grep "stack_status " | egrep "(CREATE|UPDATE)_COM
echo "execute ceilometer migration"
openstack overcloud deploy --templates {{ tht_dir }} \
-e tripleo-heat-templates/overcloud-resource-registry-puppet.yaml \
{% if network_isolation == true %}
{% if network_isolation|bool %}
-e {{ tht_dir }}/environments/network-isolation.yaml \
-e {{ tht_dir }}/environments/net-single-nic-with-vlans.yaml \
-e ~/network-environment.yaml \
@ -88,7 +88,7 @@ if heat stack-show overcloud | grep "stack_status " | egrep "(CREATE|UPDATE)_COM
echo "execute script delivery"
openstack overcloud deploy --templates {{ tht_dir }} \
-e tripleo-heat-templates/overcloud-resource-registry-puppet.yaml \
{% if network_isolation == true %}
{% if network_isolation|bool %}
-e {{ tht_dir }}/environments/network-isolation.yaml \
-e {{ tht_dir }}/environments/net-single-nic-with-vlans.yaml \
-e ~/network-environment.yaml \
@ -114,7 +114,7 @@ if heat stack-show overcloud | grep "stack_status " | egrep "(CREATE|UPDATE)_COM
echo "execute major upgrade controller"
openstack overcloud deploy --templates {{ tht_dir }} \
-e tripleo-heat-templates/overcloud-resource-registry-puppet.yaml \
{% if network_isolation == true %}
{% if network_isolation|bool %}
-e {{ tht_dir }}/environments/network-isolation.yaml \
-e {{ tht_dir }}/environments/net-single-nic-with-vlans.yaml \
-e ~/network-environment.yaml \
@ -156,7 +156,7 @@ if heat stack-show overcloud | grep "stack_status " | egrep "(CREATE|UPDATE)_COM
{% for item in upgrade_custom_templates_converge %}
-e {{ item }} \
{% endfor %}
{% if network_isolation == true %}
{% if network_isolation|bool %}
-e {{ tht_dir }}/environments/network-isolation.yaml \
-e {{ tht_dir }}/environments/net-single-nic-with-vlans.yaml \
-e ~/network-environment.yaml
@ -170,7 +170,7 @@ if openstack stack show -c stack_status overcloud -f value | egrep "(CREATE|UPD
echo "execute overcloud upgrade"
openstack overcloud deploy --templates {{ tht_dir }} \
-e {{ tht_dir }}/overcloud-resource-registry-puppet.yaml \
{% if network_isolation|bool == true %}
{% if network_isolation|bool %}
-e {{ tht_dir }}/environments/network-isolation.yaml \
-e {{ tht_dir }}/environments/net-single-nic-with-vlans.yaml \
-e ~/network-environment.yaml \

View File

@ -10,11 +10,11 @@
async: 7200
poll: 0
become: true
when: step_install_undercloud
when: step_install_undercloud|bool
- name: Install the undercloud
shell: >
set -o pipefail &&
{{ working_dir }}/undercloud-install.sh 2>&1 {{ timestamper_cmd }} >
{{ undercloud_install_log }}
when: step_install_undercloud
when: step_install_undercloud|bool

View File

@ -1,5 +1,5 @@
---
- when: validate_ipmi_step
- when: validate_ipmi_step|bool
block:
- name: Copy validate IPMI template to the undercloud

View File

@ -3,7 +3,7 @@
## Configure tempest
## -----------------
{% if tempest_overcloud %}
{% if tempest_overcloud|bool %}
## ::
source {{ working_dir }}/overcloudrc