Use ansible_facts[] instead of fact variables

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

Change-Id: I40b37608f65ec57b26fb10528da63ad54f9a1496
This commit is contained in:
Jonathan Rosser 2021-03-15 17:58:37 +00:00
parent d843d22e11
commit 1b6f3273fb
5 changed files with 15 additions and 15 deletions

View File

@ -23,7 +23,7 @@ designate_ceilometer_enabled: "{{ (groups['ceilometer_all'] is defined) and (gro
# for the service setup. The host must already have
# clouds.yaml properly configured.
designate_service_setup_host: "{{ openstack_service_setup_host | default('localhost') }}"
designate_service_setup_host_python_interpreter: "{{ openstack_service_setup_host_python_interpreter | default((designate_service_setup_host == 'localhost') | ternary(ansible_playbook_python, ansible_python['executable'])) }}"
designate_service_setup_host_python_interpreter: "{{ openstack_service_setup_host_python_interpreter | default((designate_service_setup_host == 'localhost') | ternary(ansible_playbook_python, ansible_facts['python']['executable'])) }}"
# Set the package install state for distribution packages
# Options are 'present' and 'latest'
@ -61,7 +61,7 @@ designate_system_user_home: "/var/lib/{{ designate_system_user_name }}"
## Database info
designate_db_setup_host: "{{ openstack_db_setup_host | default('localhost') }}"
designate_db_setup_python_interpreter: "{{ openstack_db_setup_python_interpreter | default((designate_db_setup_host == 'localhost') | ternary(ansible_playbook_python, ansible_python['executable'])) }}"
designate_db_setup_python_interpreter: "{{ openstack_db_setup_python_interpreter | default((designate_db_setup_host == 'localhost') | ternary(ansible_playbook_python, ansible_facts['python']['executable'])) }}"
designate_galera_address: "{{ galera_address | default('127.0.0.1') }}"
designate_galera_user: designate
designate_galera_database: designate

View File

@ -39,4 +39,4 @@ galaxy_info:
dependencies:
- role: apt_package_pinning
when:
- ansible_pkg_mgr == 'apt'
- ansible_facts['pkg_mgr'] == 'apt'

View File

@ -29,8 +29,8 @@
package:
name: "{{ designate_package_list }}"
state: "{{ designate_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

@ -26,11 +26,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

@ -18,10 +18,10 @@
remote_user: root
gather_facts: true
vars:
named_config_file: "{{ (ansible_pkg_mgr == 'apt') | ternary('/etc/bind/named.conf.options','/etc/named.conf') }}"
bind_package_name: "{{ (ansible_pkg_mgr == 'apt') | ternary('bind9','bind') }}"
bind_service_name: "{{ (ansible_pkg_mgr == 'apt') | ternary('bind9','named') }}"
bind_service_state: "{{ (ansible_pkg_mgr == 'apt') | ternary('restarted','started') }}"
named_config_file: "{{ (ansible_facts['pkg_mgr'] == 'apt') | ternary('/etc/bind/named.conf.options','/etc/named.conf') }}"
bind_package_name: "{{ (ansible_facts['pkg_mgr'] == 'apt') | ternary('bind9','bind') }}"
bind_service_name: "{{ (ansible_facts['pkg_mgr'] == 'apt') | ternary('bind9','named') }}"
bind_service_state: "{{ (ansible_facts['pkg_mgr'] == 'apt') | ternary('restarted','started') }}"
vars_files:
- common/test-vars.yml
pre_tasks:
@ -43,7 +43,7 @@
owner: 'root'
group: 'named'
when:
- ansible_pkg_mgr == 'dnf'
- ansible_facts['pkg_mgr'] == 'dnf'
- name: Restart bind9
service: