blob: 595979c9d6477d16451d5b04ff6d99184302aad5 (
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
|
---
- name: list volume groups
set_fact: available_vg="{{ item.key }}"
with_dict: "{{ ansible_lvm.vgs }}"
when:
- not available_vg is defined
- not item.key in ( docker_exclude_vgs | default([]) )
- (item.value.free_g | int) > (docker_volume_size | default(docker_min_size))
- set_fact: docker_storage_vg="{{ available_vg }}"
when: (not docker_storage_vg is defined) and (available_vg is defined)
- fail: msg="Can't detect Docker VG"
when: not docker_storage_vg is defined
- name: check to see if {{ docker_storage_device }} exists
command: "test -e {{ docker_storage_device }}"
when: docker_storage_device is defined
- set_fact: docker_storage_config="VG={{ docker_storage_vg }} AUTO_EXTEND_POOL=true"
- set_fact: docker_storage_config="{{ docker_storage_config }} DEVS={{ docker_storage_device }}"
when: ( docker_storage_device is defined ) and ( not ansible_lvm.vgs.{{ docker_storage_vg }} is defined )
- name: stop docker
service: name="docker" state="stopped"
- name: delete /var/lib/docker
file: path="/var/lib/docker" state=absent
- name: generate docker-storage-setup config file
copy:
content: "{{ docker_storage_config }}"
dest: /etc/sysconfig/docker-storage-setup
owner: root
group: root
mode: 0664
- name: docker storage setup
command: docker-storage-setup
|