ansible/roles/docker/tasks/main.yaml

41 lines
950 B
YAML
Raw Permalink Normal View History

---
- name: Install required system packages
ansible.builtin.apt:
pkg:
- apt-transport-https
- ca-certificates
- gnupg
- curl
state: latest
update_cache: true
- name: Add Docker GPG apt key
ansible.builtin.apt_key:
url: https://download.docker.com/linux/{{ ansible_distribution | lower }}/gpg
state: present
- name: Add Docker repository
ansible.builtin.apt_repository:
repo: deb https://download.docker.com/linux/{{ ansible_distribution | lower }} {{ ansible_distribution_release }} stable
state: present
- name: Install docker packages
ansible.builtin.apt:
pkg:
- docker-ce
- docker-ce-cli
- containerd.io
- docker-compose-plugin
state: latest
update_cache: true
- name: Enable docker service
ansible.builtin.service:
name: docker
enabled: true
- name: Start docker service
ansible.builtin.service:
name: docker
state: started