2021-07-13 20:04:25 +00:00
|
|
|
- name: Remove undesired packages
|
2022-04-12 12:13:36 +00:00
|
|
|
ansible.builtin.apt:
|
2021-07-13 20:04:25 +00:00
|
|
|
name:
|
|
|
|
- containerd
|
|
|
|
- docker
|
|
|
|
- docker-engine
|
|
|
|
- docker.io
|
|
|
|
- runc
|
|
|
|
- snapd
|
|
|
|
state: absent
|
|
|
|
autoremove: yes
|
|
|
|
purge: yes
|
|
|
|
|
|
|
|
- name: Install prereqs for custom apt repository over https
|
2022-04-12 12:13:36 +00:00
|
|
|
ansible.builtin.apt:
|
2021-07-13 20:04:25 +00:00
|
|
|
update_cache: yes
|
|
|
|
name:
|
|
|
|
- apt-transport-https
|
|
|
|
- ca-certificates
|
|
|
|
- curl
|
|
|
|
- gnupg-agent
|
|
|
|
- software-properties-common
|
|
|
|
state: present
|
|
|
|
|
|
|
|
- name: Add Docker repo key
|
2022-04-12 12:13:36 +00:00
|
|
|
ansible.builtin.apt_key:
|
2021-07-13 20:04:25 +00:00
|
|
|
url: https://download.docker.com/linux/ubuntu/gpg
|
|
|
|
id: 9DC858229FC7DD38854AE2D88D81803C0EBFCD88
|
|
|
|
state: present
|
|
|
|
|
|
|
|
- name: Determine Ubuntu distribution name
|
2022-04-12 12:13:36 +00:00
|
|
|
ansible.builtin.command: lsb_release -cs
|
2021-07-13 20:04:25 +00:00
|
|
|
register: releasename
|
|
|
|
|
|
|
|
- name: Add Docker apt repository
|
2022-04-12 12:13:36 +00:00
|
|
|
ansible.builtin.apt_repository:
|
2021-07-13 20:04:25 +00:00
|
|
|
repo: deb [arch=amd64] https://download.docker.com/linux/ubuntu {{ releasename.stdout }} stable
|
|
|
|
state: present
|
|
|
|
|
|
|
|
- name: Install Docker engine
|
2022-04-12 12:13:36 +00:00
|
|
|
ansible.builtin.apt:
|
2021-07-13 20:04:25 +00:00
|
|
|
update_cache: yes
|
|
|
|
allow_unauthenticated: yes
|
|
|
|
name:
|
|
|
|
- docker-ce
|
|
|
|
- docker-ce-cli
|
|
|
|
- containerd.io
|
|
|
|
|
2021-07-13 21:17:02 +00:00
|
|
|
- name: Install Python Docker module
|
|
|
|
ansible.builtin.pip:
|
|
|
|
name: docker
|
|
|
|
executable: pip3
|
|
|
|
state: latest
|
|
|
|
|
2021-07-13 20:04:25 +00:00
|
|
|
- name: Install Docker Compose
|
2022-04-12 12:13:36 +00:00
|
|
|
ansible.builtin.get_url:
|
2021-07-13 20:04:25 +00:00
|
|
|
url: https://github.com/docker/compose/releases/download/1.27.4/docker-compose-Linux-x86_64
|
|
|
|
dest: /usr/local/bin/docker-compose
|
|
|
|
mode: '0755'
|
|
|
|
|
|
|
|
- name: Add Docker Compose to path
|
2022-04-12 12:13:36 +00:00
|
|
|
ansible.builtin.command: ln -s /usr/local/bin/docker-compose /usr/bin/docker-compose
|
2021-07-13 20:04:25 +00:00
|
|
|
args:
|
|
|
|
creates: /usr/bin/docker-compose
|