Use ansible_facts[] instead of fact variables

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

Change-Id: Id98f052df73587f209b9621da0874ce506899f9b
This commit is contained in:
Jonathan Rosser 2021-02-23 09:09:03 +00:00
parent 2e29dc94f1
commit d78f6d5528
3 changed files with 8 additions and 8 deletions

View File

@ -17,8 +17,8 @@
package:
name: "{{ haproxy_distro_packages }}"
state: "{{ haproxy_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
@ -59,4 +59,4 @@
when: haproxy_hatop_install | bool
- include_tasks: haproxy_apparmor.yml
when: ansible_pkg_mgr == 'zypper'
when: ansible_facts['pkg_mgr'] == 'zypper'

View File

@ -56,4 +56,4 @@
notify:
- Reload haproxy
when:
- ansible_selinux.status == "enabled"
- ansible_facts['selinux'].status == "enabled"

View File

@ -16,10 +16,10 @@
- name: Gather variables for each operating system
include_vars: "{{ item }}"
with_first_found:
- "{{ ansible_distribution | lower }}-{{ ansible_distribution_version | lower }}.yml"
- "{{ ansible_distribution | lower }}.yml"
- "{{ ansible_os_family | lower }}-{{ ansible_distribution_version.split('.')[0] }}.yml"
- "{{ ansible_os_family | lower }}.yml"
- "{{ ansible_facts['distribution'] | lower }}-{{ ansible_facts['distribution_version'] | lower }}.yml"
- "{{ ansible_facts['distribution'] | lower }}.yml"
- "{{ ansible_facts['os_family'] | lower }}-{{ ansible_facts['distribution_version'].split('.')[0] }}.yml"
- "{{ ansible_facts['os_family'] | lower }}.yml"
tags:
- always