ansible/roles/docker/tasks/main.yaml

47 lines
1.2 KiB
YAML
Raw Normal View History

2024-09-15 14:12:48 +03:00
- name: Check and install prerequisites
ansible.builtin.apt:
name: "{{ item }}"
state: latest
update_cache: yes
install_recommends: no
with_items:
- ca-certificates
- curl
- gnupg
- lsb-release
- name: Add Docker repository
block:
- name: Make APT keyrings dir
ansible.builtin.file:
path: /etc/apt/keyrings
state: directory
owner: root
group: root
mode: 0755
- name: Add Docker APT key
ansible.builtin.get_url:
url: "https://download.docker.com/linux/debian/gpg"
dest: /etc/apt/keyrings/docker.asc
- name: Add Docker APT list
ansible.builtin.apt_repository:
repo: "deb [arch={{ architectures[ansible_architecture] }} signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/debian {{ ansible_distribution_release }} stable"
filename: docker
state: present
- name: Install Docker Engine
ansible.builtin.apt:
name: "{{ item }}"
state: latest
update_cache: yes
install_recommends: no
with_items:
- docker-ce
- docker-ce-cli
- containerd.io
- docker-buildx-plugin
- docker-compose-plugin
notify: Autoremove and autoclean packages