Use ansible_facts[] instead of fact variables

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

Change-Id: I5a83a7f237e4b7d86e8d7ee08b0e8c6b4f8a44f8
This commit is contained in:
Jonathan Rosser 2021-02-22 16:56:05 +00:00
parent 483b10e5e9
commit e5cc6f8990
4 changed files with 11 additions and 11 deletions

View File

@ -15,7 +15,7 @@
# EPEL repo is required for s3fs package. It won't be added in case s3fs is not required.
systemd_centos_epel_mirror: "{{ centos_epel_mirror | default('http://download.fedoraproject.org/pub/epel') }}"
systemd_centos_epel_key: "{{ centos_epel_key | default('http://download.fedoraproject.org/pub/epel/RPM-GPG-KEY-EPEL-' ~ ansible_distribution_major_version) }}"
systemd_centos_epel_key: "{{ centos_epel_key | default('http://download.fedoraproject.org/pub/epel/RPM-GPG-KEY-EPEL-' ~ ansible_facts['distribution_major_version']) }}"
# Any optioned required to make the mount point work. If no options are
# provided the default will be used. This list is comma separted.

View File

@ -16,12 +16,12 @@
- 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 }}-{{ 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 }}-{{ 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 }}-{{ ansible_facts['distribution_version'].split('.')[0] }}.yml"
- "{{ ansible_facts['os_family'] | lower }}.yml"
tags:
- always

View File

@ -16,7 +16,7 @@
- name: Install EPEL
when:
- "'s3fs' in systemd_mount_types"
- ansible_os_family | lower == 'redhat'
- ansible_facts['os_family'] | lower == 'redhat'
block:
- name: Download EPEL gpg keys
get_url:
@ -35,8 +35,8 @@
- name: Install the EPEL repository
yum_repository:
name: epel-systemd_mounts
baseurl: "{{ systemd_centos_epel_mirror ~ '/' ~ ansible_distribution_major_version ~ (ansible_distribution_major_version is version('8', '>=')) | ternary('/Everything/', '/') ~ ansible_architecture }}"
description: 'Extra Packages for Enterprise Linux {{ ansible_distribution_major_version }} - $basearch'
baseurl: "{{ systemd_centos_epel_mirror ~ '/' ~ ansible_facts['distribution_major_version'] ~ (ansible_facts['distribution_major_version'] is version('8', '>=')) | ternary('/Everything/', '/') ~ ansible_facts['architecture'] }}"
description: "Extra Packages for Enterprise Linux {{ ansible_facts['distribution_major_version'] }} - $basearch"
gpgcheck: yes
enabled: yes
state: present

View File

@ -21,7 +21,7 @@
tasks:
- name: Install NFS packages
package:
name: "{{ nfs_package[ansible_distribution.split()[0] | lower] }}"
name: "{{ nfs_package[ansible_facts['distribution'].split()[0] | lower] }}"
state: present
- name: create the system group for nfs