diff --git a/.ansible-lint b/.ansible-lint index 97be46e59..4b2817d1f 100644 --- a/.ansible-lint +++ b/.ansible-lint @@ -3,7 +3,6 @@ skip_list: - '208' # File permissions not mentioned - '301' # Commands should not change things if nothing needs doing - '502' # All tasks should be named - - '601' # Don't compare to literal True/False - '701' # meta/main.yml should contain relevant info - '702' # Tags must contain lowercase letters and digits only # NOTE(dtantsur): the following rules should likely stay excluded: diff --git a/playbooks/enroll-dynamic.yaml b/playbooks/enroll-dynamic.yaml index c18b28f13..9bad99e62 100644 --- a/playbooks/enroll-dynamic.yaml +++ b/playbooks/enroll-dynamic.yaml @@ -7,5 +7,5 @@ - role: ironic-enroll-dynamic delegate_to: "{{ groups['target'][0] if groups['target'] is defined else 'localhost' }}" - role: ironic-inspect-node - when: inspect_nodes | default('false') | bool == true + when: inspect_nodes | default('false') | bool delegate_to: "{{ groups['target'][0] if groups['target'] is defined else 'localhost' }}" diff --git a/playbooks/example-deploy-all-available-nodes.yaml b/playbooks/example-deploy-all-available-nodes.yaml index dbd69de05..2bed57af7 100644 --- a/playbooks/example-deploy-all-available-nodes.yaml +++ b/playbooks/example-deploy-all-available-nodes.yaml @@ -26,5 +26,7 @@ become: no connection: local roles: - - { role: bifrost-configdrives-dynamic, when: provision_state == "available" and maintenance | bool != true } - - { role: bifrost-deploy-nodes-dynamic, when: provision_state == "available" and maintenance | bool != true } + - { role: bifrost-configdrives-dynamic, + when: provision_state == "available" and maintenance | bool } + - { role: bifrost-deploy-nodes-dynamic, + when: provision_state == "available" and maintenance | bool } diff --git a/playbooks/redeploy-dynamic.yaml b/playbooks/redeploy-dynamic.yaml index 60b8a20ec..8bffab8f2 100644 --- a/playbooks/redeploy-dynamic.yaml +++ b/playbooks/redeploy-dynamic.yaml @@ -38,9 +38,11 @@ skip_items: [] register: node_info roles: - - { role: bifrost-unprovision-node-dynamic, when: (provision_state == "active" - or provision_state == "deploy failed" - or provision_state == "error") and maintenance | bool != true } + - { role: bifrost-unprovision-node-dynamic, + when: (provision_state == "active" + or provision_state == "deploy failed" + or provision_state == "error") + and (not maintenance | bool) } post_tasks: - name: "Pull ironic facts until provision state available" os_ironic_node_info: @@ -58,8 +60,10 @@ become: no connection: local roles: - - { role: bifrost-configdrives-dynamic, when: provision_state == "available" and maintenance | bool != true } - - { role: bifrost-deploy-nodes-dynamic, when: provision_state == "available" and maintenance | bool != true } + - { role: bifrost-configdrives-dynamic, + when: (provision_state == "available") and (not maintenance | bool) } + - { role: bifrost-deploy-nodes-dynamic, + when: (provision_state == "available") and (not maintenance | bool) } post_tasks: - name: "Pull ironic facts until provision state active" os_ironic_node_info: diff --git a/playbooks/roles/bifrost-configdrives-dynamic/tasks/main.yml b/playbooks/roles/bifrost-configdrives-dynamic/tasks/main.yml index 767499daf..7f4197be1 100644 --- a/playbooks/roles/bifrost-configdrives-dynamic/tasks/main.yml +++ b/playbooks/roles/bifrost-configdrives-dynamic/tasks/main.yml @@ -66,7 +66,7 @@ - name: "Write network Debian style interface template" template: src=interfaces.j2 dest={{ variable_configdrive_location.path }}/{{ uuid }}/openstack/content/0000 - when: write_interfaces_file | bool == true + when: write_interfaces_file | bool - name: "Check if mkisofs is available" command: mkisofs --help diff --git a/playbooks/roles/bifrost-configdrives-dynamic/tasks/ssh_public_key_path.yaml b/playbooks/roles/bifrost-configdrives-dynamic/tasks/ssh_public_key_path.yaml index 559ee0f72..1a078ca21 100644 --- a/playbooks/roles/bifrost-configdrives-dynamic/tasks/ssh_public_key_path.yaml +++ b/playbooks/roles/bifrost-configdrives-dynamic/tasks/ssh_public_key_path.yaml @@ -22,7 +22,7 @@ - name: "Defined ssh_public_key_path - Error if ssh_public_key_path is not valid" fail: msg: "ssh_public_key_path is not valid." - when: test_ssh_public_key_path.stat.exists == false + when: not test_ssh_public_key_path.stat.exists | bool delegate_to: localhost - name: "Defined ssh_public_key_path - Read SSH public key in" diff --git a/playbooks/roles/bifrost-create-bootable-image/tasks/main.yml b/playbooks/roles/bifrost-create-bootable-image/tasks/main.yml index 7ec8bf643..3b6fe46dd 100644 --- a/playbooks/roles/bifrost-create-bootable-image/tasks/main.yml +++ b/playbooks/roles/bifrost-create-bootable-image/tasks/main.yml @@ -18,4 +18,4 @@ register: test_image_present - name: "Create bootable image" include: create_bootable_image.yml - when: test_image_present.stat.exists == true + when: test_image_present.stat.exists | bool diff --git a/playbooks/roles/bifrost-create-dib-image/tasks/main.yml b/playbooks/roles/bifrost-create-dib-image/tasks/main.yml index 60dcf5614..689e9812e 100644 --- a/playbooks/roles/bifrost-create-dib-image/tasks/main.yml +++ b/playbooks/roles/bifrost-create-dib-image/tasks/main.yml @@ -25,37 +25,39 @@ - name: "Test if image is present - {{ dib_imagename }}.{{ dib_imagetype | default('qcow2') }}" stat: path={{ dib_imagename }}.{{ dib_imagetype | default('qcow2') }} register: test_image_dib_present - when: test_image_present.stat.exists == false + when: not test_image_present.stat.exists # Note(TheJulia): We need to explicitly test for initramfs in the case # that the ironic-python-agent-ramdisk element is used to build the image. - name: "Test if image is present - {{ dib_imagename }}.initramfs" stat: path={{ dib_imagename }}.initramfs register: test_image_initramfs_present - when: test_image_present.stat.exists == false and test_image_dib_present.stat.exists == false + when: + - not test_image_present.stat.exists + - not test_image_dib_present.stat.exists - name: "Build tracing (-x) option for disk-image-create" set_fact: dib_trace_arg: "-x" - when: dib_trace == true + when: dib_trace | bool - name: "Build uncompressed (-u) option for disk-image-create" set_fact: dib_uncompressed_arg: "-u" - when: dib_uncompressed == true + when: dib_uncompressed | bool - name: "Build clear environment (-c) option for disk-image-create" set_fact: dib_clearenv_arg: "-c" - when: dib_clearenv == true + when: dib_clearenv | bool - name: "Build no tmpfs (--no-tmpfs) option for disk-image-create" set_fact: dib_notmpfs_arg: "--no-tmpfs" - when: dib_notmpfs == true + when: dib_notmpfs | bool - name: "Build offline (--offline) option for disk-image-create" set_fact: dib_offline_arg: "--offline" - when: dib_offline == true + when: dib_offline | bool - name: "Build skip default base element (-n) option for disk-image-create" set_fact: dib_skipbase_arg: "-n" - when: dib_skipbase == true + when: dib_skipbase | bool - name: "Build architecture (-a) option for disk-image-create" set_fact: dib_arch_arg: "-a {{ dib_arch }}" @@ -187,11 +189,11 @@ package: name: debootstrap state: present - when: > - test_image_present.stat.exists == false - and test_image_dib_present.stat.exists == false - and test_image_initramfs_present.stat.exists == false - and ("debian" in dib_os_element or "ubuntu" in dib_os_element) + when: + - not test_image_present.stat.exists + - not test_image_dib_present.stat.exists + - not test_image_initramfs_present.stat.exists + - ("debian" in dib_os_element or "ubuntu" in dib_os_element) - name: "Initiate image build" command: disk-image-create {{ dib_arglist }} environment: "{{ dib_env_vars_final | combine(bifrost_venv_env) }}" diff --git a/playbooks/roles/bifrost-create-vm-nodes/tasks/main.yml b/playbooks/roles/bifrost-create-vm-nodes/tasks/main.yml index 6eeb37409..a71da5bd7 100644 --- a/playbooks/roles/bifrost-create-vm-nodes/tasks/main.yml +++ b/playbooks/roles/bifrost-create-vm-nodes/tasks/main.yml @@ -79,7 +79,7 @@ version: "{{ reqs_git_branch }}" update: "{{ update_repos | bool }}" clone: yes - when: copy_from_local_path | bool == false + when: not copy_from_local_path | bool - name: copy requirements from local path command: cp -a {{ reqs_git_url }} {{ reqs_git_folder }} creates={{ reqs_git_folder }} diff --git a/playbooks/roles/bifrost-create-vm-nodes/tasks/prepare_libvirt.yml b/playbooks/roles/bifrost-create-vm-nodes/tasks/prepare_libvirt.yml index 3ff0fcaf2..ec3abc46d 100644 --- a/playbooks/roles/bifrost-create-vm-nodes/tasks/prepare_libvirt.yml +++ b/playbooks/roles/bifrost-create-vm-nodes/tasks/prepare_libvirt.yml @@ -57,9 +57,9 @@ - name: "Place sgabios.bin" command: cp /usr/share/misc/sgabios.bin /usr/share/qemu/sgabios.bin - when: > - test_sgabios_qemu == false and - test_sgabios_misc == true + when: + - not test_sgabios_qemu | bool + - test_sgabios_misc | bool # NOTE(TheJulia): In order to prevent conflicts, stop # dnsmasq to prevent conflicts with libvirt restarting. diff --git a/playbooks/roles/bifrost-deploy-nodes-dynamic/tasks/main.yml b/playbooks/roles/bifrost-deploy-nodes-dynamic/tasks/main.yml index 667288792..fc3fcaf66 100644 --- a/playbooks/roles/bifrost-deploy-nodes-dynamic/tasks/main.yml +++ b/playbooks/roles/bifrost-deploy-nodes-dynamic/tasks/main.yml @@ -31,7 +31,7 @@ owner: root group: root mode: 0644 - when: inventory_dhcp | bool == true + when: inventory_dhcp | bool become: yes - name: "Setup DNS address for nodes." @@ -41,7 +41,7 @@ owner: root group: root mode: 0644 - when: inventory_dns | bool == true + when: inventory_dns | bool become: yes - name: "Restarting dnsmasq" @@ -49,7 +49,7 @@ name: dnsmasq state: restarted become: yes - when: (inventory_dhcp | bool == true) or (inventory_dns | bool == true) + when: inventory_dhcp | bool or inventory_dns | bool - name: "Deploy to hardware - Using custom instance_info." openstack.cloud.baremetal_node_action: @@ -76,7 +76,9 @@ - name: "Error if deploy_image is not present, and instance_info is not defined" fail: msg="The user-defined deploy_image, which is the image to be written to the remote node(s) upon deployment, was not found. Cannot proceed." - when: instance_info is not defined and test_deploy_image.stat.exists | bool == false + when: + - instance_info is not defined + - not test_deploy_image.stat.exists - name: "Deploy to hardware - bifrost default" openstack.cloud.baremetal_node_action: diff --git a/playbooks/roles/bifrost-ironic-install/tasks/bootstrap.yml b/playbooks/roles/bifrost-ironic-install/tasks/bootstrap.yml index c71e04706..217f562a1 100644 --- a/playbooks/roles/bifrost-ironic-install/tasks/bootstrap.yml +++ b/playbooks/roles/bifrost-ironic-install/tasks/bootstrap.yml @@ -18,9 +18,9 @@ msg: > noauth_mode and enable_keystone are mutually exclusive options. Please set one to "false". - when: > - noauth_mode | bool == true and enable_keystone is defined and - enable_keystone | bool == true + when: + - noauth_mode | bool + - enable_keystone | bool - block: - name: "Ask systemd to reload configuration" @@ -161,7 +161,8 @@ - name: "Populate keystone for Bifrost" include: keystone_setup.yml - when: enable_keystone is defined and enable_keystone | bool == true + when: + - enable_keystone | bool # NOTE(pas-ha) needed to e.g. pick up new interfaces after libvirt install - name: "Refresh facts" @@ -186,16 +187,16 @@ - name: "Create ironic DB Schema" command: ironic-dbsync --config-file /etc/ironic/ironic.conf create_schema environment: "{{ bifrost_venv_env }}" - when: > - ironic.database.host == 'localhost' and - test_created_db.changed | bool == true + when: + - ironic.database.host == 'localhost' + - test_created_db.changed | bool - name: "Upgrade ironic DB Schema" command: ironic-dbsync --config-file /etc/ironic/ironic.conf upgrade environment: "{{ bifrost_venv_env }}" when: > ironic.database.host != 'localhost' or - test_created_db.changed | bool == false + not test_created_db.changed | bool - name: "Create service folder" file: @@ -205,7 +206,7 @@ - name: "Install ironic-inspector to permit use of inspection interface" include: inspector_bootstrap.yml - when: enable_inspector | bool == true + when: enable_inspector | bool - name: "Get ironic-api & ironic-conductor install location" shell: echo $(dirname $(which ironic-api)) @@ -249,7 +250,7 @@ owner: "root" group: "root" mode: 0755 - when: inventory_dhcp | bool == true + when: inventory_dhcp | bool - name: "Setup Inventory DHCP Hosts Directory" file: path: "/etc/dnsmasq.d/bifrost.dhcp-hosts.d" @@ -257,19 +258,19 @@ owner: "root" group: "root" mode: 0755 - when: inventory_dhcp | bool == true + when: inventory_dhcp | bool - name: "Retrieve interface IP informations" set_fact: itf_infos: "{{ internal_interface }}" dhcp_netaddr: "{{ dhcp_pool_start }}/{{ dhcp_static_mask }}" - when: include_dhcp_server | bool == true + when: include_dhcp_server | bool - name: "Compute interface and DHCP network informations" set_fact: itf_netaddr1: "{{ itf_infos['address'] }}/{{ itf_infos['netmask'] }}" itf_netaddr2: "{{ itf_infos['network'] }}/{{ itf_infos['netmask'] }}" itf_broadcast: "{{ itf_infos['broadcast'] }}/{{ itf_infos['netmask'] }}" dhcp_netaddr: "{{ dhcp_netaddr | ipaddr('network') }}/{{ dhcp_static_mask }}" - when: include_dhcp_server | bool == true + when: include_dhcp_server | bool - name: "Validate interface network addresses" fail: msg: > @@ -304,7 +305,7 @@ dhcp_end_ip: "{{ dhcp_pool_end.split('.')[-1] }}" dhcp_netaddr: "{{ itf_netaddr1 | ipaddr('network') }}" when: - - include_dhcp_server | bool == true + - include_dhcp_server | bool - itf_netaddr2 | ipaddr('network') != dhcp_netaddr | ipaddr('network') # Note(olivierbourdon38): we could do much more complex network # computation to derive exact (or way closer to exact) range for @@ -314,28 +315,30 @@ dhcp_pool_start: "{{ '.'.join(dhcp_netaddr.split('.')[0:-1]) }}.{{ dhcp_start_ip }}" dhcp_pool_end: "{{ '.'.join(dhcp_netaddr.split('.')[0:-1]) }}.{{ dhcp_end_ip }}" when: - - include_dhcp_server | bool == true + - include_dhcp_server | bool - itf_netaddr2 | ipaddr('network') != dhcp_netaddr | ipaddr('network') - name: "Deploy dnsmasq configuration file" template: src=dnsmasq.conf.j2 dest=/etc/dnsmasq.conf - when: include_dhcp_server | bool == true + when: include_dhcp_server | bool # NOTE(Shrews) When testing, we want to use our custom dnsmasq.conf file, # not the one supplied by libvirt. - name: "Look for libvirt dnsmasq config" stat: path=/etc/dnsmasq.d/libvirt-bin register: test_libvirt_dnsmasq - when: include_dhcp_server | bool == true + when: include_dhcp_server | bool - name: "Disable libvirt dnsmasq config" command: mv /etc/dnsmasq.d/libvirt-bin /etc/dnsmasq.d/libvirt-bin~ - when: > - include_dhcp_server | bool == true and - test_libvirt_dnsmasq.stat.exists | bool == true and - testing | bool == true + when: + - include_dhcp_server | bool + - test_libvirt_dnsmasq.stat.exists + - testing | bool - name: "Deploy nginx configuration file for serving HTTP requests" template: src=nginx.conf.j2 dest=/etc/nginx/nginx.conf - name: "Download Ironic Python Agent kernel & image" include: download_ipa_image.yml - when: create_ipa_image | bool == false and download_ipa | bool == true + when: + - not create_ipa_image | bool + - download_ipa | bool - name: "Download cirros to use for deployment if requested" get_url: url: "{{ cirros_deploy_image_upstream_url }}" @@ -343,7 +346,7 @@ owner: ironic group: ironic mode: 0644 - when: use_cirros | bool == true + when: use_cirros | bool - name: "Create a checksum file for cirros" shell: md5sum {{ deploy_image_filename }} > {{ deploy_image_filename }}.CHECKSUMS args: diff --git a/playbooks/roles/bifrost-ironic-install/tasks/create_tftpboot.yml b/playbooks/roles/bifrost-ironic-install/tasks/create_tftpboot.yml index e395c8dba..0914db2e7 100644 --- a/playbooks/roles/bifrost-ironic-install/tasks/create_tftpboot.yml +++ b/playbooks/roles/bifrost-ironic-install/tasks/create_tftpboot.yml @@ -42,7 +42,7 @@ - name: "Download ipxe files if asked" include: get_ipxe.yml - when: download_ipxe | bool == true + when: download_ipxe | bool - name: "Copy iPXE image into place" copy: @@ -88,7 +88,7 @@ at the {{ ipxe_dir }} location. Please place this file or consider re-running with download_ipxe set to a value of true. when: - - test_ipxe_efi_binary_path.stat.exists | bool == false + - not test_ipxe_efi_binary_path.stat.exists - name: "Copy iPXE EFI image into {{ http_boot_folder }}/" copy: @@ -108,7 +108,7 @@ mode: 0644 remote_src: true - when: enable_uefi_ipxe | bool == true + when: enable_uefi_ipxe | bool # Similar logic to below can be utilized to retrieve files - name: "Determine if folder exists, else create and populate folder." @@ -117,7 +117,7 @@ - name: "Create master_images folder" file: name="{{ ironic_tftp_master_path }}" state=directory owner=ironic group=ironic - when: test_master_images.stat.exists == false + when: not test_master_images.stat.exists # TODO(TheJulia): The pxelinux folder is statically coded in ironic. # For now, we need to use it, but we can patch that. @@ -128,4 +128,4 @@ owner: ironic group: ironic mode: 0644 - when: enable_inspector | bool == true + when: enable_inspector | bool diff --git a/playbooks/roles/bifrost-ironic-install/tasks/download_ipa_image.yml b/playbooks/roles/bifrost-ironic-install/tasks/download_ipa_image.yml index bdf115afb..7ffa70e1e 100644 --- a/playbooks/roles/bifrost-ironic-install/tasks/download_ipa_image.yml +++ b/playbooks/roles/bifrost-ironic-install/tasks/download_ipa_image.yml @@ -77,7 +77,7 @@ delay: 10 when: - update_ipa | bool or - test_ipa_kernel_present.stat.exists == false + not test_ipa_kernel_present.stat.exists - name: "Test if IPA image is present" stat: path={{ ipa_ramdisk }} @@ -141,4 +141,4 @@ delay: 10 when: - update_ipa | bool or - test_ipa_image_present.stat.exists == false + not test_ipa_image_present.stat.exists diff --git a/playbooks/roles/bifrost-ironic-install/tasks/get_ipxe.yml b/playbooks/roles/bifrost-ironic-install/tasks/get_ipxe.yml index fd0a027eb..b4c34b002 100644 --- a/playbooks/roles/bifrost-ironic-install/tasks/get_ipxe.yml +++ b/playbooks/roles/bifrost-ironic-install/tasks/get_ipxe.yml @@ -51,4 +51,4 @@ delay: 10 loop: - "{{ ipxe_efi_binary }}" - when: enable_uefi_ipxe | bool == true + when: enable_uefi_ipxe | bool diff --git a/playbooks/roles/bifrost-ironic-install/tasks/inspector_bootstrap.yml b/playbooks/roles/bifrost-ironic-install/tasks/inspector_bootstrap.yml index b7fb4b8cc..509504818 100644 --- a/playbooks/roles/bifrost-ironic-install/tasks/inspector_bootstrap.yml +++ b/playbooks/roles/bifrost-ironic-install/tasks/inspector_bootstrap.yml @@ -94,7 +94,7 @@ - name: "Populate keystone for ironic-inspector " include: keystone_setup_inspector.yml - when: enable_keystone is defined and enable_keystone | bool == true + when: enable_keystone | bool - name: "Inspector - Place Configuration" template: diff --git a/playbooks/roles/bifrost-ironic-install/tasks/install.yml b/playbooks/roles/bifrost-ironic-install/tasks/install.yml index c508efde2..8069dfc2c 100644 --- a/playbooks/roles/bifrost-ironic-install/tasks/install.yml +++ b/playbooks/roles/bifrost-ironic-install/tasks/install.yml @@ -44,7 +44,7 @@ package: ironic-python-agent-builder sourcedir: "{{ ipa_builder_git_folder }}" source_install: true - when: install_dib | bool == true + when: install_dib | bool # NOTE(mgoddard): IPA-builder has a dependency on diskimage-builder. Install # DIB last to ensure it is installed from source rather than PyPI. @@ -55,7 +55,7 @@ package: diskimage-builder sourcedir: "{{ dib_git_folder }}" source_install: true - when: install_dib | bool == true + when: install_dib | bool - name: "sushy - Install" include_role: @@ -106,11 +106,11 @@ - name: "Install ironic-inspector to permit use of inspection interface" include_tasks: inspector_install.yml - when: enable_inspector | bool == true + when: enable_inspector | bool - name: "Install ironic-staging-drivers" include_tasks: staging_install.yml - when: staging_drivers_include | bool == true + when: staging_drivers_include | bool - name: "Install openstacksdk" include_role: diff --git a/playbooks/roles/bifrost-ironic-install/tasks/main.yml b/playbooks/roles/bifrost-ironic-install/tasks/main.yml index fcb33cb45..f3a3dcdc7 100644 --- a/playbooks/roles/bifrost-ironic-install/tasks/main.yml +++ b/playbooks/roles/bifrost-ironic-install/tasks/main.yml @@ -58,19 +58,19 @@ - name: "Install Ironic deps" include: install.yml - when: skip_package_install | bool != True + when: not skip_package_install | bool - name: "Bootstrap Ironic" include: bootstrap.yml - when: skip_bootstrap | bool != True + when: not skip_bootstrap | bool - name: "Start Ironic services" include: start.yml - when: skip_start | bool != True + when: not skip_start | bool - name: "Perform online data migrations" include: migrations.yml - when: skip_migrations | bool != True + when: not skip_migrations | bool - name: "Validate deployment" include: validate.yml diff --git a/playbooks/roles/bifrost-ironic-install/tasks/set_ssh_private_key.yml b/playbooks/roles/bifrost-ironic-install/tasks/set_ssh_private_key.yml index 989c88695..9258d9932 100644 --- a/playbooks/roles/bifrost-ironic-install/tasks/set_ssh_private_key.yml +++ b/playbooks/roles/bifrost-ironic-install/tasks/set_ssh_private_key.yml @@ -8,7 +8,7 @@ - name: "Defined ssh_private_key_path - Error if ssh_private_key_path is not valid" fail: msg: "ssh_private_key_path is not valid." - when: test_ssh_private_key_path.stat.exists == false + when: not test_ssh_private_key_path.stat.exists delegate_to: localhost - name: "Defined ssh_private_key_path - Read SSH private key in" diff --git a/playbooks/roles/bifrost-ironic-install/tasks/start.yml b/playbooks/roles/bifrost-ironic-install/tasks/start.yml index f00a6d72d..71ac36548 100644 --- a/playbooks/roles/bifrost-ironic-install/tasks/start.yml +++ b/playbooks/roles/bifrost-ironic-install/tasks/start.yml @@ -33,7 +33,7 @@ - name: "start ironic-inspector" include: inspector_start.yml - when: enable_inspector | bool == true + when: enable_inspector | bool - name: "Start ironic-conductor" service: name=ironic-conductor state=started enabled=yes @@ -62,7 +62,7 @@ service: name={{ item }} state=restarted enabled=yes loop: - dnsmasq - when: include_dhcp_server | bool == true + when: include_dhcp_server | bool - name: "Send services a reload signal" service: name={{ item }} state=reloaded @@ -72,4 +72,4 @@ - name: "Send services a force-reload signal" service: name=dnsmasq state=restarted - when: include_dhcp_server | bool == true + when: include_dhcp_server | bool diff --git a/playbooks/roles/bifrost-keystone-install/tasks/bootstrap.yml b/playbooks/roles/bifrost-keystone-install/tasks/bootstrap.yml index 7c59935e8..4ff41a53e 100644 --- a/playbooks/roles/bifrost-keystone-install/tasks/bootstrap.yml +++ b/playbooks/roles/bifrost-keystone-install/tasks/bootstrap.yml @@ -140,10 +140,10 @@ --bootstrap-internal-url="{{ keystone.bootstrap.internal_url | default(keystone_private_url) | default(keystone_api_url) }}" --bootstrap-region-id="{{ keystone.bootstrap.region_name }}" environment: "{{ bifrost_venv_env }}" - when: > - test_created_keystone_db.changed | bool == true and - keystone.bootstrap.enabled | bool == true and - keystone.database.host == 'localhost' + when: + - test_created_keystone_db.changed + - keystone.bootstrap.enabled | bool + - keystone.database.host == 'localhost' - name: "Reserve keystone admin port" sysctl: diff --git a/playbooks/roles/bifrost-keystone-install/tasks/main.yml b/playbooks/roles/bifrost-keystone-install/tasks/main.yml index b747715db..c23a45e75 100644 --- a/playbooks/roles/bifrost-keystone-install/tasks/main.yml +++ b/playbooks/roles/bifrost-keystone-install/tasks/main.yml @@ -35,15 +35,21 @@ - name: "Install Keystone" include: install.yml - when: enable_keystone is defined and enable_keystone |bool == True and skip_package_install | bool != True + when: + - enable_keystone | bool + - not skip_package_install | bool - name: "Bootstrap Keystone" include: bootstrap.yml - when: enable_keystone is defined and enable_keystone |bool == True and skip_bootstrap | bool != True + when: + - enable_keystone | bool + - not skip_bootstrap | bool - name: "Start Keystone services" include: start.yml - when: enable_keystone is defined and enable_keystone |bool == True and skip_start | bool != True + when: + - enable_keystone | bool + - not skip_start | bool - name: "Change the bootstrap password from the static value on upgrade" os_user: diff --git a/playbooks/roles/bifrost-pip-install/tasks/main.yml b/playbooks/roles/bifrost-pip-install/tasks/main.yml index 348dd9182..b29132a51 100644 --- a/playbooks/roles/bifrost-pip-install/tasks/main.yml +++ b/playbooks/roles/bifrost-pip-install/tasks/main.yml @@ -30,7 +30,7 @@ - upper_constraints_file | length > 0 # NOTE(dtantsur): constraining does not work correctly correctly with # source installation if the package itself is in constraints. - - source_install | bool == false + - not source_install | bool - name: "Install {{ package }} package from pip using virtualenv" pip: diff --git a/playbooks/roles/bifrost-prep-for-install/tasks/main.yml b/playbooks/roles/bifrost-prep-for-install/tasks/main.yml index e1c5b4976..a1630ebec 100644 --- a/playbooks/roles/bifrost-prep-for-install/tasks/main.yml +++ b/playbooks/roles/bifrost-prep-for-install/tasks/main.yml @@ -30,9 +30,13 @@ update: "{{ update_repos | bool }}" clone: yes loop: "{{ bifrost_install_sources }}" - when: copy_from_local_path | bool == false and item.source_install | default(true) | bool + when: + - not copy_from_local_path | bool + - item.source_install | default(true) | bool - name: "Copy from local path" command: cp -a {{ item.git_url }} {{ item.git_folder }} creates={{ item.git_folder }} loop: "{{ bifrost_install_sources }}" - when: copy_from_local_path | bool == true and item.source_install | default(true) | bool + when: + - copy_from_local_path | bool + - item.source_install | default(true) | bool diff --git a/playbooks/roles/bifrost-prepare-for-test-dynamic/tasks/main.yml b/playbooks/roles/bifrost-prepare-for-test-dynamic/tasks/main.yml index a3b810a8b..82a4342b0 100644 --- a/playbooks/roles/bifrost-prepare-for-test-dynamic/tasks/main.yml +++ b/playbooks/roles/bifrost-prepare-for-test-dynamic/tasks/main.yml @@ -36,19 +36,21 @@ when: ipv4_address is defined - name: "Pause before asking for keyscan, to avoid races" pause: minutes=3 - when: multinode_testing | bool == true + when: multinode_testing | bool - name: > Re-check SSH connectivity prior to proceeding with multi-node testing wait_for: state: started port: 22 host: "{{ ipv4_address }}" - when: ipv4_address is defined and multinode_testing | bool == true + when: + - ipv4_address is defined + - multinode_testing | bool - name: > Additional SSH startup pause when performing multi-node testing pause: seconds: "{{ node_ssh_pause }}" - when: multinode_testing | bool == true + when: multinode_testing | bool - name: "Add testvm hosts from SSH known_hosts file." shell: ssh-keyscan "{{ ipv4_address }}" >> "{{ ansible_env.HOME }}/.ssh/known_hosts" when: ipv4_address is defined diff --git a/playbooks/roles/ironic-inspect-node/tasks/main.yml b/playbooks/roles/ironic-inspect-node/tasks/main.yml index 0bce756f5..1d4bc4f5f 100644 --- a/playbooks/roles/ironic-inspect-node/tasks/main.yml +++ b/playbooks/roles/ironic-inspect-node/tasks/main.yml @@ -26,7 +26,7 @@ owner: root group: root mode: 0644 - when: inventory_dhcp | bool == true + when: inventory_dhcp | bool become: yes - name: "Setup DNS address for nodes." template: @@ -35,14 +35,14 @@ owner: root group: root mode: 0644 - when: inventory_dns | bool == true + when: inventory_dns | bool become: yes - name: "Sending dnsmasq HUP" # Note(TheJulia): We need to actually to send a hup signal directly as # Ansible's reloaded state does not pass through to the init script. command: killall -HUP dnsmasq become: yes - when: (inventory_dhcp | bool == true) or (inventory_dns | bool == true) + when: inventory_dhcp | bool or inventory_dns | bool - name: "Execute node introspection" openstack.cloud.baremetal_inspect: diff --git a/playbooks/test-bifrost.yaml b/playbooks/test-bifrost.yaml index 6526a2a3e..c8bb2d358 100644 --- a/playbooks/test-bifrost.yaml +++ b/playbooks/test-bifrost.yaml @@ -178,8 +178,8 @@ become: yes gather_facts: yes vars: - inventory_dhcp: "{{ inventory_dhcp | bool == true }}" - inventory_dhcp_static_ip: "{{ inventory_dhcp_static_ip | bool == true }}" + inventory_dhcp: "{{ inventory_dhcp | bool }}" + inventory_dhcp_static_ip: "{{ inventory_dhcp_static_ip | bool }}" roles: - { role: bifrost-test-dhcp, when: inventory_dhcp | bool } environment: