57 lines
1.3 KiB
YAML
57 lines
1.3 KiB
YAML
|
|
- name: Install Docker CE
|
|
hosts: linux
|
|
|
|
tasks:
|
|
- 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:
|
|
name: "{{ packages }}"
|
|
# state: absent
|
|
vars:
|
|
packages:
|
|
- apt-transport-https
|
|
- ca-certificates
|
|
- curl
|
|
- gnupg-agent
|
|
- software-properties-common
|
|
|
|
- name: Install Docker GPG key
|
|
become: true
|
|
become_method: sudo
|
|
apt_key:
|
|
url: "https://download.docker.com/linux/ubuntu/gpg"
|
|
state: present
|
|
id: 9DC858229FC7DD38854AE2D88D81803C0EBFCD88
|
|
|
|
- name: Install Docker Repo
|
|
become: true
|
|
become_method: sudo
|
|
apt_repository:
|
|
repo: "deb [arch=amd64] https://download.docker.com/linux/ubuntu/ {{ ansible_distribution_release }} stable"
|
|
state: present
|
|
|
|
- name: Update Repos
|
|
become: true
|
|
become_method: sudo
|
|
apt:
|
|
update_cache: yes
|
|
|
|
- name: Install Docker
|
|
become: true
|
|
become_method: sudo
|
|
apt:
|
|
name: "{{ packages }}"
|
|
vars:
|
|
packages:
|
|
- docker-ce
|
|
- docker-ce-cli
|
|
- containerd.io
|