56 lines
1.3 KiB
YAML
56 lines
1.3 KiB
YAML
---
|
|
- name: Update apt package index
|
|
apt:
|
|
update_cache: yes
|
|
|
|
- name: Install required system packages
|
|
apt:
|
|
name:
|
|
- ca-certificates
|
|
- curl
|
|
- gnupg
|
|
- gnupg2
|
|
state: present
|
|
|
|
- name: Create /etc/apt/keyrings directory
|
|
file:
|
|
path: /etc/apt/keyrings
|
|
state: directory
|
|
mode: '0755'
|
|
|
|
- name: Download Docker's official GPG key
|
|
get_url:
|
|
url: https://download.docker.com/linux/debian/gpg
|
|
dest: /tmp/docker.gpg
|
|
|
|
- name: Install Docker's official GPG key
|
|
shell: gpg --dearmor -o /etc/apt/keyrings/docker.gpg /tmp/docker.gpg
|
|
|
|
- name: Get the architecture
|
|
command: dpkg --print-architecture
|
|
register: dpkg_architecture
|
|
changed_when: False
|
|
|
|
- name: Set up the stable Docker repository
|
|
copy:
|
|
content: |
|
|
deb [arch={{ dpkg_architecture.stdout }} signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/debian {{ ansible_distribution_release }} stable
|
|
dest: /etc/apt/sources.list.d/docker.list
|
|
owner: root
|
|
group: root
|
|
mode: '0644'
|
|
|
|
- name: Update apt package index
|
|
apt:
|
|
update_cache: yes
|
|
|
|
- name: Install Docker CE and associated components
|
|
apt:
|
|
name:
|
|
- docker-ce
|
|
- docker-ce-cli
|
|
- containerd.io
|
|
- docker-buildx-plugin
|
|
- docker-compose-plugin
|
|
state: present
|