Use ansible_facts

ansible_facts should be used instead of the injected vars

Change-Id: I9e6e0a257d8abf844063b257b3d9026ec8c9ce6c
This commit is contained in:
Alex Schultz 2021-02-20 16:22:13 -07:00
parent 063f15ec2a
commit 41c93a403d
4 changed files with 9 additions and 9 deletions

View File

@ -19,7 +19,7 @@
systemd:
daemon_reload: yes
become: true
when: ansible_service_mgr == 'systemd'
when: ansible_facts['service_mgr'] == 'systemd'
- name: Docker | reload docker
service:

View File

@ -8,13 +8,13 @@
set_fact:
registry_pkg_manager: yum
when:
- ansible_os_family == 'RedHat'
- ansible_distribution_major_version|int == 7
- ansible_facts['os_family'] == 'RedHat'
- ansible_facts['distribution_major_version']|int == 7
- name: set package manager to dnf
set_fact:
registry_pkg_manager: dnf
when: (ansible_os_family == 'RedHat' and ansible_distribution_major_version|int > 7) or (ansible_distribution == 'Fedora')
when: (ansible_facts['os_family'] == 'RedHat' and ansible_facts['distribution_major_version']|int > 7) or (ansible_facts['distribution'] == 'Fedora')
- name: can docker be updated

View File

@ -59,7 +59,7 @@
path: /etc/systemd/system/docker.service.d
state: directory
mode: '0755'
when: ansible_service_mgr == 'systemd'
when: ansible_facts['service_mgr'] == 'systemd'
- name: unset mountflags
ini_file:
@ -70,7 +70,7 @@
create: yes
mode: '0644'
register: _cfg_flags
when: ansible_service_mgr == 'systemd'
when: ansible_facts['service_mgr'] == 'systemd'
- name: configure OPTIONS in /etc/sysconfig/docker
lineinfile:
@ -163,7 +163,7 @@
daemon_reload: yes
become: true
when:
- ansible_service_mgr == 'systemd'
- ansible_facts['service_mgr'] == 'systemd'
- _cfg_flags is changed
- name: Reload docker

View File

@ -1,8 +1,8 @@
---
- name: Install and Start Docker
when:
- ansible_distribution == "CentOS"
- ansible_distribution_major_version|int < 8
- ansible_facts['distribution'] == "CentOS"
- ansible_facts['distribution_major_version']|int < 8
become: true
block: