Fix ansible warnings for when clauses with curly braces

This commit is contained in:
Mark Goddard 2017-10-19 11:36:35 +01:00
parent ba6d30c10a
commit ca284aea06
39 changed files with 170 additions and 179 deletions

View File

@ -61,7 +61,7 @@
'ram': item.RAM | int,
'disk': item.Disk | int}] }}
with_items: "{{ existing_nova_flavors }}"
when: "{{ item.Name.startswith(flavor_base_name) }}"
when: item.Name.startswith(flavor_base_name)
# Build a list of nova flavors to create. Here we offset the flavor name
# index by the length of the relevant existing flavor list. Note that this

View File

@ -40,7 +40,7 @@
source {{ venv }}/bin/activate &&
openstack baremetal node manage {{ item['Name'] }}
with_items: "{{ ironic_nodes }}"
when: "{{ item['Provisioning State'] == 'enroll' }}"
when: item['Provisioning State'] == 'enroll'
environment: "{{ openstack_auth_env }}"
- name: Ensure ironic nodes are available
@ -48,7 +48,7 @@
source {{ venv }}/bin/activate &&
openstack baremetal node provide {{ item['Name'] }}
with_items: "{{ ironic_nodes }}"
when: "{{ item['Provisioning State'] in ['enroll', 'manageable'] }}"
when: item['Provisioning State'] in ['enroll', 'manageable']
environment: "{{ openstack_auth_env }}"
- name: Get a list of ironic nodes
@ -77,4 +77,4 @@
Failed to make compute node {{ item['Name'] }} available in ironic.
Provisioning state is {{ item['Provisioning State'] }}.
with_items: "{{ ironic_nodes }}"
when: "{{ item['Provisioning State'] != 'available' }}"
when: item['Provisioning State'] != 'available'

View File

@ -13,7 +13,7 @@
set_fact:
container_image_sets:
- regexes: "{{ container_image_regexes }}"
when: "{{ container_image_regexes != '' }}"
when: container_image_regexes != ''
- name: Display the regexes for container images that will be built
debug:

View File

@ -19,9 +19,9 @@
with_dict: "{{ idrac_network_ips }}"
# Don't add hosts that already exist.
when:
- "{{ item.key not in groups['all'] }}"
- "{{ item.key | replace('-idrac', '') not in groups['all'] }}"
- "{{ not compute_node_limit or item.key | replace('-idrac', '') in compute_node_limit_list }}"
- item.key not in groups['all']
- item.key | replace('-idrac', '') not in groups['all']
- not compute_node_limit or item.key | replace('-idrac', '') in compute_node_limit_list
run_once: True
- name: Ensure compute nodes are present in the Ansible inventory
@ -35,5 +35,5 @@
set_fact:
ipmi_address: "{{ idrac_network_ips[inventory_hostname] }}"
# Don't add hosts that already exist.
when: "{{ not compute_node_limit or inventory_hostname in compute_node_limit_list }}"
when: not compute_node_limit or inventory_hostname in compute_node_limit_list
run_once: True

View File

@ -8,4 +8,4 @@
- role: dell-switch-bmp
# This is the Nginx web server on the seed node.
dell_switch_bmp_http_base_url: "http://{{ provision_oc_net_name | net_ip }}:8080"
when: "{{ dell_switch_bmp_images }}"
when: dell_switch_bmp_images

View File

@ -24,14 +24,14 @@
module: copy
content: "{{ hostvars[inventory_hostname] | to_nice_yaml }}"
dest: "{{ dump_path }}/{{ inventory_hostname }}.yml"
when: "{{ dump_var_name is not defined }}"
when: dump_var_name is not defined
- name: Write host variable to file
local_action:
module: copy
content: "{{ hostvars[inventory_hostname][dump_var_name] | to_nice_yaml }}"
dest: "{{ dump_path }}/{{ inventory_hostname }}.yml"
when: "{{ dump_var_name is defined }}"
when: dump_var_name is defined
# - name: Write merged config to file
# local_action:

View File

