use ansible_facts

This commit is contained in:
ace 2022-01-26 18:16:44 +03:00
parent 5d9617cd0e
commit 4c954323f0
No known key found for this signature in database
GPG Key ID: 2E47CC17BA7F8CF0
3 changed files with 8 additions and 8 deletions

View File

@ -1,2 +1,2 @@
---
docker_version: "20.10.9-3.el{{ansible_distribution_major_version}}"
docker_version: "20.10.9-3.el{{ansible_facts['distribution_major_version']}}"

View File

@ -30,21 +30,21 @@
state: present
enablerepo: extras
when:
- ansible_os_family == 'RedHat'
- ansible_distribution_major_version <= '7'
- ansible_facts['os_family'] == 'RedHat'
- ansible_facts['distribution_major_version'] <= '7'
- name: Add Epel repo
yum:
name: epel-release
state: present
when:
- ansible_os_family == 'RedHat'
- ansible_distribution_major_version == '8'
- ansible_facts['os_family'] == 'RedHat'
- ansible_facts['distribution_major_version'] == '8'
- name: Ensure python3-docker installed
yum:
name: python3-docker
state: present
when:
- ansible_os_family == 'RedHat'
- ansible_distribution_major_version == '8'
- ansible_facts['os_family'] == 'RedHat'
- ansible_facts['distribution_major_version'] == '8'

View File

@ -1,3 +1,3 @@
---
- name: Include docker install
include_tasks: "{{ ansible_os_family }}.yaml"
include_tasks: "{{ ansible_facts['os_family'] }}.yaml"