-
Notifications
You must be signed in to change notification settings - Fork 98
/
exercise152.yaml
53 lines (52 loc) · 1.08 KB
/
exercise152.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
---
- name: create storage
hosts: ansible2
tasks:
- name: create new partition
parted:
name: files
label: gpt
device: /dev/sdb
number: 1
state: present
part_start: 1MiB
part_end: 2GiB
- name: create another new partition
parted:
name: swap
label: gpt
device: /dev/sdb
number: 2
state: present
part_start: 2GiB
part_end: 4GiB
flags: [ lvm ]
- name: create a volume group
lvg:
vg: vgdata
pesize: "8"
pvs: /dev/sdb2
- name: create a logical volume
lvol:
lv: lvdata
size: 100%FREE
vg: vgdata
- name: create an XFS filesystem
filesystem:
dev: /dev/vgdata/lvdata
fstype: xfs
- name: mount the filesystem
mount:
src: /dev/vgdata/lvdata
fstype: xfs
state: mounted
path: /data
- name: setup swap
block:
- name: make the swap filesystem
filesystem:
fstype: swap
dev: /dev/sdb1
- name: activate swap space
command: swapon /dev/sdb1
when: ansible_swaptotal_mb < 256