@ -51,7 +51,7 @@
parents:
- "interface {{ switch_interface_name }}"
delegate_to: localhost
when: "{{ switch_type == 'dellos6' }}"
when: switch_type == 'dellos6'
# The tasks in this block are delegated to the controller.
- block:
@ -67,8 +67,8 @@
delegate_to: "{{ delegate_host }}"
register: arp_result
failed_when:
- "{{ arp_result | failed }}"
- "{{ 'No ARP entry for ' ~ idrac_default_ip not in arp_result.stdout }}"
- arp_result | failed
- "'No ARP entry for ' ~ idrac_default_ip not in arp_result.stdout"
# Ansible's until keyword seems to not work nicely with failed_when, causing
# the task to fail even though we have specified failed_when: False.
@ -103,7 +103,7 @@
- name: Set a fact about whether the iDRAC default IP was reachable
set_fact:
idrac_bootstrap_failure: "{{ ping_result.results[0] }}"
when: "{{ ping_result.results[0].rc != 0 }}"
when: ping_result.results[0].rc != 0
- name: Ensure IPMI is enabled on the iDRAC
command: >
@ -117,7 +117,7 @@
loop_control:
loop_var: delegate_host
delegate_to: "{{ delegate_host }}"
when: "{{ not idrac_bootstrap_failure }}"
when: not idrac_bootstrap_failure
register: racadm_ipmi_enable
failed_when: False
@ -125,8 +125,8 @@
set_fact:
idrac_bootstrap_failure: "{{ racadm_ipmi_enable.results[0] }}"
when:
- "{{ not idrac_bootstrap_failure }}"
- "{{ racadm_ipmi_enable.results[0].rc != 0 }}"
- not idrac_bootstrap_failure
- racadm_ipmi_enable.results[0].rc != 0
- name: Ensure the iDRAC IP address is configured
command: >
@ -140,8 +140,7 @@
loop_control:
loop_var: delegate_host
delegate_to: "{{ delegate_host }}"
when:
- "{{ not idrac_bootstrap_failure }}"
when: not idrac_bootstrap_failure
register: racadm_setniccfg
failed_when: False
@ -149,14 +148,14 @@
set_fact:
idrac_bootstrap_failure: "{{ racadm_setniccfg.results[0] }}"
when:
- "{{ not idrac_bootstrap_failure }}"
- "{{ racadm_setniccfg.results[0].rc != 0 }}"
- not idrac_bootstrap_failure
- racadm_setniccfg.results[0].rc != 0
- name: Append the iDRAC to the successful list on success
set_fact:
idrac_bootstrap_success: >
{{ idrac_bootstrap_success + [idrac_port_description] }}
when: "{{ not idrac_bootstrap_failure }}"
when: not idrac_bootstrap_failure
- name: Append the iDRAC to the failed list on failure
set_fact:
@ -164,7 +163,7 @@
{{ idrac_bootstrap_failed +
[{"port description": idrac_port_description,
"failure": idrac_bootstrap_failure}] }}
when: "{{ idrac_bootstrap_failure }}"
when: idrac_bootstrap_failure
run_once: True
# Ensure we reconfigure the switch interface.
@ -177,14 +176,13 @@
parents:
- "interface {{ switch_interface_name }}"
delegate_to: localhost
when:
- "{{ switch_type == 'dellos6' }}"
when: switch_type == 'dellos6'
when: "{{ idrac_bootstrap_required }}"
when: idrac_bootstrap_required
- name: Append the iDRAC to the unchanged list when unchanged
set_fact:
idrac_bootstrap_unchanged: >
{{ idrac_bootstrap_unchanged + [idrac_port_description] }}
run_once: True
when: "{{ not idrac_bootstrap_required }}"
when: not idrac_bootstrap_required

View File

@ -33,7 +33,7 @@
fail:
msg: >
The iDRAC bootstrap process currently only supports DellOS6 switches.
when: "{{ switch_type not in supported_switch_types }}"
when: switch_type not in supported_switch_types
# 1. Create a VLAN interface on the controller node with IP in the iDRAC
# default subnet.
@ -119,7 +119,7 @@
dell_switch_config:
- "vlan {{ idrac_bootstrap_vlan }}"
dell_switch_interface_config: "{{ switch_interface_config_bootstrap }}"
when: "{{ switch_interface_config_bootstrap != {} }}"
when: switch_interface_config_bootstrap != {}
# 3. For each iDRAC switch port in turn, flip to the temporary VLAN and
# configure the iDRAC's IP address, before returning the port to the iDRAC
@ -186,7 +186,7 @@
dell_switch_config:
- "no vlan {{ idrac_bootstrap_vlan }}"
dell_switch_interface_config: "{{ switch_interface_config_bootstrap }}"
when: "{{ switch_interface_config_bootstrap != {} }}"
when: switch_interface_config_bootstrap != {}
# 5. Remove the VLAN interface on the controller node.
- name: Ensure the controller bootstrap network is cleaned up
@ -204,7 +204,7 @@
- name: Display a list of failed iDRACs
set_fact:
idrac_bootstrap_failed_port_descriptions: "{{ idrac_bootstrap_failed | map(attribute='port description') | list }}"
when: "{{ idrac_bootstrap_failed | length > 0 }}"
when: idrac_bootstrap_failed | length > 0
- name: Display a list of successfully bootstrapped iDRACs
debug:
@ -217,16 +217,16 @@
- name: Display a list of failed iDRACs
debug:
var: idrac_bootstrap_failed_port_descriptions
when: "{{ idrac_bootstrap_failed | length > 0 }}"
when: idrac_bootstrap_failed | length > 0
- name: Display a list of failed iDRACs with debug output for the failed tasks
debug:
var: idrac_bootstrap_failed
when: "{{ idrac_bootstrap_failed | length > 0 }}"
when: idrac_bootstrap_failed | length > 0
- name: Fail if there were any iDRAC bootstrapping failures
fail:
msg: >
One or more iDRACs failed to bootstrap, see the list above for
details.
when: "{{ idrac_bootstrap_failed | length > 0 }}"
when: idrac_bootstrap_failed | length > 0

View File

@ -22,7 +22,7 @@
}]
}}
with_items: "{{ network_interfaces }}"
when: "{{ item|net_cidr != None }}"
when: item|net_cidr != None
roles:
- role: ip-allocation
ip_allocation_filename: "{{ kayobe_config_path }}/network-allocation.yml"

View File

