Using Ansible to install docker-ce on Ubuntu 18.04

Using Ansible to install docker-ce on Ubuntu 18.04

Why

The default stable docker.io package is going to be an older version than what you can get from docker-ce:

apt list docker.io
docker.io/bionic,now 17.12.1-0ubuntu1 amd64 [installed]

Meanwhile, if you configure a repository pointing to Docker’s repo, you can have a much newer version:

apt list docker-ce
docker-ce/bionic,now 18.06.1~ce~3-0~ubuntu amd64 [installed]

Ansible

ansible-playbook -i 'REMOTE_IP_ADDRESS,' ubuntu-ansible-docker-install.yml

References