summaryrefslogtreecommitdiff
path: root/roles/storage/lvm/base/tasks/main.yml
blob: a564e3c083c9ca36a516ab1e810ce7cbf478e87f (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
---
- name: create lvm volume groups
  loop: "{{ lvm_groups | dict2items }}"
  loop_control:
    label: "{{ item.key }}"
  lvg:
    vg: "{{ item.key }}"
    vg_options: "{{ item.value.options | default(omit) }}"
    pvs: "{{ item.value.pvs }}"
    pesize: "{{ item.value.pesize | default(omit) }}"
    pv_options: "{{ item.value.pv_options | default(omit) }}"
    state: present

- name: install thin-provisioning-tools
  when: (lvm_thinpools | list | length) > 0
  apt:
    name: thin-provisioning-tools
    state: present

- name: create lvm thinpools
  loop: "{{ lvm_thinpools | dict2items }}"
  loop_control:
    label: "{{ item.key }}"
  lvol:
    vg: "{{ item.value.vg }}"
    thinpool: "{{ item.value.lv }}"
    size: "{{ item.value.size }}"

- name: create lvm devices
  loop: "{{ lvm_devices | dict2items }}"
  loop_control:
    label: "{{ item.key }}"
  vars:
    lvm_device: "{{ item.value }}"
  include_role:
    name: storage/lvm/device

- name: create lvm volumes
  loop: "{{ lvm_volumes | dict2items }}"
  loop_control:
    label: "{{ item.key }}"
  vars:
    lvm_volume: "{{ item.value }}"
  include_role:
    name: storage/lvm/volume