Use ansible_facts[] instead of fact variables

See https://github.com/ansible/ansible/issues/73654

Change-Id: I9aaeee50a4d07159a7a8a886c27eceee04c162b9
This commit is contained in:
Jonathan Rosser 2021-02-25 18:41:28 +00:00
parent 4e123a134d
commit 0495f54875
10 changed files with 25 additions and 25 deletions

View File

@ -28,7 +28,7 @@ debug: False
# for the service setup. The host must already have
# clouds.yaml properly configured.
neutron_service_setup_host: "{{ openstack_service_setup_host | default('localhost') }}"
neutron_service_setup_host_python_interpreter: "{{ openstack_service_setup_host_python_interpreter | default((neutron_service_setup_host == 'localhost') | ternary(ansible_playbook_python, ansible_python['executable'])) }}"
neutron_service_setup_host_python_interpreter: "{{ openstack_service_setup_host_python_interpreter | default((neutron_service_setup_host == 'localhost') | ternary(ansible_playbook_python, ansible_facts['python']['executable'])) }}"
###
### Packages Options
@ -96,7 +96,7 @@ neutron_fatal_deprecations: False
## Cap the maximun number of threads / workers when a user value is unspecified.
neutron_api_threads_max: 16
neutron_api_threads: "{{ [[ansible_processor_vcpus|default(2) // 2, 1] | max, neutron_api_threads_max] | min }}"
neutron_api_threads: "{{ [[ansible_facts['processor_vcpus']|default(2) // 2, 1] | max, neutron_api_threads_max] | min }}"
neutron_agent_down_time: 120
neutron_agent_polling_interval: 5
@ -209,7 +209,7 @@ neutron_quota_firewall_rule: 100
###
neutron_db_setup_host: "{{ openstack_db_setup_host | default('localhost') }}"
neutron_db_setup_python_interpreter: "{{ openstack_db_setup_python_interpreter | default((neutron_db_setup_host == 'localhost') | ternary(ansible_playbook_python, ansible_python['executable'])) }}"
neutron_db_setup_python_interpreter: "{{ openstack_db_setup_python_interpreter | default((neutron_db_setup_host == 'localhost') | ternary(ansible_playbook_python, ansible_facts['python']['executable'])) }}"
neutron_galera_address: "{{ galera_address | default('127.0.0.1') }}"
neutron_galera_user: neutron
neutron_galera_database: neutron
@ -261,7 +261,7 @@ neutron_rpc_thread_pool_size: 64
neutron_rpc_conn_pool_size: 30
neutron_rpc_response_timeout: 60
neutron_rpc_workers_max: 16
neutron_rpc_workers: "{{ [[(ansible_processor_vcpus//ansible_processor_threads_per_core)|default(1), 1] | max * 2, neutron_rpc_workers_max] | min }}"
neutron_rpc_workers: "{{ [[(ansible_facts['processor_vcpus']//ansible_facts['processor_threads_per_core'])|default(1), 1] | max * 2, neutron_rpc_workers_max] | min }}"
###
### Identity (Keystone) integration

View File

@ -43,7 +43,7 @@ Set the following user variables in your
### Use OpenDaylight SDN Controller
neutron_plugin_type: "ml2.opendaylight"
odl_ip: "{{ hostvars[groups['opendaylight'][0]]['ansible_default_ipv4']['address'] }}"
odl_ip: "{{ hostvars[groups['opendaylight'][0]]['ansible_facts']['default_ipv4']['address'] }}"
neutron_opendaylight_conf_ini_overrides:
ml2_odl:
url: "http://{{ odl_ip }}:8180/controller/nb/v2/neutron"

View File

@ -19,11 +19,11 @@
- name: Gather variables for each operating system
include_vars: "{{ item }}"
with_first_found:
- "{{ ansible_distribution | lower }}-{{ ansible_distribution_version | lower }}.yml"
- "{{ ansible_distribution | lower }}-{{ ansible_distribution_major_version | lower }}.yml"
- "{{ ansible_os_family | lower }}-{{ ansible_distribution_major_version | lower }}.yml"
- "{{ ansible_distribution | lower }}.yml"
- "{{ ansible_os_family | lower }}.yml"
- "{{ ansible_facts['distribution'] | lower }}-{{ ansible_facts['distribution_version'] | lower }}.yml"
- "{{ ansible_facts['distribution'] | lower }}-{{ ansible_facts['distribution_major_version'] | lower }}.yml"
- "{{ ansible_facts['os_family'] | lower }}-{{ ansible_facts['distribution_major_version'] | lower }}.yml"
- "{{ ansible_facts['distribution'] | lower }}.yml"
- "{{ ansible_facts['os_family'] | lower }}.yml"
tags:
- always

View File