@ -46,8 +46,8 @@
({{ item.description }}) is invalid. Value:
"{{ hostvars[inventory_hostname][item.var_name] | default('<undefined>') }}".
when:
- "{{ item.required | bool }}"
- "{{ hostvars[inventory_hostname][item.var_name] is not defined or not hostvars[inventory_hostname][item.var_name] }}"
- item.required | bool
- hostvars[inventory_hostname][item.var_name] is not defined or not hostvars[inventory_hostname][item.var_name]
with_items:
- var_name: "kolla_api_interface"
description: "API network interface name"
@ -58,7 +58,7 @@
- var_name: "kolla_inspector_dnsmasq_interface"
description: "Bare metal introspection network interface name"
required: "{{ kolla_enable_ironic }}"
when: "{{ groups['controllers'] | length > 0 }}"
when: groups['controllers'] | length > 0
tags:
- config
- config-validation
@ -71,7 +71,7 @@
kolla_internal_fqdn: "{{ internal_net_name | net_fqdn or internal_net_name | net_vip_address }}"
kolla_external_vip_address: "{{ public_net_name | net_vip_address }}"
kolla_external_fqdn: "{{ public_net_name | net_fqdn or public_net_name | net_vip_address }}"
when: "{{ kolla_enable_haproxy | bool }}"
when: kolla_enable_haproxy | bool
- name: Set facts containing the VIP addresses and FQDNs
set_fact:
@ -79,8 +79,7 @@
kolla_internal_fqdn: "{{ internal_net_name | net_ip(network_host) }}"
kolla_external_vip_address: "{{ public_net_name | net_ip(network_host) }}"
kolla_external_fqdn: "{{ public_net_name | net_ip(network_host) }}"
when:
- "{{ not kolla_enable_haproxy | bool }}"
when: not kolla_enable_haproxy | bool
- name: Set facts containing the network host interfaces
set_fact:
@ -107,7 +106,7 @@
# FIXME: Network host does not have an IP on this network.
- "{{ provision_wl_net_name }}"
- "{{ external_net_name }}"
when: "{{ item in hostvars[network_host].network_interfaces }}"
when: item in hostvars[network_host].network_interfaces
- name: Set facts containing the Neutron bridge and interface names
set_fact:
@ -126,8 +125,8 @@
({{ item.description }}) is invalid. Value:
"{{ hostvars[inventory_hostname][item.var_name] | default('<undefined>') }}".
when:
- "{{ item.required | bool }}"
- "{{ hostvars[inventory_hostname][item.var_name] is not defined or not hostvars[inventory_hostname][item.var_name] }}"
- item.required | bool
- hostvars[inventory_hostname][item.var_name] is not defined or not hostvars[inventory_hostname][item.var_name]
with_items:
- var_name: "kolla_internal_vip_address"
description: "Internal API VIP address"
@ -158,8 +157,8 @@
({{ item.0.description }}) is invalid. Value:
"{{ item.1 | default('<undefined>') }}".
when:
- "{{ item.0.required | bool }}"
- "{{ item.1 is not defined or not item.1 }}"
- item.0.required | bool
- item.1 is not defined or not item.1
with_subelements:
- - var_name: "kolla_neutron_bridge_names"
value: "{{ kolla_neutron_bridge_names }}"
@ -170,7 +169,7 @@
description: "List of Neutron interface names"
required: True
- value
when: "{{ groups['network'] | length > 0 }}"
when: groups['network'] | length > 0
tags:
- config
- config-validation
@ -188,13 +187,13 @@
({{ item.description }}) is invalid. Value:
"{{ hostvars[inventory_hostname][item.var_name] | default('<undefined>') }}".
when:
- "{{ item.required | bool }}"
- "{{ hostvars[inventory_hostname][item.var_name] is not defined or not hostvars[inventory_hostname][item.var_name] }}"
- item.required | bool
- hostvars[inventory_hostname][item.var_name] is not defined or not hostvars[inventory_hostname][item.var_name]
with_items:
- var_name: "kolla_bifrost_network_interface"
description: "Bifrost network interface name"
required: True
when: "{{ groups['seed'] | length > 0 }}"
when: groups['seed'] | length > 0
tags:
- config
- config-validation

View File

@ -18,4 +18,4 @@
# If a service is not installed, the ansible service module will fail
# with this error message.
- '"Could not find the requested service" not in result.msg'
when: "{{ kolla_enable_ironic | bool }}"
when: kolla_enable_ironic | bool

View File

@ -99,7 +99,7 @@
set_fact:
kolla_extra_config: "{{ kolla_extra_config | combine({item.item.name: lookup('template', '{{ item.stat.path }}')}) }}"
with_items: "{{ stat_result.results }}"
when: "{{ item.stat.exists }}"
when: item.stat.exists
- name: Validate switch configuration for Neutron ML2 genericswitch driver
fail:
@ -110,14 +110,12 @@
{{ switch_type_to_device_type.keys() | join(', ') }}.
with_items: "{{ kolla_neutron_ml2_generic_switch_hosts }}"
when: >
{{
item not in hostvars or
'switch_type' not in hostvars[item] or
hostvars[item].switch_type not in switch_type_to_device_type or
'ansible_host' not in hostvars[item] or
'ansible_user' not in hostvars[item] or
'ansible_ssh_pass' not in hostvars[item]
}}
item not in hostvars or
'switch_type' not in hostvars[item] or
hostvars[item].switch_type not in switch_type_to_device_type or
'ansible_host' not in hostvars[item] or
'ansible_user' not in hostvars[item] or
'ansible_ssh_pass' not in hostvars[item]
tags:
- config-validation

View File

@ -9,12 +9,11 @@
{{ item.vgname }}. Ensure that each volume group in 'lvm_groups'
has a valid 'disks' list.
with_items: "{{ lvm_groups | default([]) }}"
when:
- "{{ not item.disks | default([]) or 'changeme' in item.disks | default([]) }}"
when: not item.disks | default([]) or 'changeme' in item.disks | default([])
roles:
- role: mrlesmithjr.manage-lvm
manage_lvm: True
become: True
when:
- "{{ lvm_groups is defined}}"
- "{{ lvm_groups | length > 0 }}"
- lvm_groups is defined
- lvm_groups | length > 0

View File

