docker/tasks/RedHat.yaml
2023-06-05 13:01:23 +03:00

53 lines
1.4 KiB
YAML

---
- name: Add Docker CE Stable repo
ansible.builtin.yum_repository:
name: "{{ item.name }}"
description: "{{ item.description }}"
file: "{{ item.file }}"
baseurl: "{{ item.baseurl }}"
gpgcheck: "{{ item.gpgcheck | default('no') }}"
enabled: "{{ item.enabled | default('yes') }}"
repo_gpgcheck: "{{ item.repo_gpgcheck | default('no') }}"
gpgkey: "{{ item.gpgkey | default('omit') }}"
async: "{{ item.async | default('yes') }}"
loop: "{{ docker_rpm_repository }}"
when: docker_install_official_repo
- name: Ensure {{ docker_package }} is installed
yum:
name: "{{ docker_package }}"
state: present
enablerepo: "docker-ce-stable"
- name: Ensure docker service enabled and started
systemd:
name: "{{ docker_unit_name }}"
enabled: yes
state: started
masked: no
- 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
dnf:
name: epel-release
state: present
when:
- ansible_facts['os_family'] == 'RedHat'
- ansible_facts['distribution_major_version'] >= '8'
- name: Ensure python3-docker installed
dnf:
name: python3-docker
state: present
when:
- ansible_facts['os_family'] == 'RedHat'
- ansible_facts['distribution_major_version'] >= '8'