forked from sandervanvugt/rhce8-book
-
Notifications
You must be signed in to change notification settings - Fork 2
/
dev-storage.yaml
87 lines (84 loc) · 2.08 KB
/
dev-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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
---
- name: Setup storage on different servers
hosts: all
tasks:
- name: Print No Second Disk Message
debug:
msg: "No Second Disk found"
when:
- ansible_facts['devices']['sdb'] is not defined
- name: create LV on > 1G
block:
- name: Create 1500 partition
parted:
device: /dev/sdb
number: 1
part_end: 1.8GiB
state: present
- name: Create Vol Group
lvg:
pvs: /dev/sdb1
vg: vgdata
state: present
- name: Create LV
lvol:
vg: vgdata
lv: lvdata
size: 1.5g
state: present
- name: create File System
filesystem:
dev: /dev/vgdata/lvdata
fstype: xfs
- name: Create Mount Point
file:
path: /share1
state: directory
- name: mount file system
mount:
src: /dev/vgdata/lvdata
path: /share
fstype: xfs
state: mounted
when:
- ansible_facts['devices']['sdb'] is defined
- ansible_facts['devices']['sdb']['size'] > "1000000"
- name: create LV on > 1G
block:
- name: Display message
debug:
msg: Small disk found
- name: Create 800M LV
parted:
device: /dev/sdb
number: 1
part_end: 900MiB
state: present
- name: Create Vol Group
lvg:
pvs: /dev/sdb1
vg: vgdata
state: present
- name: Create LV
lvol:
vg: vgdata
lv: lvdata
size: 800m
state: present
- name: create File System
filesystem:
dev: /dev/vgdata/lvdata
fstype: xfs
- name: Create Mount Point
file:
path: /share1
state: directory
- name: mount file system
mount:
src: /dev/vgdata/lvdata
path: /share
fstype: xfs
state: mounted
when:
- ansible_facts['devices']['sdb'] is defined
- ansible_facts['devices']['sdb']['size'] <= "1000000"