forked from jonashackt/molecule-ansible-docker-aws
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.yml
45 lines (40 loc) · 1.3 KB
/
main.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
---
# tasks file for docker
- name: Log on which Linux distro Docker is going to be installed
debug:
msg: "The distro is: {{ ansible_distribution|lower }} and the version name is: {{ ansible_distribution_release|lower }}"
- name: Install packages needed to add Docker repository later (see https://docs.docker.com/engine/install/ubuntu/#install-using-the-repository)
apt:
pkg:
- apt-transport-https
- ca-certificates
- curl
- gnupg-agent
- software-properties-common
state: latest
update_cache: true
- name: Add Docker apt key
apt_key:
url: https://download.docker.com/linux/{{ ansible_distribution|lower }}/gpg
id: 9DC858229FC7DD38854AE2D88D81803C0EBFCD88
state: present
ignore_errors: true
- name: Add Docker apt repo
apt_repository:
repo: "deb [arch=amd64] https://download.docker.com/linux/{{ ansible_distribution|lower }} {{ ansible_lsb.codename }} stable"
state: present
mode: '600'
- name: Install Docker packages as described in https://docs.docker.com/engine/install/ubuntu/#install-docker-engine
apt:
pkg:
- docker-ce
- docker-ce-cli
- containerd.io
state: latest
update_cache: true
- name: add vagrant user to docker group
user:
name: vagrant
groups: docker
append: true
become: true