docker/tasks/RedHat.yaml
2022-01-26 18:16:44 +03:00

51 lines
1.2 KiB
YAML

---
- name: Add Docker CE Stable repo
yum_repository:
name: "docker-ce-stable"
description: "Docker CE Stable - $basearch"
file: docker-ce
baseurl: "https://download.docker.com/linux/centos/$releasever/$basearch/stable"
enabled: no
gpgcheck: yes
gpgkey: "https://download.docker.com/linux/centos/gpg"
async: yes
- name: Ensure docker version {{ docker_version }} installed
yum:
name: "docker-ce-{{ docker_version }}"
state: present
enablerepo: "docker-ce-stable"
- name: Ensure docker service enabled and started
systemd:
name: docker
enabled: yes
state: started
- name: Ensure python-docker-py installed
yum:
name: python-docker-py
state: present
enablerepo: extras
when:
- ansible_facts['os_family'] == 'RedHat'
- ansible_facts['distribution_major_version'] <= '7'
- name: Add Epel repo
yum:
name: epel-release
state: present
when:
- ansible_facts['os_family'] == 'RedHat'
- ansible_facts['distribution_major_version'] == '8'
- name: Ensure python3-docker installed
yum:
name: python3-docker
state: present
when:
- ansible_facts['os_family'] == 'RedHat'
- ansible_facts['distribution_major_version'] == '8'