ops/playbooks/docker/install-docker.yml

56 lines
1.2 KiB
YAML

---
- hosts: all
become: true
tasks:
- name: installa dipendenze
apt:
name: "{{item}}"
state: present
update_cache: yes
loop:
- apt-transport-https
- ca-certificates
- curl
- gnupg-agent
- software-properties-common
- name: aggiungi chiave GPG
apt_key:
url: https://download.docker.com/linux/ubuntu/gpg
state: present
- name: aggiungi repository docker
apt_repository:
repo: deb https://download.docker.com/linux/ubuntu bionic stable
state: present
- name: installa docker
apt:
name: "{{item}}"
state: latest
update_cache: yes
loop:
- docker-ce
- docker-ce-cli
- containerd.io
- name: assicurati che docker sia attivo
service:
name: docker
state: started
enabled: yes
- name: Create "docker" group
group:
name: docker
state: present
- name: Add remote "ubuntu" user to "docker" group
user:
name: ubuntu
groups: docker
append: yes
handlers:
- name: restart docker
service:
name: docker
state: restarted