Skip to content

Commit 855e21f

Browse files
author
Dmitriy Rabotyagov
committed
Remove usage of fact variables
Instead of using fact variables we're accessing ansible_facts dictionary This is useful for cases when role is used with disabled ANSIBLE_INJECT_FACT_VARS, which improves ansible performance.
1 parent dacff1e commit 855e21f

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

defaults/main.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,4 @@ pacemaker_corosync_use_logfile: false
1212
# Centos EPEL repository options (for haveged)
1313
pacemaker_corosync_haveged_enabled: True
1414
pacemaker_corosync_centos_epel_mirror: "{{ centos_epel_mirror | default('http://download.fedoraproject.org/pub/epel') }}"
15-
pacemaker_corosync_centos_epel_key: "{{ centos_epel_key | default('http://download.fedoraproject.org/pub/epel/RPM-GPG-KEY-EPEL-' ~ ansible_distribution_major_version) }}"
15+
pacemaker_corosync_centos_epel_key: "{{ centos_epel_key | default('http://download.fedoraproject.org/pub/epel/RPM-GPG-KEY-EPEL-' ~ ansible_facts['distribution_major_version']) }}"

tasks/pacemaker.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,16 @@
55
name: dnf-plugins-core
66
state: present
77
when:
8-
- ansible_os_family | lower == 'redhat'
9-
- ansible_distribution_major_version is version('8', '>=')
8+
- ansible_facts['os_family'] | lower == 'redhat'
9+
- ansible_facts['distribution_major_version'] is version('8', '>=')
1010

1111
- name: Enable HighAvailability repository
1212
command: "dnf config-manager --enable {{ _centos_ha_repo_name[ansible_facts['distribution_major_version']] }}"
1313
changed_when: false
1414
args:
1515
warn: false
1616
when:
17-
- ansible_os_family | lower == 'redhat'
17+
- ansible_facts['os_family'] | lower == 'redhat'
1818

1919
- name: Installs corosync
2020
package:
@@ -60,8 +60,8 @@
6060
- name: Install the EPEL repository
6161
yum_repository:
6262
name: epel-haveged
63-
baseurl: "{{ pacemaker_corosync_centos_epel_mirror ~ '/' ~ ansible_distribution_major_version ~ (ansible_distribution_major_version is version('8', '>=')) | ternary('/Everything/', '/') ~ ansible_architecture }}"
64-
description: 'Extra Packages for Enterprise Linux {{ ansible_distribution_major_version }} - $basearch'
63+
baseurl: "{{ pacemaker_corosync_centos_epel_mirror ~ '/' ~ ansible_facts['distribution_major_version'] ~ (ansible_facts['distribution_major_version'] is version('8', '>=')) | ternary('/Everything/', '/') ~ ansible_facts['architecture'] }}"
64+
description: "Extra Packages for Enterprise Linux {{ ansible_facts['distribution_major_version'] }} - $basearch"
6565
gpgcheck: yes
6666
enabled: yes
6767
state: present
@@ -72,7 +72,7 @@
7272
delay: 2
7373
when:
7474
- pacemaker_corosync_haveged_enabled | bool
75-
- ansible_os_family | lower == 'redhat'
75+
- ansible_facts['os_family'] | lower == 'redhat'
7676

7777
- name: Install haveged
7878
package:

0 commit comments

Comments
 (0)