@ -15,7 +15,7 @@
Network interface validation failed - no interface configured for
{{ item }}. This should be configured via '{{ item }}_interface'.
with_items: "{{ ether_interfaces }}"
when: "{{ not item | net_interface }}"
when: not item | net_interface
- name: Validate bridge interface configuration
fail:
@ -23,7 +23,7 @@
Bridge interface validation failed - no interface configured for
{{ item }}. This should be configured via '{{ item }}_interface'.
with_items: "{{ bridge_interfaces }}"
when: "{{ not item | net_interface }}"
when: not item | net_interface
- name: Validate bond interface configuration
fail:
@ -31,7 +31,7 @@
Bond interface validation failed - no interface configured for
{{ item }}. This should be configured via '{{ item }}_interface'.
with_items: "{{ bond_interfaces }}"
when: "{{ not item | net_interface }}"
when: not item | net_interface
tags:
- config-validation
@ -43,9 +43,9 @@
become: True
register: nm_result
failed_when:
- "{{ nm_result | failed }}"
- nm_result | failed
# Ugh, Ansible's service module doesn't handle uninstalled services.
- "{{ 'Could not find the requested service' not in nm_result.msg }}"
- "'Could not find the requested service' not in nm_result.msg"
roles:
- role: ahuffman.resolv
@ -89,7 +89,7 @@
with_items:
- "{{ provision_wl_net_name }}"
- "{{ external_net_name }}"
when: "{{ item in network_interfaces }}"
when: item in network_interfaces
- name: Update a fact containing veth interfaces
set_fact:

View File

@ -21,8 +21,8 @@
{% if bmc_type is undefined %}is not defined{% else %}{{ bmc_type }}
is not supported{% endif %}.
when:
- "{{ bios_config or raid_config }}"
- "{{ bmc_type is undefined or bmc_type not in supported_bmc_types }}"
- bios_config or raid_config
- bmc_type is undefined or bmc_type not in supported_bmc_types
- name: Group overcloud hosts by their BMC type
group_by:
@ -75,7 +75,7 @@
# NOTE: Without this, the seed's ansible_host variable will not be
# respected when using delegate_to.
ansible_host: "{{ hostvars[seed_host].ansible_host | default(seed_host) }}"
when: "{{ bios_or_raid_change | bool }}"
when: bios_or_raid_change | bool
roles:
- role: stackhpc.drac
@ -84,7 +84,7 @@
drac_password: "{{ ipmi_password }}"
drac_bios_config: "{{ bios_config }}"
drac_raid_config: "{{ raid_config }}"
when: "{{ bios_or_raid_change | bool }}"
when: bios_or_raid_change | bool
tasks:
- name: Unset the overcloud nodes' maintenance mode
@ -107,4 +107,4 @@
# NOTE: Without this, the seed's ansible_host variable will not be
# respected when using delegate_to.
ansible_host: "{{ hostvars[seed_host].ansible_host | default(seed_host) }}"
when: "{{ bios_or_raid_change | bool }}"
when: bios_or_raid_change | bool

View File

@ -63,7 +63,7 @@
Ironic node for {{ inventory_hostname }} is in an unexpected
initial provision state: {{ initial_provision_state }}. Expected
states are: {{ deprovisionable_states | join(',') }}.
when: "{{ initial_provision_state not in deprovisionable_states }}"
when: initial_provision_state not in deprovisionable_states
- name: Ensure the the ironic node is deprovisioned
command: >
@ -82,7 +82,7 @@
until: "{{ delete_result | success or 'is locked by host' in delete_result.stdout }}"
retries: "{{ ironic_retries }}"
delay: "{{ ironic_retry_interval }}"
when: "{{ initial_provision_state != 'available' }}"
when: initial_provision_state != 'available'
delegate_to: "{{ seed_host }}"
vars:
# NOTE: Without this, the seed's ansible_host variable will not be
@ -111,8 +111,8 @@
retries: "{{ wait_available_timeout // wait_available_interval }}"
delay: "{{ wait_available_interval }}"
when:
- "{{ wait_available | bool }}"
- "{{ initial_provision_state != 'available' }}"
- wait_available | bool
- initial_provision_state != 'available'
changed_when: False
delegate_to: "{{ seed_host }}"
vars:
@ -124,8 +124,8 @@
set_fact:
final_provision_state: "{{ show_result.stdout_lines[1] }}"
when:
- "{{ wait_available | bool }}"
- "{{ initial_provision_state != 'available' }}"
- wait_available | bool
- initial_provision_state != 'available'
- name: Fail if the ironic node is not available
fail:
@ -134,6 +134,6 @@
provision state after deprovisioning. Ironic provision state:
{{ final_provision_state }}. Expected: available.
when:
- "{{ wait_available | bool }}"
- "{{ initial_provision_state != 'available' }}"
- "{{ final_provision_state != 'available' }}"
- wait_available | bool
- initial_provision_state != 'available'
- final_provision_state != 'available'

View File

@ -56,7 +56,7 @@
Ironic node for {{ inventory_hostname }} is in an unexpected
initial provision state: {{ initial_provision_state }}. Expected
states are: {{ inspectable_states | join(',') }}.
when: "{{ initial_provision_state not in inspectable_states }}"
when: initial_provision_state not in inspectable_states
- name: Ensure the ironic node is manageable
command: >
@ -75,7 +75,7 @@
until: "{{ manage_result | success or 'is locked by host' in manage_result.stdout }}"
retries: "{{ ironic_retries }}"
delay: "{{ ironic_retry_interval }}"
when: "{{ initial_provision_state != 'manageable' }}"
when: initial_provision_state != 'manageable'
delegate_to: "{{ seed_host }}"
vars:
# NOTE: Without this, the seed's ansible_host variable will not be
@ -125,8 +125,7 @@
until: "{{ not show_result.stdout_lines[1:] | intersect(inspecting_states) }}"
retries: "{{ wait_inspected_timeout // wait_inspected_interval }}"
delay: "{{ wait_inspected_interval }}"
when:
- "{{ wait_inspected | bool }}"
when: wait_inspected | bool
changed_when: False
delegate_to: "{{ seed_host }}"
vars:
@ -137,8 +136,7 @@
- name: Set a fact containing the final provision state
set_fact:
final_provision_state: "{{ show_result.stdout_lines[1] }}"
when:
- "{{ wait_inspected | bool }}"
when: wait_inspected | bool
- name: Fail if any of the nodes are not manageable
fail:
@ -147,5 +145,5 @@
provision state after inspecting. Ironic provision state:
{{ final_provision_state }}. Expected: manageable.
when:
- "{{ wait_inspected | bool }}"
- "{{ final_provision_state != 'manageable' }}"
- wait_inspected | bool
- final_provision_state != 'manageable'

