2025-07-10 21:24:28 -06:00

41 lines
1013 B
YAML
Executable File

---
- name: Install plugins-core to manage DNF repos
ansible.builtin.dnf:
name:
- dnf-plugins-core
state: present
# - name: Install plugins-core to manage DNF repos
# ansible.builtin.command: dnf -y install dnf-plugins-core
- name: Add Docker repo
ansible.builtin.command: dnf config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
register: docker_repo
- name: Verify Docker repo added
ansible.builtin.debug:
var: docker_repo.stdout
- name: Install Docker Engine
ansible.builtin.dnf:
name:
- docker-ce
- docker-ce-cli
- containerd.io
- docker-buildx-plugin
- docker-compose-plugin
state: present
- name: Enable and start Docker Engine
ansible.builtin.systemd_service:
name: docker
state: started
enabled: true
- name: Verify with Hello World
ansible.builtin.command: docker run hello-world
register: docker_hello
- name: Test
ansible.builtin.debug:
var: docker_hello.stdout_lines