docker/tasks/RedHat.yaml
2021-11-16 16:38:38 +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_os_family == 'RedHat'
- ansible_distribution_major_version <= '7'
- name: Add Epel repo
yum:
name: epel-release
state: present
when:
- ansible_os_family == 'RedHat'
- ansible_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'