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
This commit is contained in:
Raimund Hook 2019-05-02 12:55:33 +01:00
parent fe71a5c059
commit 84ea42bd7c
13 changed files with 117 additions and 118 deletions

View File

@ -36,7 +36,7 @@
command: "vgs {{ cinder_volume_group }}" command: "vgs {{ cinder_volume_group }}"
register: result register: result
changed_when: false changed_when: false
failed_when: result | failed failed_when: result is failed
when: when:
- enable_cinder | bool - enable_cinder | bool
- enable_cinder_backend_lvm | bool - enable_cinder_backend_lvm | bool

View File

@ -160,7 +160,7 @@
changed_when: false changed_when: false
failed_when: >- failed_when: >-
'169.254.' not in kolla_internal_vip_address and '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) kolla_internal_vip_address | ipaddr(ip_addr_output.stdout.split()[3]) is none)
when: when:
- enable_haproxy | bool - enable_haproxy | bool

View File

@ -16,9 +16,9 @@
- kolla_action != "config" - kolla_action != "config"
- inventory_hostname in groups[service.group] - inventory_hostname in groups[service.group]
- service.enabled | bool - service.enabled | bool
- horizon_config_json | changed - horizon_config_json is changed
or horizon_conf | changed or horizon_conf is changed
or horizon_local_settings | changed or horizon_local_settings is changed
or horizon_custom_local_settings | changed or horizon_custom_local_settings is changed
or policy_jsons | changed or policy_jsons is changed
or check_horizon_container | changed or check_horizon_container is changed

View File

@ -47,4 +47,4 @@
local_action: command awk '/^fernet_token_expiry/ { print $2 }' "{{ node_config }}/globals.yml" local_action: command awk '/^fernet_token_expiry/ { print $2 }' "{{ node_config }}/globals.yml"
register: result register: result
changed_when: false 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(".+")

View File

@ -23,7 +23,7 @@
local_action: copy content={{ ansible_hostname }} dest=/tmp/kolla_mariadb_cluster mode=0644 local_action: copy content={{ ansible_hostname }} dest=/tmp/kolla_mariadb_cluster mode=0644
changed_when: False changed_when: False
check_mode: no check_mode: no
when: not mariadb_volume | changed when: mariadb_volume is not changed
- name: Registering host from temp file - name: Registering host from temp file
set_fact: set_fact:

View File

