2022-11-30 23:49:07 +01:00
|
|
|
---
|
|
|
|
- name: Uninstall old versions
|
|
|
|
apt:
|
|
|
|
name: "{{ item }}"
|
|
|
|
state: absent
|
|
|
|
purge: true
|
|
|
|
loop:
|
|
|
|
- docker
|
|
|
|
- docker-engine
|
|
|
|
- docker.io
|
|
|
|
- containerd
|
|
|
|
- runc
|
|
|
|
become: true
|
|
|
|
|
|
|
|
- name: Update cache
|
|
|
|
apt:
|
|
|
|
update_cache: true
|
|
|
|
become: true
|
|
|
|
|
|
|
|
- name: Install dependencies for apt to use repositories over HTTPS
|
|
|
|
apt:
|
|
|
|
name: "{{ item }}"
|
|
|
|
state: present
|
|
|
|
loop:
|
|
|
|
- ca-certificates
|
|
|
|
- curl
|
|
|
|
- gnupg
|
|
|
|
- lsb-release
|
|
|
|
become: true
|
|
|
|
|
|
|
|
- name: Create keyrings direcoty
|
|
|
|
ansible.builtin.file:
|
|
|
|
path: /etc/apt/keyrings
|
|
|
|
state: directory
|
|
|
|
mode: '0755'
|
|
|
|
become: true
|
|
|
|
|
|
|
|
- name: Add Docker apt key.
|
|
|
|
ansible.builtin.get_url:
|
|
|
|
url: "{{ docker_apt_gpg_key }}"
|
|
|
|
dest: /etc/apt/trusted.gpg.d/docker.asc
|
2023-05-11 15:09:52 +02:00
|
|
|
mode: '0664'
|
2022-11-30 23:49:07 +01:00
|
|
|
force: true
|
|
|
|
become: true
|
|
|
|
|
|
|
|
- name: Add Docker repository.
|
|
|
|
apt_repository:
|
|
|
|
repo: "{{ docker_apt_repository }}"
|
|
|
|
state: present
|
|
|
|
become: true
|
|
|
|
|
|
|
|
- name: Update cache
|
|
|
|
apt:
|
|
|
|
update_cache: true
|
|
|
|
become: true
|
|
|
|
|
|
|
|
- name: Install Docker Engine, containerd, and Docker Compose.
|
|
|
|
apt:
|
|
|
|
name: "{{ item }}"
|
|
|
|
state: present
|
|
|
|
loop:
|
|
|
|
- docker-ce
|
|
|
|
- docker-ce-cli
|
|
|
|
- docker-compose-plugin
|
|
|
|
- containerd.io
|
|
|
|
become: true
|
|
|
|
|