blob: 9ac5499c9dfb3f7405e051d4aa2b193067d9ecf3 (
plain)
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
87
88
|
---
- name: "Install docker"
hosts: target
tasks:
- name: "Install kernel extras"
apt:
pkg: "{{ item }}"
state: present
with_items:
- "linux-image-extra-{{ ansible_kernel }}"
- linux-image-extra-virtual
- apt-transport-https
- ca-certificates
- software-properties-common
when: ansible_distribution == "Ubuntu"
- name: "Install docker apt key"
shell: curl -fsSL https://download.docker.com/linux/ubuntu/gpg | apt-key add -
when: ansible_distribution == "Ubuntu"
- name: "Configure docker.list"
copy:
src: "../files/{{ item }}"
dest: "/etc/apt/sources.list.d/{{ item }}"
mode: 0644
owner: root
group: root
with_items:
- docker.list
when: ansible_distribution == "Ubuntu"
- name: "Update apt"
apt:
update_cache: yes
when: ansible_distribution == "Ubuntu"
- name: "Install docker packages"
apt:
pkg: "{{ item }}"
state: present
with_items:
- docker-ce
when: ansible_distribution == "Ubuntu"
- name: "Install required packages"
yum:
name: "{{ item }}"
state: present
with_items:
- yum-utils
- device-mapper-persistent-data
- lvm2
when: ansible_distribution == "RedHat" or ansible_distribution == "CentOS"
- name: "Add docker repository"
shell: yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
when: ansible_distribution == "RedHat" or ansible_distribution == "CentOS"
- name: "Update yum cache"
yum:
update_cache: yes
when: ansible_distribution == "RedHat" or ansible_distribution == "CentOS"
- name: "Install required packages"
yum:
name: "{{ item }}"
state: present
with_items:
- docker-ce
when: ansible_distribution == "RedHat" or ansible_distribution == "CentOS"
- name: "Install docker"
portage:
package: "{{ item }}"
update: yes
changed_use: yes
with_items:
- app-emulation/docker
when: ansible_distribution == "Gentoo"
- name: "Enable docker"
service:
name: "{{ item.name }}"
enabled: yes
state: started
runlevel: "{{ item.runlevel }}"
with_items:
- { name: docker, runlevel: default }
|