ansible/roles/docker-cluster/tasks/install-docker-ce.yml

50 lines
1.0 KiB
YAML
Raw Normal View History

2020-05-25 22:08:01 +00:00
---
- become: yes
block:
- name: install needed packages
apt:
update_cache: yes
pkg:
- apt-transport-https
- ca-certificates
- curl
- gnupg-agent
- software-properties-common
- name: add docker gpg key
apt_key:
url: https://download.docker.com/linux/ubuntu/gpg
state: present
- name: add docker repo
apt_repository:
2020-05-25 22:41:10 +00:00
repo: deb https://download.docker.com/linux/ubuntu {{ ansible_distribution_release }} stable
2020-05-25 22:08:01 +00:00
state: present
filename: docker
- name: install docker
apt:
update_cache: yes
pkg:
- docker-ce
- docker-ce-cli
- containerd.io
- name: add current user to docker group
user:
name: "{{ansible_user_id}}"
groups: docker
append: yes
2022-04-14 22:44:59 +00:00
- name: start and enable docker
systemd:
name: docker
state: started
enabled: true
- name: add current user to docker group
user:
name: "{{ ansible_user_id }}"
append: yes
groups: docker