View File

@ -62,8 +62,8 @@
{% if item in openstack_auth %}empty{% else %}not present{% endif %}
in openstack_auth. Have you sourced the environment file?
when:
- "{{ openstack_auth_type == 'password' }}"
- "{{ item not in openstack_auth or not openstack_auth[item] }}"
- openstack_auth_type == 'password'
- item not in openstack_auth or not openstack_auth[item]
with_items: "{{ openstack_auth_password_required_params }}"
tags:
- config-validation
@ -79,7 +79,7 @@
[{'host': item.key,
'interface_config': item.value.switch_interface_config.items()}] }}
with_dict: "{{ hostvars }}"
when: "{{ item.key in groups[inspector_dell_switch_lldp_workaround_group] }}"
when: item.key in groups[inspector_dell_switch_lldp_workaround_group]
- name: Update a fact containing Ironic Inspector rules
set_fact:
@ -90,11 +90,11 @@
- "{{ all_switch_interfaces }}"
- interface_config
when:
- "{{ item.1.1.description is defined }}"
- item.1.1.description is defined
# Ignore VLAN interfaces.
- "{{ 'vlan' not in item.1.0 }}"
- "'vlan' not in item.1.0"
# Ignore trunk links.
- "{{ '-trunk' not in item.1.1.description }}"
- "'-trunk' not in item.1.1.description"
roles:
- role: ironic-inspector-rules

View File

@ -12,8 +12,8 @@
{% if item in openstack_auth %}empty{% else %}not present{% endif %}
in openstack_auth. Have you sourced the environment file?
when:
- "{{ openstack_auth_type == 'password' }}"
- "{{ item not in openstack_auth or not openstack_auth[item] }}"
- openstack_auth_type == 'password'
- item not in openstack_auth or not openstack_auth[item]
with_items: "{{ openstack_auth_password_required_params }}"
tags:
- config-validation

View File

@ -24,4 +24,4 @@
type: raw
os_images_git_elements: "{{ ipa_build_dib_git_elements }}"
os_images_upload: False
when: "{{ ipa_build_images | bool }}"
when: ipa_build_images | bool

View File

@ -66,7 +66,7 @@
Ironic node for {{ inventory_hostname }} is in an unexpected
initial provision state: {{ initial_provision_state }}. Expected
states are: {{ provisionable_states | join(',') }}.
when: "{{ initial_provision_state not in provisionable_states }}"
when: initial_provision_state not in provisionable_states
- name: Ensure the ironic node is manageable
command: >
@ -85,7 +85,7 @@
until: "{{ manage_result | success or 'is locked by host' in manage_result.stdout }}"
retries: "{{ ironic_retries }}"
delay: "{{ ironic_retry_interval }}"
when: "{{ initial_provision_state == 'enroll' }}"
when: initial_provision_state == 'enroll'
delegate_to: "{{ seed_host }}"
vars:
# NOTE: Without this, the seed's ansible_host variable will not be
@ -109,7 +109,7 @@
until: "{{ provide_result | success or 'is locked by host' in provide_result.stdout }}"
retries: "{{ ironic_retries }}"
delay: "{{ ironic_retry_interval }}"
when: "{{ initial_provision_state in ['enroll', 'manageable'] }}"
when: initial_provision_state in ['enroll', 'manageable']
delegate_to: "{{ seed_host }}"
vars:
# NOTE: Without this, the seed's ansible_host variable will not be
@ -120,7 +120,7 @@
set_fact:
bifrost_limit: "{{ bifrost_limit + [item] }}"
with_items: "{{ play_hosts }}"
when: "{{ hostvars[item].initial_provision_state != 'active' }}"
when: hostvars[item].initial_provision_state != 'active'
run_once: True
- name: Ensure the ironic nodes are provisioned
@ -135,7 +135,7 @@
-e @/etc/bifrost/bifrost.yml
-e @/etc/bifrost/dib.yml
--limit {{ bifrost_limit | join(':') }}'
when: "{{ bifrost_limit }}"
when: bifrost_limit
delegate_to: "{{ seed_host }}"
vars:
# NOTE: Without this, the seed's ansible_host variable will not be
@ -167,8 +167,8 @@
retries: "{{ wait_active_timeout // wait_active_interval }}"
delay: "{{ wait_active_interval }}"
when:
- "{{ wait_active | bool }}"
- "{{ initial_provision_state != 'active' }}"
- wait_active | bool
- initial_provision_state != 'active'
changed_when: False
delegate_to: "{{ seed_host }}"
vars:
@ -180,8 +180,8 @@
set_fact:
final_provision_state: "{{ show_result.stdout_lines[1] }}"
when:
- "{{ wait_active | bool }}"
- "{{ initial_provision_state != 'active' }}"
- wait_active | bool
- initial_provision_state != 'active'
- name: Fail if any of the nodes are not available
fail:
@ -190,9 +190,9 @@
provision state after provisioning. Ironic provision state:
{{ final_provision_state }}. Expected: active.
when:
- "{{ wait_active | bool }}"
- "{{ initial_provision_state != 'active' }}"
- "{{ final_provision_state != 'active' }}"
- wait_active | bool
- initial_provision_state != 'active'
- final_provision_state != 'active'
- name: Wait for SSH access to the nodes
local_action:
@ -201,5 +201,4 @@
port: 22
state: started
timeout: "{{ wait_ssh_timeout }}"
when:
- "{{ wait_ssh | bool }}"
when: wait_ssh | bool

