geerlingguy.ansible-role-do.../tasks/setup-Debian.yml
modem7 3f8815e032
Update setup-Debian.yml
fix linting errors
2022-04-16 00:19:49 +01:00

59 lines
2.0 KiB
YAML

---
- name: Ensure old versions of Docker are not installed.
package:
name:
- docker
- docker-engine
- docker.io
- containerd
- runc
state: absent
- name: Ensure dependencies are installed.
apt:
name:
- apt-transport-https
- ca-certificates
state: present
- name: Ensure additional dependencies are installed (on Ubuntu < 20.04 and any other systems).
apt:
name: gnupg2
state: present
when: ansible_distribution != 'Ubuntu' or ansible_distribution_version is version('20.04', '<')
- name: Ensure additional dependencies are installed (on Ubuntu >= 20.04).
apt:
name: gnupg
state: present
when: ansible_distribution == 'Ubuntu' or ansible_distribution_version is version('20.04', '>=')
- name: Ensure curl is present (on older systems without SNI).
package: name=curl state=present
when: add_repository_key is failed
- name: Remove gpg keys if they exist # otherwise GPG won't run if file already exists
file:
path: "{{ item }}"
state: absent
with_items:
- /usr/share/keyrings/docker-archive-keyring.gpg
- /usr/share/keyrings/docker-archive-keyring.gpg_armored
- name: Download Docker gpg key
get_url:
url: https://download.docker.com/linux/ubuntu/gpg
dest: /usr/share/keyrings/docker-archive-keyring.gpg_armored
checksum: sha256:1500c1f56fa9e26b9b8f42452a553675796ade0807cdce11975eb98170b3a570 # curl -sL https://download.docker.com/linux/ubuntu/gpg|sha256sum
- name: De-Armor Docker GPG key
shell: gpg --dearmor < /usr/share/keyrings/docker-archive-keyring.gpg_armored > /usr/share/keyrings/docker-archive-keyring.gpg
args:
creates: /usr/share/keyrings/docker-archive-keyring.gpg
- name: "Add Docker's repository to APT sources list"
apt_repository:
repo: "deb [arch={{ docker_apt_arch }}] signed-by=/usr/share/keyrings/docker-archive-keyring.gpg {{ docker_repo_url }} {{ ansible_distribution_release }} {{ docker_apt_release_channel }}"
state: present
update_cache: true