Files
cicd/playbooks/roles/docker-install/tasks/main.yml
2025-07-20 14:53:12 +03:00

49 lines
1.1 KiB
YAML

---
# tasks file for docker-install
- name: Install dependencies
ansible.builtin.apt:
name:
- apt-transport-https
- ca-certificates
- curl
- gnupg
- lsb-release
state: present
update_cache: yes
- name: Add Docker GPG key if not exists
command: bash -c "curl -fsSL https://download.docker.com/linux/ubuntu/gpg | gpg --dearmor -o /usr/share/keyrings/docker.gpg"
args:
creates: /usr/share/keyrings/docker.gpg
- name: Add Docker repository
apt_repository:
repo: "deb [arch=amd64 signed-by=/usr/share/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu {{ ansible_distribution_release }} stable"
state: present
update_cache: yes
- name: Install Docker packages
ansible.builtin.apt:
name:
- docker-ce
- docker-ce-cli
- containerd.io
state: present
- name: Check docker is active
ansible.builtin.service:
name: docker
state: started
enabled: yes
- name: Ensure group "docker" exists
ansible.builtin.group:
name: docker
state: present
- name: Install docker-compose
ansible.builtin.apt:
name: docker-compose-plugin
state: present