forked from mstelles/ex294
-
Notifications
You must be signed in to change notification settings - Fork 0
/
logvol.yaml
28 lines (28 loc) · 895 Bytes
/
logvol.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
---
- hosts: all
become: true
gather_facts: true
tasks:
- name: create 800MiB logical volume if volume has more than 800MiB available
lvol:
lv: "lvm"
vg: "vgroup"
size: 800m
state: present
when:
- "'vgroup' in ansible_facts['lvm']['vgs']"
- ansible_facts['lvm']['vgs']['vgroup']['size_g'] > '0.80'
- name: create 500MiB logical volume if volume has less than 800MiB available
lvol:
lv: "lvm"
vg: "vgroup"
size: 500m
state: present
when:
- "'vgroup' in ansible_facts['lvm']['vgs']"
- ansible_facts['lvm']['vgs']['vgroup']['size_g'] < '0.80'
- name: display message for hosts which wont have the vgroup volume group
debug:
msg: "vgroup does not exist on host {{inventory_hostname}}"
when: "'vgroup' not in ansible_facts['lvm']['vgs']"
...