From 84ea42bd7cf3c9931bab4729d6d7ef13940108ac Mon Sep 17 00:00:00 2001 From: Raimund Hook Date: Thu, 2 May 2019 12:55:33 +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: I844ecb7bec94e561afb09580f58b1bf83a6d00bd Closes-bug: #1827370 --- ansible/roles/cinder/tasks/precheck.yml | 2 +- ansible/roles/haproxy/tasks/precheck.yml | 2 +- ansible/roles/horizon/handlers/main.yml | 12 +- ansible/roles/keystone/tasks/precheck.yml | 2 +- .../roles/mariadb/tasks/lookup_cluster.yml | 2 +- ansible/roles/neutron/handlers/main.yml | 148 +++++++++--------- ansible/roles/opendaylight/handlers/main.yml | 32 ++-- ansible/roles/openvswitch/handlers/main.yml | 12 +- ansible/roles/ovs-dpdk/handlers/main.yml | 8 +- .../roles/prechecks/tasks/package_checks.yml | 5 +- .../roles/prechecks/tasks/service_checks.yml | 6 +- ansible/roles/prechecks/tasks/user_checks.yml | 2 +- ansible/roles/rabbitmq/tasks/bootstrap.yml | 2 +- 13 files changed, 117 insertions(+), 118 deletions(-) diff --git a/ansible/roles/cinder/tasks/precheck.yml b/ansible/roles/cinder/tasks/precheck.yml index 4b3e8edf70..bf5783cdbb 100644 --- a/ansible/roles/cinder/tasks/precheck.yml +++ b/ansible/roles/cinder/tasks/precheck.yml @@ -36,7 +36,7 @@ command: "vgs {{ cinder_volume_group }}" register: result changed_when: false - failed_when: result | failed + failed_when: result is failed when: - enable_cinder | bool - enable_cinder_backend_lvm | bool diff --git a/ansible/roles/haproxy/tasks/precheck.yml b/ansible/roles/haproxy/tasks/precheck.yml index 03c8097a73..41f9c0b063 100644 --- a/ansible/roles/haproxy/tasks/precheck.yml +++ b/ansible/roles/haproxy/tasks/precheck.yml @@ -160,7 +160,7 @@ changed_when: false failed_when: >- '169.254.' not in kolla_internal_vip_address and - (ip_addr_output | failed or + ( ip_addr_output is failed or kolla_internal_vip_address | ipaddr(ip_addr_output.stdout.split()[3]) is none) when: - enable_haproxy | bool diff --git a/ansible/roles/horizon/handlers/main.yml b/ansible/roles/horizon/handlers/main.yml index e18fc04921..bf15bee9f4 100644 --- a/ansible/roles/horizon/handlers/main.yml +++ b/ansible/roles/horizon/handlers/main.yml @@ -16,9 +16,9 @@ - kolla_action != "config" - inventory_hostname in groups[service.group] - service.enabled | bool - - horizon_config_json | changed - or horizon_conf | changed - or horizon_local_settings | changed - or horizon_custom_local_settings | changed - or policy_jsons | changed - or check_horizon_container | changed + - horizon_config_json is changed + or horizon_conf is changed + or horizon_local_settings is changed + or horizon_custom_local_settings is changed + or policy_jsons is changed + or check_horizon_container is changed diff --git a/ansible/roles/keystone/tasks/precheck.yml b/ansible/roles/keystone/tasks/precheck.yml index d0863b940e..e28fa1bc70 100644 --- a/ansible/roles/keystone/tasks/precheck.yml +++ b/ansible/roles/keystone/tasks/precheck.yml @@ -47,4 +47,4 @@ local_action: command awk '/^fernet_token_expiry/ { print $2 }' "{{ node_config }}/globals.yml" register: result changed_when: false - failed_when: result.stdout | regex_replace('(60|120|180|240|300|360|600|720|900|1200|1800|3600|7200|10800|14400|21600|28800|43200|86400|604800)', '') | search(".+") + failed_when: result.stdout | regex_replace('(60|120|180|240|300|360|600|720|900|1200|1800|3600|7200|10800|14400|21600|28800|43200|86400|604800)', '') is search(".+") diff --git a/ansible/roles/mariadb/tasks/lookup_cluster.yml b/ansible/roles/mariadb/tasks/lookup_cluster.yml index eef2a534f6..719af9f681 100644 --- a/ansible/roles/mariadb/tasks/lookup_cluster.yml +++ b/ansible/roles/mariadb/tasks/lookup_cluster.yml @@ -23,7 +23,7 @@ local_action: copy content={{ ansible_hostname }} dest=/tmp/kolla_mariadb_cluster mode=0644 changed_when: False check_mode: no - when: not mariadb_volume | changed + when: mariadb_volume is not changed - name: Registering host from temp file set_fact: diff --git a/ansible/roles/neutron/handlers/main.yml b/ansible/roles/neutron/handlers/main.yml index fb72818839..161ee387cd 100644 --- a/ansible/roles/neutron/handlers/main.yml +++ b/ansible/roles/neutron/handlers/main.yml @@ -23,14 +23,14 @@ - kolla_action != "config" - service.enabled | bool - service.host_in_groups | bool - - config_json | changed - or neutron_conf | changed - or neutron_lbaas_conf | changed - or neutron_vpnaas_conf | changed - or neutron_ml2_conf | changed - or nsx_ini | changed - or policy_json | changed - or neutron_server_container | changed + - config_json is changed + or neutron_conf is changed + or neutron_lbaas_conf is changed + or neutron_vpnaas_conf is changed + or neutron_ml2_conf is changed + or nsx_ini is changed + or policy_json is changed + or neutron_server_container is changed - name: Restart neutron-openvswitch-agent container vars: @@ -54,11 +54,11 @@ - kolla_action != "config" - service.enabled | bool - service.host_in_groups | bool - - config_json | changed - or neutron_conf | changed - or neutron_ml2_conf | changed - or policy_json | changed - or neutron_openvswitch_agent_container | changed + - config_json is changed + or neutron_conf is changed + or neutron_ml2_conf is changed + or policy_json is changed + or neutron_openvswitch_agent_container is changed - name: Restart neutron-openvswitch-agent-xenapi container vars: @@ -82,11 +82,11 @@ - kolla_action != "config" - service.enabled | bool - service.host_in_groups | bool - - config_json | changed - or neutron_conf | changed - or neutron_ml2_xenapi_conf | changed - or policy_json | changed - or neutron_openvswitch_agent_xenapi_container | changed + - config_json is changed + or neutron_conf is changed + or neutron_ml2_xenapi_conf is changed + or policy_json is changed + or neutron_openvswitch_agent_xenapi_container is changed - name: Restart fake neutron-openvswitch-agent container vars: @@ -112,10 +112,10 @@ - enable_nova_fake | bool - neutron_plugin_agent == "openvswitch" - inventory_hostname in groups["compute"] - - fake_config_json | changed - or fake_neutron_conf | changed - or fake_neutron_ml2_conf_ini | changed - or check_fake_neutron_openvswitch_agent | changed + - fake_config_json is changed + or fake_neutron_conf is changed + or fake_neutron_ml2_conf_ini is changed + or check_fake_neutron_openvswitch_agent is changed - name: Restart neutron-linuxbridge-agent container vars: @@ -140,11 +140,11 @@ - kolla_action != "config" - service.enabled | bool - service.host_in_groups | bool - - config_json | changed - or neutron_conf | changed - or neutron_ml2_conf | changed - or policy_json | changed - or neutron_linuxbridge_agent_container | changed + - config_json is changed + or neutron_conf is changed + or neutron_ml2_conf is changed + or policy_json is changed + or neutron_linuxbridge_agent_container is changed - name: Restart neutron-dhcp-agent container vars: @@ -167,12 +167,12 @@ - kolla_action != "config" - service.enabled | bool - service.host_in_groups | bool - - config_json | changed - or neutron_conf | changed - or dhcp_agent_ini | changed - or dnsmasq_conf | changed - or policy_json | changed - or neutron_dhcp_agent_container | changed + - config_json is changed + or neutron_conf is changed + or dhcp_agent_ini is changed + or dnsmasq_conf is changed + or policy_json is changed + or neutron_dhcp_agent_container is changed - name: Restart neutron-l3-agent container vars: @@ -199,14 +199,14 @@ - kolla_action != "config" - service.enabled | bool - service.host_in_groups | bool - - config_json | changed - or neutron_conf | changed - or neutron_l3_agent_ini | changed - or neutron_fwaas_driver_ini | changed - or neutron_vpnaas_conf | changed - or policy_json | changed - or neutron_l3_agent_wrapper | changed - or neutron_l3_agent_container | changed + - config_json is changed + or neutron_conf is changed + or neutron_l3_agent_ini is changed + or neutron_fwaas_driver_ini is changed + or neutron_vpnaas_conf is changed + or policy_json is changed + or neutron_l3_agent_wrapper is changed + or neutron_l3_agent_container is changed - name: Restart neutron-lbaas-agent container vars: @@ -230,12 +230,12 @@ - kolla_action != "config" - service.enabled | bool - service.host_in_groups | bool - - config_json | changed - or neutron_conf | changed - or neutron_lbaas_conf | changed - or neutron_lbaas_agent_ini | changed - or policy_json | changed - or neutron_lbaas_agent_container | changed + - config_json is changed + or neutron_conf is changed + or neutron_lbaas_conf is changed + or neutron_lbaas_agent_ini is changed + or policy_json is changed + or neutron_lbaas_agent_container is changed - name: Restart neutron-sriov-agent container vars: @@ -258,11 +258,11 @@ - kolla_action != "config" - service.enabled | bool - service.host_in_groups | bool - - config_json | changed - or neutron_conf | changed - or neutron_sriov_agent_ini | changed - or policy_json | changed - or neutron_sriov_agent_container | changed + - config_json is changed + or neutron_conf is changed + or neutron_sriov_agent_ini is changed + or policy_json is changed + or neutron_sriov_agent_container is changed - name: Restart neutron-metadata-agent container vars: @@ -285,11 +285,11 @@ - kolla_action != "config" - service.enabled | bool - service.host_in_groups | bool - - config_json | changed - or neutron_conf | changed - or neutron_metadata_agent_ini | changed - or policy_json | changed - or neutron_metadata_agent_container | changed + - config_json is changed + or neutron_conf is changed + or neutron_metadata_agent_ini is changed + or policy_json is changed + or neutron_metadata_agent_container is changed - name: Restart neutron-bgp-dragent container vars: @@ -312,11 +312,11 @@ - kolla_action != "config" - service.enabled | bool - service.host_in_groups | bool - - config_json | changed - or neutron_conf | changed - or neutron_bgp_dragent_ini | changed - or policy_json | changed - or neutron_bgp_dragent_container | changed + - config_json is changed + or neutron_conf is changed + or neutron_bgp_dragent_ini is changed + or policy_json is changed + or neutron_bgp_dragent_container is changed - name: Restart neutron-infoblox-ipam-agent container vars: @@ -339,10 +339,10 @@ - kolla_action != "config" - service.enabled | bool - service.host_in_groups | bool - - config_json | changed - or neutron_conf | changed - or neutron_ml2_conf | changed - or neutron_infoblox_ipam_agent_container | changed + - config_json is changed + or neutron_conf is changed + or neutron_ml2_conf is changed + or neutron_infoblox_ipam_agent_container is changed - name: Restart neutron-metering-agent container vars: @@ -364,10 +364,10 @@ - kolla_action != "config" - service.enabled | bool - service.host_in_groups | bool - - config_json | changed - or neutron_conf | changed - or neutron_metering_agent_ini | changed - or neutron_metering_agent_container | changed + - config_json is changed + or neutron_conf is changed + or neutron_metering_agent_ini is changed + or neutron_metering_agent_container is changed - name: Restart ironic-neutron-agent container vars: @@ -390,7 +390,7 @@ - kolla_action != "config" - service.enabled | bool - service.host_in_groups | bool - - config_json | changed - or neutron_conf | changed - or ironic_neutron_agent_ini | changed - or ironic_neutron_agent_container | changed + - config_json is changed + or neutron_conf is changed + or ironic_neutron_agent_ini is changed + or ironic_neutron_agent_container is changed diff --git a/ansible/roles/opendaylight/handlers/main.yml b/ansible/roles/opendaylight/handlers/main.yml index 6985258e3c..9163d51b63 100644 --- a/ansible/roles/opendaylight/handlers/main.yml +++ b/ansible/roles/opendaylight/handlers/main.yml @@ -17,19 +17,19 @@ - kolla_action != "config" - service.enabled | bool - service.host_in_groups | bool - - opendaylight_config_json | changed - or opendaylight_config_start_odl | changed - or opendaylight_config_custom_props | changed - or opendaylight_config_jetty | changed - or opendaylight_config_features | changed - or opendaylight_config_ovsdb | changed - or opendaylight_config_tomcat | changed - or opendaylight_config_logging | changed - or opendaylight_config_netvirt | changed - or opendaylight_config_netvirt_acl | changed - or opendaylight_config_env | changed - or opendaylight_config_akka | changed - or opendaylight_config_modules | changed - or opendaylight_config_module_shards | changed - or opendaylight_config_10_rest_connector | changed - or check_opendaylight_containers | changed + - opendaylight_config_json is changed + or opendaylight_config_start_odl is changed + or opendaylight_config_custom_props is changed + or opendaylight_config_jetty is changed + or opendaylight_config_features is changed + or opendaylight_config_ovsdb is changed + or opendaylight_config_tomcat is changed + or opendaylight_config_logging is changed + or opendaylight_config_netvirt is changed + or opendaylight_config_netvirt_acl is changed + or opendaylight_config_env is changed + or opendaylight_config_akka is changed + or opendaylight_config_modules is changed + or opendaylight_config_module_shards is changed + or opendaylight_config_10_rest_connector is changed + or check_opendaylight_containers is changed diff --git a/ansible/roles/openvswitch/handlers/main.yml b/ansible/roles/openvswitch/handlers/main.yml index dd26abd3ca..4342d0c142 100644 --- a/ansible/roles/openvswitch/handlers/main.yml +++ b/ansible/roles/openvswitch/handlers/main.yml @@ -17,9 +17,9 @@ - kolla_action != "config" - service.enabled | bool - service.host_in_groups | bool - - config_json | changed - or openvswitch_db_container | changed - or openvswitch_start_ovsdb_server | changed + - config_json is changed + or openvswitch_db_container is changed + or openvswitch_start_ovsdb_server is changed notify: - Waiting for openvswitch_db service to be ready @@ -50,6 +50,6 @@ - kolla_action != "config" - service.enabled | bool - service.host_in_groups | bool - - config_json | changed - or openvswitch_vswitchd_container | changed - or openvswitch_start_ovs | changed + - config_json is changed + or openvswitch_vswitchd_container is changed + or openvswitch_start_ovs is changed diff --git a/ansible/roles/ovs-dpdk/handlers/main.yml b/ansible/roles/ovs-dpdk/handlers/main.yml index 249c8a87b9..d6f0db0653 100644 --- a/ansible/roles/ovs-dpdk/handlers/main.yml +++ b/ansible/roles/ovs-dpdk/handlers/main.yml @@ -17,8 +17,8 @@ - kolla_action != "config" - service.enabled | bool - service.host_in_groups | bool - - config_json | changed - or ovsdpdk_db_container | changed + - config_json is changed + or ovsdpdk_db_container is changed notify: - Waiting the ovs db service to be ready - Ensuring ovsdpdk bridges are properly setup indexed @@ -72,8 +72,8 @@ - kolla_action != "config" - service.enabled | bool - service.host_in_groups | bool - - config_json | changed - or ovsdpdk_vswitchd_container | changed + - config_json is changed + or ovsdpdk_vswitchd_container is changed - name: Ensuring ovsdpdk bridges are properly setup named vars: diff --git a/ansible/roles/prechecks/tasks/package_checks.yml b/ansible/roles/prechecks/tasks/package_checks.yml index 7daa33cea8..210f39dd53 100644 --- a/ansible/roles/prechecks/tasks/package_checks.yml +++ b/ansible/roles/prechecks/tasks/package_checks.yml @@ -4,10 +4,9 @@ register: result changed_when: false when: inventory_hostname in groups['baremetal'] - failed_when: result | failed or - result.stdout | version_compare(docker_py_version_min, '<') + failed_when: result is failed or result.stdout is version(docker_py_version_min, '<') - name: Checking Ansible version local_action: fail msg="Current Ansible version {{ ansible_version.full }} is less than {{ ansible_version_min }}" run_once: true - when: ansible_version.full | version_compare(ansible_version_min, '<') + when: ansible_version.full is version(ansible_version_min, '<') diff --git a/ansible/roles/prechecks/tasks/service_checks.yml b/ansible/roles/prechecks/tasks/service_checks.yml index e671ea4e2c..9ca8e160b7 100644 --- a/ansible/roles/prechecks/tasks/service_checks.yml +++ b/ansible/roles/prechecks/tasks/service_checks.yml @@ -4,8 +4,8 @@ register: result changed_when: false when: inventory_hostname in groups['baremetal'] - failed_when: result | failed - or result.stdout | regex_replace('.*(\\d+\\.\\d+\\.\\d+).*', '\\1') | version_compare(docker_version_min, '<') + failed_when: result is failed + or result.stdout | regex_replace('.*(\\d+\\.\\d+\\.\\d+).*', '\\1') is version(docker_version_min, '<') # NOTE(mgoddard): If passwords.yml is encrypted using ansible-vault, this check # will pass, but only because nothing in the vault file has the format of a @@ -15,7 +15,7 @@ run_once: True register: result changed_when: false - failed_when: result.stdout | regex_replace('(.*ssh_key.*)', '') | search(":") + failed_when: result.stdout | regex_replace('(.*ssh_key.*)', '') is search(":") - name: Check if nscd is running command: pgrep nscd diff --git a/ansible/roles/prechecks/tasks/user_checks.yml b/ansible/roles/prechecks/tasks/user_checks.yml index fa686974b6..8806b2d208 100644 --- a/ansible/roles/prechecks/tasks/user_checks.yml +++ b/ansible/roles/prechecks/tasks/user_checks.yml @@ -15,5 +15,5 @@ shell: "true" become: yes register: result - failed_when: result | failed + failed_when: result is failed changed_when: False diff --git a/ansible/roles/rabbitmq/tasks/bootstrap.yml b/ansible/roles/rabbitmq/tasks/bootstrap.yml index 4a215dabf3..2556d278e4 100644 --- a/ansible/roles/rabbitmq/tasks/bootstrap.yml +++ b/ansible/roles/rabbitmq/tasks/bootstrap.yml @@ -23,4 +23,4 @@ name: "{{ project_name }}_bootstrap" restart_policy: "never" volumes: "{{ service.volumes }}" - when: rabbitmq_volume | changed + when: rabbitmq_volume is changed