26 lines
797 B
YAML
26 lines
797 B
YAML
---
|
|
|
|
- name: Ensure apt keyrings directory exists
|
|
ansible.builtin.file:
|
|
path: /etc/apt/keyrings
|
|
state: directory
|
|
mode: 0755
|
|
group: root
|
|
owner: root
|
|
|
|
- name: Download the Docker key
|
|
ansible.builtin.shell:
|
|
cmd: "curl -fsSL https://download.docker.com/linux/debian/gpg \
|
|
| sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg"
|
|
creates: /etc/apt/keyrings/docker.gpg
|
|
|
|
- name: Create the repository file
|
|
ansible.builtin.shell:
|
|
cmd: "echo \"deb [arch=$(dpkg --print-architecture) \
|
|
signed-by=/etc/apt/keyrings/docker.gpg] \
|
|
https://download.docker.com/linux/debian \
|
|
$(lsb_release -cs) stable\" \
|
|
| sudo tee /etc/apt/sources.list.d/docker.list \
|
|
> /dev/null"
|
|
creates: /etc/apt/sources.list.d/docker.list
|