summaryrefslogtreecommitdiff
path: root/roles/storage/lvm/volume/tasks/main.yml
blob: eabf4022ee518bc1dc25ed6d4965a53a9a2a2ee4 (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
---
- name: create logical volume
  lvol:
    vg: "{{ lvm_volume.parent.vg | default(lvm_volume.vg) }}"
    lv: "{{ lvm_volume.lv }}"
    size: "{{ lvm_volume.size }}"
    thinpool: "{{ lvm_volume.parent.lv | default(omit) }}"

- name: create filesystem
  filesystem:
    fstype: "{{ lvm_volume.fs }}"
    dev: "/dev/mapper/{{ lvm_volume.parent.vg | default(lvm_volume.vg) | replace('-', '--') }}-{{ lvm_volume.lv | replace('-', '--') }}"

- name: mount filesytem
  mount:
    src: "/dev/mapper/{{ lvm_volume.parent.vg | default(lvm_volume.vg) | replace('-', '--') }}-{{ lvm_volume.lv | replace('-', '--') }}"
    path: "{{ lvm_volume.dest }}"
    fstype: "{{ lvm_volume.fs }}"
    opts: "{{ lvm_volume.mntopts | default(omit) }}"
    state: mounted

- name: set volume owner/group and mode
  file:
    state: directory
    path: "{{ lvm_volume.dest }}"
    mode: "{{ lvm_volume.mode | default(omit) }}"
    owner: "{{ lvm_volume.owner | default(omit) }}"
    group: "{{ lvm_volume.group | default(omit) }}"

- name: export volume mountpoint
  set_fact:
    storage_volume_mountpoint: "{{ lvm_volume.dest }}"