From 6df62770964e9f53bdd77c895f05e73a8aeb80ad Mon Sep 17 00:00:00 2001 From: Raimund Hook Date: Fri, 28 Jun 2019 16:34:24 +0100 Subject: [PATCH] Updating Jinja filters to conform to Ansible 2.5+ Since Ansible 2.5, the use of jinja tests as filters has been deprecated. I've run the script provided by the ansible team to 'fix' the jinja filters to conform to the newer syntax. This fixes the deprecation warnings. Change-Id: I775c849c944f82bdfc779c8c530346e7ebedbd2a --- ansible/compute-node-discovery.yml | 2 +- ansible/idrac-bootstrap-one.yml | 2 +- ansible/kolla-host.yml | 2 +- ansible/network.yml | 2 +- ansible/overcloud-bios-raid.yml | 2 +- ansible/overcloud-deprovision.yml | 2 +- ansible/overcloud-hardware-inspect.yml | 4 ++-- ansible/overcloud-provision.yml | 4 ++-- ansible/roles/disable-selinux/tasks/main.yml | 4 ++-- ansible/roles/docker-registry/tasks/destroy.yml | 2 +- ansible/roles/docker/tasks/main.yml | 4 ++-- ansible/roles/inspection-store/tasks/destroy.yml | 2 +- ansible/roles/kolla-ceph/tasks/config.yml | 4 ++-- ansible/roles/opensm/tasks/destroy.yml | 2 +- ansible/roles/veth/tasks/main.yml | 2 +- 15 files changed, 20 insertions(+), 20 deletions(-) diff --git a/ansible/compute-node-discovery.yml b/ansible/compute-node-discovery.yml index 9a84aefcb..ce5de3ea0 100644 --- a/ansible/compute-node-discovery.yml +++ b/ansible/compute-node-discovery.yml @@ -24,7 +24,7 @@ delegate_to: "{{ controller_host }}" register: result failed_when: - - result | failed + - result is failed # Some BMCs complain if the node is already powered off. - "'Command not supported in present state' not in result.stderr" vars: diff --git a/ansible/idrac-bootstrap-one.yml b/ansible/idrac-bootstrap-one.yml index 125983372..31bfb47cc 100644 --- a/ansible/idrac-bootstrap-one.yml +++ b/ansible/idrac-bootstrap-one.yml @@ -67,7 +67,7 @@ delegate_to: "{{ delegate_host }}" register: arp_result failed_when: - - arp_result | failed + - arp_result is 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 diff --git a/ansible/kolla-host.yml b/ansible/kolla-host.yml index 8903fd41f..daea555d7 100644 --- a/ansible/kolla-host.yml +++ b/ansible/kolla-host.yml @@ -17,7 +17,7 @@ - iscsid.service register: result failed_when: - - result|failed + - result is failed # 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' diff --git a/ansible/network.yml b/ansible/network.yml index c92794152..2de5070b3 100644 --- a/ansible/network.yml +++ b/ansible/network.yml @@ -44,7 +44,7 @@ become: True register: nm_result failed_when: - - nm_result | failed + - nm_result is failed # Ugh, Ansible's service module doesn't handle uninstalled services. - "'Could not find the requested service' not in nm_result.msg" diff --git a/ansible/overcloud-bios-raid.yml b/ansible/overcloud-bios-raid.yml index b0535d391..a8b488cdf 100644 --- a/ansible/overcloud-bios-raid.yml +++ b/ansible/overcloud-bios-raid.yml @@ -51,7 +51,7 @@ tasks: - name: Set a fact about whether the configuration changed set_fact: - bios_or_raid_change: "{{ drac_result | changed }}" + bios_or_raid_change: "{{ drac_result is changed }}" - name: Ensure that overcloud BIOS and RAID volumes are configured hosts: overcloud_with_bmcs_of_type_idrac diff --git a/ansible/overcloud-deprovision.yml b/ansible/overcloud-deprovision.yml index 7a7ab360f..f98846223 100644 --- a/ansible/overcloud-deprovision.yml +++ b/ansible/overcloud-deprovision.yml @@ -81,7 +81,7 @@ -m command -a "openstack baremetal node undeploy {% raw %}{{ inventory_hostname }}{% endraw %}"' register: delete_result - until: delete_result | success or 'is locked by host' in delete_result.stdout + until: delete_result is successful or 'is locked by host' in delete_result.stdout retries: "{{ ironic_retries }}" delay: "{{ ironic_retry_interval }}" when: initial_provision_state != 'available' diff --git a/ansible/overcloud-hardware-inspect.yml b/ansible/overcloud-hardware-inspect.yml index 7e49b1b55..869309838 100644 --- a/ansible/overcloud-hardware-inspect.yml +++ b/ansible/overcloud-hardware-inspect.yml @@ -75,7 +75,7 @@ -m command -a "openstack baremetal node manage {% raw %}{{ inventory_hostname }}{% endraw %}"' register: manage_result - until: manage_result | success or 'is locked by host' in manage_result.stdout + until: manage_result is successful or 'is locked by host' in manage_result.stdout retries: "{{ ironic_retries }}" delay: "{{ ironic_retry_interval }}" when: initial_provision_state != 'manageable' @@ -100,7 +100,7 @@ -m command -a "openstack baremetal node inspect {% raw %}{{ inventory_hostname }}{% endraw %}"' register: provide_result - until: provide_result | success or 'is locked by host' in provide_result.stdout + until: provide_result is successful or 'is locked by host' in provide_result.stdout retries: "{{ ironic_retries }}" delay: "{{ ironic_retry_interval }}" delegate_to: "{{ seed_host }}" diff --git a/ansible/overcloud-provision.yml b/ansible/overcloud-provision.yml index fc7a6636d..f149f1caa 100644 --- a/ansible/overcloud-provision.yml +++ b/ansible/overcloud-provision.yml @@ -84,7 +84,7 @@ -m command -a "openstack baremetal node manage {% raw %}{{ inventory_hostname }}{% endraw %}"' register: manage_result - until: manage_result | success or 'is locked by host' in manage_result.stdout + until: manage_result is successful or 'is locked by host' in manage_result.stdout retries: "{{ ironic_retries }}" delay: "{{ ironic_retry_interval }}" when: initial_provision_state == 'enroll' @@ -109,7 +109,7 @@ -m command -a "openstack baremetal node provide {% raw %}{{ inventory_hostname }}{% endraw %}"' register: provide_result - until: provide_result | success or 'is locked by host' in provide_result.stdout + until: provide_result is successful or 'is locked by host' in provide_result.stdout retries: "{{ ironic_retries }}" delay: "{{ ironic_retry_interval }}" when: initial_provision_state in ['enroll', 'manageable'] diff --git a/ansible/roles/disable-selinux/tasks/main.yml b/ansible/roles/disable-selinux/tasks/main.yml index 4cbbd3cfb..0da9f95bb 100644 --- a/ansible/roles/disable-selinux/tasks/main.yml +++ b/ansible/roles/disable-selinux/tasks/main.yml @@ -29,7 +29,7 @@ sudo shutdown -r now "Applying SELinux changes" register: reboot_result failed_when: - - reboot_result | failed + - reboot_result is failed - "'closed by remote host' not in reboot_result.stderr" when: not is_local | bool @@ -51,4 +51,4 @@ when: not is_local | bool when: - disable_selinux_do_reboot | bool - - selinux_result | changed + - selinux_result is changed diff --git a/ansible/roles/docker-registry/tasks/destroy.yml b/ansible/roles/docker-registry/tasks/destroy.yml index 8b1302463..1d3992ab3 100644 --- a/ansible/roles/docker-registry/tasks/destroy.yml +++ b/ansible/roles/docker-registry/tasks/destroy.yml @@ -23,7 +23,7 @@ command: docker volume rm {{ volume }} with_items: "{{ volume_result.results }}" when: - - not item | skipped + - item is not skipped - item.rc == 0 vars: volume: "{{ item.item.1.split(':')[0] }}" diff --git a/ansible/roles/docker/tasks/main.yml b/ansible/roles/docker/tasks/main.yml index b860c741c..2613069c1 100644 --- a/ansible/roles/docker/tasks/main.yml +++ b/ansible/roles/docker/tasks/main.yml @@ -42,14 +42,14 @@ register: cp_sockets run_once: True when: - - group_result|changed + - group_result is changed - name: Drop all persistent SSH connections to activate the new group membership local_action: module: shell ssh -O stop None -o ControlPath={{ item.path }} with_items: "{{ cp_sockets.files }}" run_once: True - when: not cp_sockets|skipped + when: cp_sockets is not skipped - name: Ensure Docker daemon is started service: diff --git a/ansible/roles/inspection-store/tasks/destroy.yml b/ansible/roles/inspection-store/tasks/destroy.yml index 15f37fd4a..8bcd7a5d9 100644 --- a/ansible/roles/inspection-store/tasks/destroy.yml +++ b/ansible/roles/inspection-store/tasks/destroy.yml @@ -23,7 +23,7 @@ command: docker volume rm {{ volume }} with_items: "{{ volume_result.results }}" when: - - not item | skipped + - item is not skipped - item.rc == 0 vars: volume: "{{ item.item.1.split(':')[0] }}" diff --git a/ansible/roles/kolla-ceph/tasks/config.yml b/ansible/roles/kolla-ceph/tasks/config.yml index ee5b29d41..3a518ee58 100644 --- a/ansible/roles/kolla-ceph/tasks/config.yml +++ b/ansible/roles/kolla-ceph/tasks/config.yml @@ -42,7 +42,7 @@ Ensure that each disk in 'ceph_disks' does not have any partitions. with_items: "{{ disk_journal_info.results }}" when: - - not item | skipped + - item is not skipped - item.partitions | length > 0 - not item.partitions.0.name.startswith('KOLLA_CEPH') loop_control: @@ -75,7 +75,7 @@ state: present with_items: "{{ disk_journal_info.results }}" when: - - not item | skipped + - item is not skipped - item.partitions | length == 0 loop_control: label: "{{item.item}}" diff --git a/ansible/roles/opensm/tasks/destroy.yml b/ansible/roles/opensm/tasks/destroy.yml index ac1dd9da1..9302a6186 100644 --- a/ansible/roles/opensm/tasks/destroy.yml +++ b/ansible/roles/opensm/tasks/destroy.yml @@ -23,7 +23,7 @@ command: docker volume rm {{ volume }} with_items: "{{ volume_result.results }}" when: - - not item | skipped + - item is not skipped - item.rc == 0 vars: volume: "{{ item.item.1.split(':')[0] }}" diff --git a/ansible/roles/veth/tasks/main.yml b/ansible/roles/veth/tasks/main.yml index e8a83e551..e8a5972ec 100644 --- a/ansible/roles/veth/tasks/main.yml +++ b/ansible/roles/veth/tasks/main.yml @@ -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 is changed or item[0] is changed or item[1] is changed become: True