vps-ansible/roles/docker/tasks/main.yml

57 lines
1.2 KiB
YAML

---
- name: Remove old versions of Docker and conflicting packages
dnf:
name:
- docker
- docker-client
- docker-client-latest
- docker-common
- docker-latest
- docker-latest-logrotate
- docker-logrotate
- docker-engine
- podman
- runc
state: absent
- name: Install DNF plugins
dnf:
name: dnf-plugins-core
state: present
- name: Add Docker repository (RHEL official repo)
command: dnf config-manager --add-repo https://download.docker.com/linux/rhel/docker-ce.repo
args:
creates: /etc/yum.repos.d/docker-ce.repo
- name: Update package cache
command: dnf makecache
- name: Install Docker CE, CLI and other components
dnf:
name:
- docker-ce
- docker-ce-cli
- containerd.io
- docker-buildx-plugin
- docker-compose-plugin
state: present
- name: Enable and start Docker service
systemd:
name: docker
state: started
enabled: yes
- name: Disable iptables
copy:
src: files/daemon.json
dest: /etc/docker/daemon.json
- name: Restart firewalld
command: firewall-cmd --reload
- name: Restart Docker service
systemd:
name: docker
state: restarted