blob: 8da13f770e3a5253528165e8ec495ee3aedadd3c (
plain) (
blame)
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
|
---
- name: install docker daemon config
when: docker_daemon_config is defined
block:
- name: create docker config directory
file:
name: /etc/docker
state: directory
mode: 0700
- name: write docker daemon config
copy:
content: "{{ docker_daemon_config | to_nice_json }}\n"
dest: /etc/docker/daemon.json
notify: restart docker
- name: prepare /var/lib/docker as LVM
when: docker_lvm is defined
block:
- name: create logical volume
lvol:
vg: "{{ docker_lvm.vg }}"
lv: "{{ docker_lvm.lv }}"
size: "{{ docker_lvm.size }}"
- name: create filesystem
filesystem:
fstype: "{{ docker_lvm.fs }}"
dev: "/dev/mapper/{{ docker_lvm.vg | replace('-', '--') }}-{{ docker_lvm.lv | replace('-', '--') }}"
- name: mount filesytem
mount:
src: "/dev/mapper/{{ docker_lvm.vg | replace('-', '--') }}-{{ docker_lvm.lv | replace('-', '--') }}"
path: /var/lib/docker
fstype: "{{ docker_lvm.fs }}"
state: mounted
- name: prepare package provider
when: docker_pkg_provider != 'distro'
include_tasks: "{{ docker_pkg_provider }}.yml"
- name: install docker
apt:
name: "{{ docker_pkg_name }}{% if docker_pkg_version is defined %}={{ docker_pkg_version }}{% endif %}"
state: present
force: yes
- name: disable automatic upgrades for docker package
when: docker_pkg_version is defined
dpkg_selections:
name: "{{ docker_pkg_name }}"
selection: hold
|