https://docs.docker.com/install/linux/docker-ce/ubuntu/
- hosts: all
gather_facts: yes
vars:
ansible_python_interpreter: /usr/bin/python3
tasks:
- apt_key:
url: https://download.docker.com/linux/ubuntu/gpg
state: present
- apt_repository:
repo: "deb [arch=amd64] https://download.docker.com/linux/ubuntu {{ ansible_lsb.codename }} stable"
state: present
when: ansible_lsb is defined
- apt:
name:
- docker-ce
- docker-ce-cli
- containerd.io
update_cache: yes
when: ansible_lsb is defined
#cloud-config
apt:
sources:
docker:
source: deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable
keyid: 0EBFCD88
keyserver: https://download.docker.com/linux/ubuntu/gpg
apt_update: true
packages:
- docker-ce
- docker-ce-cli
- containerd.io