@ -23,14 +23,14 @@
- kolla_action != "config" - kolla_action != "config"
- service.enabled | bool - service.enabled | bool
- service.host_in_groups | bool - service.host_in_groups | bool
- config_json | changed - config_json is changed
or neutron_conf | changed or neutron_conf is changed
or neutron_lbaas_conf | changed or neutron_lbaas_conf is changed
or neutron_vpnaas_conf | changed or neutron_vpnaas_conf is changed
or neutron_ml2_conf | changed or neutron_ml2_conf is changed
or nsx_ini | changed or nsx_ini is changed
or policy_json | changed or policy_json is changed
or neutron_server_container | changed or neutron_server_container is changed
- name: Restart neutron-openvswitch-agent container - name: Restart neutron-openvswitch-agent container
vars: vars:
@ -54,11 +54,11 @@
- kolla_action != "config" - kolla_action != "config"
- service.enabled | bool - service.enabled | bool
- service.host_in_groups | bool - service.host_in_groups | bool
- config_json | changed - config_json is changed
or neutron_conf | changed or neutron_conf is changed
or neutron_ml2_conf | changed or neutron_ml2_conf is changed
or policy_json | changed or policy_json is changed
or neutron_openvswitch_agent_container | changed or neutron_openvswitch_agent_container is changed
- name: Restart neutron-openvswitch-agent-xenapi container - name: Restart neutron-openvswitch-agent-xenapi container
vars: vars:
@ -82,11 +82,11 @@
- kolla_action != "config" - kolla_action != "config"
- service.enabled | bool - service.enabled | bool
- service.host_in_groups | bool - service.host_in_groups | bool
- config_json | changed - config_json is changed
or neutron_conf | changed or neutron_conf is changed
or neutron_ml2_xenapi_conf | changed or neutron_ml2_xenapi_conf is changed
or policy_json | changed or policy_json is changed
or neutron_openvswitch_agent_xenapi_container | changed or neutron_openvswitch_agent_xenapi_container is changed
- name: Restart fake neutron-openvswitch-agent container - name: Restart fake neutron-openvswitch-agent container
vars: vars:
@ -112,10 +112,10 @@
- enable_nova_fake | bool - enable_nova_fake | bool
- neutron_plugin_agent == "openvswitch" - neutron_plugin_agent == "openvswitch"
- inventory_hostname in groups["compute"] - inventory_hostname in groups["compute"]
- fake_config_json | changed - fake_config_json is changed
or fake_neutron_conf | changed or fake_neutron_conf is changed
or fake_neutron_ml2_conf_ini | changed or fake_neutron_ml2_conf_ini is changed
or check_fake_neutron_openvswitch_agent | changed or check_fake_neutron_openvswitch_agent is changed
- name: Restart neutron-linuxbridge-agent container - name: Restart neutron-linuxbridge-agent container
vars: vars:
@ -140,11 +140,11 @@
- kolla_action != "config" - kolla_action != "config"
- service.enabled | bool - service.enabled | bool
- service.host_in_groups | bool - service.host_in_groups | bool
- config_json | changed - config_json is changed
or neutron_conf | changed or neutron_conf is changed
or neutron_ml2_conf | changed or neutron_ml2_conf is changed
or policy_json | changed or policy_json is changed
or neutron_linuxbridge_agent_container | changed or neutron_linuxbridge_agent_container is changed
- name: Restart neutron-dhcp-agent container - name: Restart neutron-dhcp-agent container
vars: vars:
@ -167,12 +167,12 @@
- kolla_action != "config" - kolla_action != "config"
- service.enabled | bool - service.enabled | bool
- service.host_in_groups | bool - service.host_in_groups | bool
- config_json | changed - config_json is changed
or neutron_conf | changed or neutron_conf is changed
or dhcp_agent_ini | changed or dhcp_agent_ini is changed
or dnsmasq_conf | changed or dnsmasq_conf is changed
or policy_json | changed or policy_json is changed
or neutron_dhcp_agent_container | changed or neutron_dhcp_agent_container is changed
- name: Restart neutron-l3-agent container - name: Restart neutron-l3-agent container
vars: vars:
@ -199,14 +199,14 @@
- kolla_action != "config" - kolla_action != "config"
- service.enabled | bool - service.enabled | bool
- service.host_in_groups | bool - service.host_in_groups | bool
- config_json | changed - config_json is changed
or neutron_conf | changed or neutron_conf is changed
or neutron_l3_agent_ini | changed or neutron_l3_agent_ini is changed
or neutron_fwaas_driver_ini | changed or neutron_fwaas_driver_ini is changed
or neutron_vpnaas_conf | changed or neutron_vpnaas_conf is changed
or policy_json | changed or policy_json is changed
or neutron_l3_agent_wrapper | changed or neutron_l3_agent_wrapper is changed
or neutron_l3_agent_container | changed or neutron_l3_agent_container is changed
- name: Restart neutron-lbaas-agent container - name: Restart neutron-lbaas-agent container
vars: vars:
@ -230,12 +230,12 @@
- kolla_action != "config" - kolla_action != "config"
- service.enabled | bool - service.enabled | bool
- service.host_in_groups | bool - service.host_in_groups | bool
- config_json | changed - config_json is changed
or neutron_conf | changed or neutron_conf is changed
or neutron_lbaas_conf | changed or neutron_lbaas_conf is changed
or neutron_lbaas_agent_ini | changed or neutron_lbaas_agent_ini is changed
or policy_json | changed or policy_json is changed
or neutron_lbaas_agent_container | changed or neutron_lbaas_agent_container is changed
- name: Restart neutron-sriov-agent container - name: Restart neutron-sriov-agent container
vars: vars:
@ -258,11 +258,11 @@
- kolla_action != "config" - kolla_action != "config"
- service.enabled | bool - service.enabled | bool
- service.host_in_groups | bool - service.host_in_groups | bool
- config_json | changed - config_json is changed
or neutron_conf | changed or neutron_conf is changed
or neutron_sriov_agent_ini | changed or neutron_sriov_agent_ini is changed
or policy_json | changed or policy_json is changed
or neutron_sriov_agent_container | changed or neutron_sriov_agent_container is changed
- name: Restart neutron-metadata-agent container - name: Restart neutron-metadata-agent container
vars: vars:
@ -285,11 +285,11 @@
- kolla_action != "config" - kolla_action != "config"
- service.enabled | bool - service.enabled | bool
- service.host_in_groups | bool - service.host_in_groups | bool
- config_json | changed - config_json is changed
or neutron_conf | changed or neutron_conf is changed
or neutron_metadata_agent_ini | changed or neutron_metadata_agent_ini is changed
or policy_json | changed or policy_json is changed
or neutron_metadata_agent_container | changed or neutron_metadata_agent_container is changed
- name: Restart neutron-bgp-dragent container - name: Restart neutron-bgp-dragent container
vars: vars:
@ -312,11 +312,11 @@
- kolla_action != "config" - kolla_action != "config"
- service.enabled | bool - service.enabled | bool
- service.host_in_groups | bool - service.host_in_groups | bool
- config_json | changed - config_json is changed
or neutron_conf | changed or neutron_conf is changed
or neutron_bgp_dragent_ini | changed or neutron_bgp_dragent_ini is changed
or policy_json | changed or policy_json is changed
or neutron_bgp_dragent_container | changed or neutron_bgp_dragent_container is changed
- name: Restart neutron-infoblox-ipam-agent container - name: Restart neutron-infoblox-ipam-agent container
vars: vars:
@ -339,10 +339,10 @@
- kolla_action != "config" - kolla_action != "config"
- service.enabled | bool - service.enabled | bool
- service.host_in_groups | bool - service.host_in_groups | bool
- config_json | changed - config_json is changed
or neutron_conf | changed or neutron_conf is changed
or neutron_ml2_conf | changed or neutron_ml2_conf is changed
or neutron_infoblox_ipam_agent_container | changed or neutron_infoblox_ipam_agent_container is changed
- name: Restart neutron-metering-agent container - name: Restart neutron-metering-agent container
vars: vars:
@ -364,10 +364,10 @@
- kolla_action != "config" - kolla_action != "config"
- service.enabled | bool - service.enabled | bool
- service.host_in_groups | bool - service.host_in_groups | bool
- config_json | changed - config_json is changed
or neutron_conf | changed or neutron_conf is changed
or neutron_metering_agent_ini | changed or neutron_metering_agent_ini is changed
or neutron_metering_agent_container | changed or neutron_metering_agent_container is changed
- name: Restart ironic-neutron-agent container - name: Restart ironic-neutron-agent container
vars: vars:
@ -390,7 +390,7 @@
- kolla_action != "config" - kolla_action != "config"
- service.enabled | bool - service.enabled | bool
- service.host_in_groups | bool - service.host_in_groups | bool
- config_json | changed - config_json is changed
or neutron_conf | changed or neutron_conf is changed
or ironic_neutron_agent_ini | changed or ironic_neutron_agent_ini is changed
or ironic_neutron_agent_container | changed or ironic_neutron_agent_container is changed