@ -29,8 +29,8 @@
package:
name: "{{ neutron_package_list }}"
state: "{{ neutron_package_state }}"
update_cache: "{{ (ansible_pkg_mgr == 'apt') | ternary('yes', omit) }}"
cache_valid_time: "{{ (ansible_pkg_mgr == 'apt') | ternary(cache_timeout, omit) }}"
update_cache: "{{ (ansible_facts['pkg_mgr'] == 'apt') | ternary('yes', omit) }}"
cache_valid_time: "{{ (ansible_facts['pkg_mgr'] == 'apt') | ternary(cache_timeout, omit) }}"
register: install_packages
until: install_packages is success
retries: 5
@ -130,5 +130,5 @@
- import_tasks: neutron_apparmor.yml
when:
- ansible_pkg_mgr == 'apt'
- ansible_facts['pkg_mgr'] == 'apt'
- inventory_hostname in neutron_apparmor_hosts

View File

@ -93,7 +93,7 @@
group: "{{ neutron_system_group_name }}"
mode: "0640"
state: link
when: neutron_install_method == 'distro' and ansible_os_family == 'RedHat'
when: neutron_install_method == 'distro' and ansible_facts['os_family'] == 'RedHat'
- name: Create symlink to neutron-keepalived-state-change
file:
@ -204,7 +204,7 @@
state: stopped
enabled: false
when:
- ansible_pkg_mgr == 'apt'
- ansible_hostname in groups['neutron_metadata_agent']
- ansible_facts['pkg_mgr'] == 'apt'
- ansible_facts['hostname'] in groups['neutron_metadata_agent']
- groups['haproxy_all'] is defined
- ansible_hostname not in groups['haproxy_all']
- ansible_facts['hostname'] not in groups['haproxy_all']

View File

@ -102,7 +102,7 @@
retries: 5
delay: 2
when:
- ansible_pkg_mgr == 'dnf'
- ansible_facts['pkg_mgr'] == 'dnf'
- neutron_needs_openvswitch | bool
- name: Create ovs tempfiles directory

View File

@ -18,8 +18,8 @@
package:
name: "{{ neutron_ovn_northd_distro_packages }}"
state: "{{ neutron_package_state }}"
update_cache: "{{ (ansible_pkg_mgr == 'apt') | ternary('yes', omit) }}"
cache_valid_time: "{{ (ansible_pkg_mgr == 'apt') | ternary(cache_timeout, omit) }}"
update_cache: "{{ (ansible_facts['pkg_mgr'] == 'apt') | ternary('yes', omit) }}"
cache_valid_time: "{{ (ansible_facts['pkg_mgr'] == 'apt') | ternary(cache_timeout, omit) }}"
register: install_packages
until: install_packages is success
retries: 5
@ -31,8 +31,8 @@
package:
name: "{{ neutron_ovn_controller_distro_packages }}"
state: "{{ neutron_package_state }}"
update_cache: "{{ (ansible_pkg_mgr == 'apt') | ternary('yes', omit) }}"
cache_valid_time: "{{ (ansible_pkg_mgr == 'apt') | ternary(cache_timeout, omit) }}"
update_cache: "{{ (ansible_facts['pkg_mgr'] == 'apt') | ternary('yes', omit) }}"
cache_valid_time: "{{ (ansible_facts['pkg_mgr'] == 'apt') | ternary(cache_timeout, omit) }}"
register: install_packages
until: install_packages is success
retries: 5

View File

@ -18,7 +18,7 @@
name: ovs-vswitchd
path: /usr/lib/openvswitch-switch-dpdk/ovs-vswitchd-dpdk
when:
- ansible_pkg_mgr in ['apt']
- ansible_facts['pkg_mgr'] in ['apt']
- neutron_services['neutron-openvswitch-agent']['group'] in group_names
- '"nova_compute" in group_names'

View File

@ -15,7 +15,7 @@
# limitations under the License.
- name: Set openvswitch hostname
command: "ovs-vsctl set open_vswitch . external-ids:hostname='{{ ansible_hostname }}'"
command: "ovs-vsctl set open_vswitch . external-ids:hostname='{{ ansible_facts['hostname'] }}'"
when:
- (neutron_services['neutron-ovn-northd']['group'] in group_names) or
(neutron_services['neutron-ovn-controller']['group'] in group_names)

View File

@ -253,7 +253,7 @@ opendaylight_extra_features: |-
{%- endif -%}
{{ features }}
opendaylight_install_method: "{{ (ansible_os_family=='Debian') | ternary('deb_repo', 'rpm_repo') }}"
opendaylight_install_method: "{{ (ansible_facts['os_family']=='Debian') | ternary('deb_repo', 'rpm_repo') }}"
ovs_manager_list: |-
{% set ovs_managers_odls = [] %}