View File

@ -41,7 +41,7 @@
set_fact:
switch_interface_config: >
{{ switch_interface_config | combine(switch_interface_config_discovery) }}
when: "{{ physical_network_enable_discovery | bool }}"
when: physical_network_enable_discovery | bool
- name: Restrict switch interfaces to requested subset by name
set_fact:

View File

@ -10,8 +10,8 @@
{% if item in openstack_auth %}empty{% else %}not present{% endif %}
in openstack_auth. Have you sourced the environment file?
when:
- "{{ openstack_auth_type == 'password' }}"
- "{{ item not in openstack_auth or not openstack_auth[item] }}"
- openstack_auth_type == 'password'
- item not in openstack_auth or not openstack_auth[item]
with_items: "{{ openstack_auth_password_required_params }}"
tags:
- config-validation

View File

@ -4,11 +4,11 @@
module: dellos6_config
provider: "{{ dell_switch_provider }}"
src: dellos6-config.j2
when: "{{ dell_switch_type == 'dellos6' }}"
when: dell_switch_type == 'dellos6'
- name: Ensure DellOS9 switches are configured
local_action:
module: dellos9_config
provider: "{{ dell_switch_provider }}"
src: dellos9-config.j2
when: "{{ dell_switch_type == 'dellos9' }}"
when: dell_switch_type == 'dellos9'

View File

@ -16,7 +16,7 @@
- name: Set a fact to determine whether we are running locally
set_fact:
is_local: "{{ lookup('pipe', 'hostname') in [ansible_hostname, ansible_nodename] }}"
when: "{{ selinux_result | changed }}"
when: selinux_result | changed
# Any SSH connection errors cause ansible to fail the task. We therefore
# perform a manual SSH connection and allow the command to fail.
@ -29,18 +29,18 @@
sudo shutdown -r now "Applying SELinux changes"
register: reboot_result
failed_when:
- "{{ reboot_result | failed }}"
- "{{ 'closed by remote host' not in reboot_result.stderr }}"
- reboot_result | failed
- "'closed by remote host' not in reboot_result.stderr"
when:
- "{{ selinux_result | changed }}"
- "{{ not is_local | bool }}"
- selinux_result | changed
- not is_local | bool
- name: Reboot the system to apply SELinux changes (local)
command: shutdown -r now "Applying SELinux changes"
become: True
when:
- "{{ selinux_result | changed }}"
- "{{ is_local | bool }}"
- selinux_result | changed
- is_local | bool
# If we're running this locally we won't get here.
- name: Wait for the system to boot up (remote)
@ -53,5 +53,5 @@
delay: 10
timeout: "{{ disable_selinux_reboot_timeout }}"
when:
- "{{ selinux_result | changed }}"
- "{{ not is_local | bool }}"
- selinux_result | changed
- not is_local | bool

View File

@ -81,11 +81,11 @@
Not configuring docker storage in {{ docker_storage_driver }} mode as
loopback-backed containers or images exist.
when:
- "{{ 'Data loop file' in docker_info.stdout }}"
- "{{ 'Images: 0' not in docker_info.stdout }}"
- "{{ 'Containers: 0' not in docker_info.stdout }}"
- "'Data loop file' in docker_info.stdout"
- "'Images: 0' not in docker_info.stdout"
- "'Containers: 0' not in docker_info.stdout"
- include: storage.yml
when: "{{ 'Data loop file' in docker_info.stdout }}"
when: "'Data loop file' in docker_info.stdout"
- include: config.yml

View File

@ -4,7 +4,7 @@
msg: >
Unexpected requested boot mode {{ drac_boot_mode }}. Expected one of
{{ drac_boot_mode_valid_modes | join(', ') }}.
when: "{{ drac_boot_mode | lower not in drac_boot_mode_valid_modes }}"
when: drac_boot_mode | lower not in drac_boot_mode_valid_modes
- name: Check the boot mode
raw: "racadm get BIOS.BiosBootSettings.BootMode"
@ -23,7 +23,7 @@
msg: >
Unexpected current boot mode {{ current_boot_mode }}. Expected one of
{{ drac_boot_mode_valid_modes | join(', ') }}.
when: "{{ current_boot_mode not in drac_boot_mode_valid_modes }}"
when: current_boot_mode not in drac_boot_mode_valid_modes
- block:
- name: Set the boot mode
@ -61,4 +61,4 @@
retries: "{{ drac_boot_mode_timeout // drac_boot_mode_interval }}"
delay: "{{ drac_boot_mode_interval }}"
when: "{{ current_boot_mode != drac_boot_mode }}"
when: current_boot_mode != drac_boot_mode

View File