View File

@ -17,19 +17,19 @@
- kolla_action != "config" - kolla_action != "config"
- service.enabled | bool - service.enabled | bool
- service.host_in_groups | bool - service.host_in_groups | bool
- opendaylight_config_json | changed - opendaylight_config_json is changed
or opendaylight_config_start_odl | changed or opendaylight_config_start_odl is changed
or opendaylight_config_custom_props | changed or opendaylight_config_custom_props is changed
or opendaylight_config_jetty | changed or opendaylight_config_jetty is changed
or opendaylight_config_features | changed or opendaylight_config_features is changed
or opendaylight_config_ovsdb | changed or opendaylight_config_ovsdb is changed
or opendaylight_config_tomcat | changed or opendaylight_config_tomcat is changed
or opendaylight_config_logging | changed or opendaylight_config_logging is changed
or opendaylight_config_netvirt | changed or opendaylight_config_netvirt is changed
or opendaylight_config_netvirt_acl | changed or opendaylight_config_netvirt_acl is changed
or opendaylight_config_env | changed or opendaylight_config_env is changed
or opendaylight_config_akka | changed or opendaylight_config_akka is changed
or opendaylight_config_modules | changed or opendaylight_config_modules is changed
or opendaylight_config_module_shards | changed or opendaylight_config_module_shards is changed
or opendaylight_config_10_rest_connector | changed or opendaylight_config_10_rest_connector is changed
or check_opendaylight_containers | changed or check_opendaylight_containers is changed

