-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdocker_storage.yaml
62 lines (52 loc) · 1.61 KB
/
docker_storage.yaml
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
---
- hosts: all
vars_prompt:
- name: partition
prompt: "Enter the partition name: (sda, sdb, sdc, sdd)"
private: no
tasks:
- name: verify /dev/docker-vg/docker-pool
stat:
path: /dev/docker-vg/docker-pool
register: docker_vg_status
- name: delete docker-storage-setup file
file:
path: /etc/sysconfig/docker-storage-setup
state: absent
when: docker_vg_status.stat.islink is not defined
- name: create new file docker-storage-setup
file:
path: /etc/sysconfig/docker-storage-setup
state: touch
when: docker_vg_status.stat.islink is not defined
- name: write configuration to /etc/sysconfig/docker-storage-setup file
blockinfile:
path: /etc/sysconfig/docker-storage-setup
block: |
DEVS=/dev/{{ partition }}
VG=docker-vg
WIPE_SIGNATURES=true
when: docker_vg_status.stat.islink is not defined
- name: stop docker service
service:
name: docker
state: stopped
when: docker_vg_status.stat.islink is not defined
- name: delete docker-storage file
file:
path: /etc/sysconfig/docker-storage
state: absent
when: docker_vg_status.stat.islink is not defined
- name: create docker-storage
shell: docker-storage-setup
when: docker_vg_status.stat.islink is not defined
- name: extend LVM
lvol:
vg: docker-vg
lv: docker-pool
size: +100%FREE
- name: start and enable docker service
service:
name: docker
state: started
enabled: yes