@ -25,8 +25,8 @@
Unable to determine the boot mode. Got: {{ result.stdout }}. Expected
bios or uefi.
when:
- "{{ not boot_mode_is_bios }}"
- "{{ not boot_mode_is_uefi }}"
- not boot_mode_is_bios
- not boot_mode_is_uefi
- name: Check the BIOS boot sequence
raw: "racadm get BIOS.BiosBootSettings.{% if boot_mode_is_uefi %}Uefi{% endif %}BootSeq"
@ -46,7 +46,7 @@
msg: >
There is a pending boot sequence configuration change. Please
apply this change before continuing.
when: "{{ 'Pending' in current_boot_sequence }}"
when: "'Pending' in current_boot_sequence"
- block:
- name: Check the NICs' boot protocol
@ -75,12 +75,12 @@
There is a pending NIC boot protocol configuration change for
NIC {{ item.nic }}. Please apply this before continuing.
with_items: "{{ nic_boot_protos }}"
when: "{{ 'Pending' in item.current }}"
when: "'Pending' in item.current"
- name: Ensure NIC boot protocol is configured
raw: "racadm set Nic.NICConfig.{{ item.nic }}.LegacyBootProto {{ item.required }}"
with_items: "{{ nic_boot_protos }}"
when: "{{ item.current != item.required }}"
when: item.current != item.required
register: result
failed_when: "'ERROR' in result.stdout"
until: "{{ drac_pxe_busy_message not in result.stdout }}"
@ -90,7 +90,7 @@
- name: Ensure NIC configuration jobs are created
raw: "racadm jobqueue create NIC.Integrated.1-{{ item.nic }}-1 -s TIME_NOW"
with_items: "{{ nic_boot_protos }}"
when: "{{ item.current != item.required }}"
when: item.current != item.required
register: result
failed_when: "'ERROR' in result.stdout"
until: "{{ drac_pxe_busy_message not in result.stdout }}"
@ -101,9 +101,9 @@
set_fact:
job_ids: "{{ job_ids + [item.stdout_lines[-1].split()[-1]] }}"
with_items: "{{ result.results }}"
when: "{{ not item.skipped }}"
when: not item.skipped
when: "{{ boot_mode_is_bios }}"
when: boot_mode_is_bios
- block:
- name: Check the UEFI PXE interface
@ -122,7 +122,7 @@
msg: >
There is a pending UEFI PXE interface configuration change.
Please apply this before continuing.
when: "{{ 'Pending' in current_pxe_interface }}"
when: "'Pending' in current_pxe_interface"
- name: Ensure UEFI PXE device is configured
raw: "racadm set BIOS.PxeDev1Settings.PxeDev1Interface NIC.Integrated.1-{{ drac_pxe_interface }}-1"
@ -131,14 +131,14 @@
until: "{{ drac_pxe_busy_message not in result.stdout }}"
retries: "{{ drac_pxe_retries }}"
delay: "{{ drac_pxe_interval }}"
when: "{{ current_pxe_interface != required_pxe_interface }}"
when: current_pxe_interface != required_pxe_interface
- name: Set a fact to trigger a BIOS configuration job
set_fact:
bios_job_required: True
when: "{{ current_pxe_interface != required_pxe_interface }}"
when: current_pxe_interface != required_pxe_interface
when: "{{ boot_mode_is_uefi }}"
when: boot_mode_is_uefi
- name: Ensure boot sequence is configured
raw: "racadm set BIOS.BiosBootSettings.BootSeq {{ drac_pxe_bios_boot_sequence }}"
@ -147,12 +147,12 @@
until: "{{ drac_pxe_busy_message not in result.stdout }}"
retries: "{{ drac_pxe_retries }}"
delay: "{{ drac_pxe_interval }}"
when: "{{ current_boot_sequence != required_boot_sequence }}"
when: current_boot_sequence != required_boot_sequence
- name: Set a fact to trigger a BIOS configuration job
set_fact:
bios_job_required: True
when: "{{ current_boot_sequence != required_boot_sequence }}"
when: current_boot_sequence != required_boot_sequence
- name: Ensure BIOS configuration job is created
raw: "racadm jobqueue create BIOS.Setup.1-1 -s TIME_NOW"
@ -161,14 +161,14 @@
until: "{{ drac_pxe_busy_message not in result.stdout }}"
retries: "{{ drac_pxe_retries }}"
delay: "{{ drac_pxe_interval }}"
when: "{{ bios_job_required }}"
when: bios_job_required
- name: Set a fact containing the BIOS configuration job ID
set_fact:
# Format of the last line is:
# JOB_ID = <job ID>
job_ids: "{{ job_ids + [result.stdout_lines[-1].split()[-1]] }}"
when: "{{ bios_job_required }}"
when: bios_job_required
- name: Ensure server is rebooted
raw: "racadm serveraction powercycle"
@ -178,7 +178,7 @@
- name: Wait for the configuration jobs to complete
raw: "racadm jobqueue view -i {{ item }}"
with_items: "{{ job_ids }}"
when: "{{ job_ids | length > 0 }}"
when: job_ids | length > 0
register: result
failed_when: "'ERROR' in result.stdout"
until: "{{ 'Status=Completed' in result.stdout }}"

View File

@ -16,7 +16,7 @@
filename: "{{ ipa_images_kernel_name }}"
- url: "{{ ipa_images_ramdisk_url }}"
filename: "{{ ipa_images_ramdisk_name }}"
when: "{{ item.url != None }}"
when: item.url != None
- name: Compute the MD5 checksum of the Ironic Python Agent (IPA) images
stat:
@ -47,7 +47,7 @@
- name: Set a fact containing the Ironic Python Agent (IPA) kernel image checksum
set_fact:
ipa_images_kernel_checksum: "{{ openstack_image.checksum }}"
when: "{{ openstack_image != None }}"
when: openstack_image != None
- name: Gather facts about Ironic Python Agent (IPA) ramdisk image
os_image_facts:
@ -58,7 +58,7 @@
- name: Set a fact containing the Ironic Python Agent (IPA) ramdisk image checksum
set_fact:
ipa_images_ramdisk_checksum: "{{ openstack_image.checksum }}"
when: "{{ openstack_image != None }}"
when: openstack_image != None
- name: Ensure Ironic Python Agent (IPA) images are removed from Glance
os_image:
@ -74,8 +74,8 @@
checksum: "{{ ipa_images_checksum.results[1].stat.md5 }}"
glance_checksum: "{{ ipa_images_ramdisk_checksum | default }}"
when:
- "{{ item.glance_checksum != None }}"
- "{{ item.checksum != item.glance_checksum }}"
- item.glance_checksum != None
- item.checksum != item.glance_checksum
- name: Ensure Ironic Python Agent (IPA) images are registered with Glance
os_image:

View File

@ -23,14 +23,14 @@
owner: "{{ ansible_user }}"
group: "{{ ansible_user }}"
become: True
when: "{{ kolla_ansible_ctl_install_type == 'source' }}"
when: kolla_ansible_ctl_install_type == 'source'
- name: Ensure Kolla Ansible source code checkout exists
git:
repo: "{{ kolla_ansible_source_url }}"
dest: "{{ kolla_ansible_source_path }}"
version: "{{ kolla_ansible_source_version }}"
when: "{{ kolla_ansible_ctl_install_type == 'source' }}"
when: kolla_ansible_ctl_install_type == 'source'
- name: Ensure the latest version of pip is installed
pip:
@ -61,7 +61,7 @@
# Required for kolla-genpwd.
- name: PyYAML
version: "3.12"
when: "{{ item.install | default(True) | bool }}"
when: item.install | default(True) | bool
# This is a workaround for the lack of a python package for libselinux-python
# on PyPI. Without using --system-site-packages to create the virtualenv, it

View File

@ -1,6 +1,6 @@
---
- include: install.yml
when: "{{ kolla_ansible_is_standalone | bool }}"
when: kolla_ansible_is_standalone | bool
tags:
- install

View File

@ -25,14 +25,14 @@
owner: "{{ ansible_user }}"
group: "{{ ansible_user }}"
become: True
when: "{{ kolla_ctl_install_type == 'source' }}"
when: kolla_ctl_install_type == 'source'
- name: Ensure Kolla source code checkout exists
git:
repo: "{{ kolla_source_url }}"
dest: "{{ kolla_source_path }}"
version: "{{ kolla_source_version }}"
when: "{{ kolla_ctl_install_type == 'source' }}"
when: kolla_ctl_install_type == 'source'
- name: Ensure the latest version of pip is installed
pip:
@ -64,4 +64,4 @@
# Required for kolla-genpwd.
- name: PyYAML
version: "3.12"
when: "{{ item.install | default(True) | bool }}"
when: item.install | default(True) | bool

View File

@ -7,5 +7,5 @@
with_items: "{{ libvirt_vm_volumes }}"
register: volume_result
changed_when:
- "{{ volume_result | success }}"
- "{{ (volume_result.stdout | from_json).changed | default(True) }}"
- volume_result | success
- (volume_result.stdout | from_json).changed | default(True)

View File

@ -4,14 +4,14 @@
url: "{{ item }}"
dest: "{{ libvirt_vm_image_cache_path }}/{{ item | basename }}"
with_items: "{{ libvirt_vm_volumes | selectattr('image', 'defined') | map(attribute='image') | list }}"
when: "{{ 'http' in item }}"
when: "'http' in item"
- name: Ensure local images are copied
copy:
src: "{{ item }}"
dest: "{{ libvirt_vm_image_cache_path }}/{{ item | basename }}"
with_items: "{{ libvirt_vm_volumes | selectattr('image', 'defined') | map(attribute='image') | list }}"
when: "{{ 'http' not in item }}"
when: "'http' not in item"
- name: Ensure the VM volumes exist
script: >
@ -26,5 +26,5 @@
with_items: "{{ libvirt_vm_volumes }}"
register: volume_result
changed_when:
- "{{ volume_result | success }}"
- "{{ (volume_result.stdout | from_json).changed | default(True) }}"
- volume_result | success
- (volume_result.stdout | from_json).changed | default(True)

View File

@ -39,5 +39,5 @@
with_together:
- "{{ veth_result.results }}"
- "{{ peer_result.results }}"
when: "{{ ctl_result|changed or item[0]|changed or item[1]|changed }}"
when: ctl_result|changed or item[0]|changed or item[1]|changed
become: True

View File

@ -36,7 +36,7 @@
notify:
- Copy Ironic Python Agent images into /httpboot
become: True
when: "{{ ipa_build_images | bool }}"
when: ipa_build_images | bool
handlers:
- name: Copy Ironic Python Agent images into /httpboot

View File

@ -11,7 +11,7 @@
msg: >
There should be exactly one host in the seed group. There are
currently {{ groups['seed'] | length }}.
when: "{{ groups['seed'] | length != 1 }}"
when: groups['seed'] | length != 1
- name: Ensure the image cache directory exists
file:

View File

@ -8,4 +8,4 @@
swift_region: 1
# ID of the zone for this Swift service.
swift_zone: "{{ groups['controllers'].index(inventory_hostname) % swift_num_zones }}"
when: "{{ kolla_enable_swift | bool }}"
when: kolla_enable_swift | bool

View File

@ -26,8 +26,8 @@
{% if item in openstack_auth %}empty{% else %}not present{% endif %}
in openstack_auth. Have you sourced the environment file?
when:
- "{{ openstack_auth_type == 'password' }}"
- "{{ item not in openstack_auth or not openstack_auth[item] }}"
- openstack_auth_type == 'password'
- item not in openstack_auth or not openstack_auth[item]
with_items: "{{ openstack_auth_password_required_params }}"
tags:
- config-validation