View File

@ -17,9 +17,9 @@
- kolla_action != "config" - kolla_action != "config"
- service.enabled | bool - service.enabled | bool
- service.host_in_groups | bool - service.host_in_groups | bool
- config_json | changed - config_json is changed
or openvswitch_db_container | changed or openvswitch_db_container is changed
or openvswitch_start_ovsdb_server | changed or openvswitch_start_ovsdb_server is changed
notify: notify:
- Waiting for openvswitch_db service to be ready - Waiting for openvswitch_db service to be ready
@ -50,6 +50,6 @@
- kolla_action != "config" - kolla_action != "config"
- service.enabled | bool - service.enabled | bool
- service.host_in_groups | bool - service.host_in_groups | bool
- config_json | changed - config_json is changed
or openvswitch_vswitchd_container | changed or openvswitch_vswitchd_container is changed
or openvswitch_start_ovs | changed or openvswitch_start_ovs is changed

View File

@ -17,8 +17,8 @@
- kolla_action != "config" - kolla_action != "config"
- service.enabled | bool - service.enabled | bool
- service.host_in_groups | bool - service.host_in_groups | bool
- config_json | changed - config_json is changed
or ovsdpdk_db_container | changed or ovsdpdk_db_container is changed
notify: notify:
- Waiting the ovs db service to be ready - Waiting the ovs db service to be ready
- Ensuring ovsdpdk bridges are properly setup indexed - Ensuring ovsdpdk bridges are properly setup indexed
@ -72,8 +72,8 @@
- kolla_action != "config" - kolla_action != "config"
- service.enabled | bool - service.enabled | bool
- service.host_in_groups | bool - service.host_in_groups | bool
- config_json | changed - config_json is changed
or ovsdpdk_vswitchd_container | changed or ovsdpdk_vswitchd_container is changed
- name: Ensuring ovsdpdk bridges are properly setup named - name: Ensuring ovsdpdk bridges are properly setup named
vars: vars:

View File

@ -4,10 +4,9 @@
register: result register: result
changed_when: false changed_when: false
when: inventory_hostname in groups['baremetal'] when: inventory_hostname in groups['baremetal']
failed_when: result | failed or failed_when: result is failed or result.stdout is version(docker_py_version_min, '<')
result.stdout | version_compare(docker_py_version_min, '<')
- name: Checking Ansible version - name: Checking Ansible version
local_action: fail msg="Current Ansible version {{ ansible_version.full }} is less than {{ ansible_version_min }}" local_action: fail msg="Current Ansible version {{ ansible_version.full }} is less than {{ ansible_version_min }}"
run_once: true run_once: true
when: ansible_version.full | version_compare(ansible_version_min, '<') when: ansible_version.full is version(ansible_version_min, '<')

View File

@ -4,8 +4,8 @@
register: result register: result
changed_when: false changed_when: false
when: inventory_hostname in groups['baremetal'] when: inventory_hostname in groups['baremetal']
failed_when: result | failed failed_when: result is failed
or result.stdout | regex_replace('.*(\\d+\\.\\d+\\.\\d+).*', '\\1') | version_compare(docker_version_min, '<') 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 # 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 # will pass, but only because nothing in the vault file has the format of a
@ -15,7 +15,7 @@
run_once: True run_once: True
register: result register: result
changed_when: false 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 - name: Check if nscd is running
command: pgrep nscd command: pgrep nscd

View File

@ -15,5 +15,5 @@
shell: "true" shell: "true"
become: yes become: yes
register: result register: result
failed_when: result | failed failed_when: result is failed
changed_when: False changed_when: False

View File

@ -23,4 +23,4 @@
name: "{{ project_name }}_bootstrap" name: "{{ project_name }}_bootstrap"
restart_policy: "never" restart_policy: "never"
volumes: "{{ service.volumes }}" volumes: "{{ service.volumes }}"
when: rabbitmq_volume | changed when: rabbitmq_volume is changed