2019-04-06 11:28:01 -07:00
|
|
|
|
2019-04-06 16:59:58 -07:00
|
|
|
- name: Install Docker CE
|
2019-04-06 11:28:01 -07:00
|
|
|
hosts: linux
|
|
|
|
|
|
|
|
tasks:
|
2019-04-06 12:18:44 -07:00
|
|
|
- name: Check if Docker is installed
|
|
|
|
#failed_when: "'Failed' Docker was already installed."
|
|
|
|
apt:
|
|
|
|
name: docker
|
|
|
|
state: absent
|
|
|
|
|
|
|
|
- name: Install dependancies
|
|
|
|
become: true
|
|
|
|
become_method: sudo
|
|
|
|
apt:
|
2019-04-06 16:59:58 -07:00
|
|
|
name: "{{ packages }}"
|
|
|
|
# state: absent
|
|
|
|
vars:
|
|
|
|
packages:
|
|
|
|
- apt-transport-https
|
|
|
|
- ca-certificates
|
|
|
|
- curl
|
|
|
|
- gnupg-agent
|
|
|
|
- software-properties-common
|
2019-04-06 12:18:44 -07:00
|
|
|
|
|
|
|
- name: Install Docker GPG key
|
|
|
|
become: true
|
|
|
|
become_method: sudo
|
|
|
|
apt_key:
|
2019-04-06 16:59:58 -07:00
|
|
|
url: "https://download.docker.com/linux/ubuntu/gpg"
|
2019-04-06 12:18:44 -07:00
|
|
|
state: present
|
2019-04-06 16:59:58 -07:00
|
|
|
id: 9DC858229FC7DD38854AE2D88D81803C0EBFCD88
|
2019-04-06 12:18:44 -07:00
|
|
|
|
|
|
|
- name: Install Docker Repo
|
|
|
|
become: true
|
|
|
|
become_method: sudo
|
|
|
|
apt_repository:
|
2019-04-18 11:19:08 -07:00
|
|
|
repo: "deb [arch=amd64] https://download.docker.com/linux/ubuntu/ {{ ansible_distribution_release }} stable"
|
2019-04-06 12:18:44 -07:00
|
|
|
state: present
|
|
|
|
|
|
|
|
- name: Update Repos
|
|
|
|
become: true
|
|
|
|
become_method: sudo
|
|
|
|
apt:
|
|
|
|
update_cache: yes
|
|
|
|
|
|
|
|
- name: Install Docker
|
|
|
|
become: true
|
|
|
|
become_method: sudo
|
|
|
|
apt:
|
2019-04-06 16:59:58 -07:00
|
|
|
name: "{{ packages }}"
|
|
|
|
vars:
|
|
|
|
packages:
|
|
|
|
- docker-ce
|
|
|
|
- docker-ce-cli
|
|
|
|
- containerd.io
|