-
Notifications
You must be signed in to change notification settings - Fork 0
/
instdocker-play.yml
87 lines (75 loc) · 2.38 KB
/
instdocker-play.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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
---
- hosts: all
become: true
tasks:
- name: Install packages that allow apt to be used over HTTPS
apt:
name: "{{ packages }}"
state: present
update_cache: yes
vars:
packages:
- apt-transport-https
- ca-certificates
- curl
- gnupg-agent
- software-properties-common
- name: Add an apt signing key for Docker
apt_key:
url: https://download.docker.com/linux/ubuntu/gpg
state: present
- name: Add apt repository for stable version
when: ansible_distribution == 'Ubuntu' and ansible_distribution_release == 'bionic'
apt_repository:
repo: deb [arch=amd64] https://download.docker.com/linux/ubuntu bionic stable
state: present
- name: Add apt repository for stable version
when: ansible_distribution == 'Ubuntu' and ansible_distribution_release == 'focal'
apt_repository:
repo: deb [arch=amd64] https://download.docker.com/linux/ubuntu focal stable
state: present
- name: Install docker and its dependecies for bionic
when: ansible_distribution == 'Ubuntu' and ansible_distribution_release == 'bionic'
apt:
name: "{{ packages }}"
state: present
update_cache: yes
vars:
packages:
- docker-ce=5:18.09.6~3-0~ubuntu-bionic
- docker-ce-cli=5:18.09.6~3-0~ubuntu-bionic
- containerd.io
- name: Install docker and its dependecies for focal
when: ansible_distribution == 'Ubuntu' and ansible_distribution_release == 'focal'
apt:
name: "{{ packages }}"
state: present
update_cache: yes
vars:
packages:
- docker-ce
- docker-ce-cli
- containerd.io
- name: Enable docker service
systemd:
name: docker
enabled: yes
- name: Create Docker service override dir
file:
path: /etc/systemd/system/docker.service.d
state: directory
- name: Download Docker service
copy:
src: override.conf
dest: /etc/systemd/system/docker.service.d/override.conf
- name: Dowload Container DNS
copy:
src: daemon.json
dest: /etc/docker/daemon.json
- name: Reload systemD service
systemd:
daemon_reload: yes
- name: Reload docker service
systemd:
name: docker
state: restarted