-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path916_exercise.yaml
More file actions
51 lines (47 loc) · 1.23 KB
/
916_exercise.yaml
File metadata and controls
51 lines (47 loc) · 1.23 KB
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
---
- hosts: ansible2
vars_files: vars/916_storage.yaml
tasks:
- name: Create partition
parted:
device: "{{ item.device_ }}"
part_end: "{{ item.size_ }}"
number: "{{ item.number_ }}"
state: present
loop: "{{ pvdata_ }}"
- name: Create VG
lvg:
vg: "{{ item.name_ }}"
pvs: "{{ item.device_ }}"
state: present
pesize: 32M
loop: "{{ vgdata_ }}"
- name: Create LV
lvol:
lv: "{{ item.name_ }}"
vg: "{{ item.vg_}}"
size: "{{ item.size_ }}"
state: present
loop: "{{ lvdata_ }}"
when: item.name_ not in ansible_lvm["lvs"]
- name: Create filesystem
filesystem:
dev: "/dev/{{ item.vg_}}/{{ item.name_ }}"
fstype: "{{ item.fs_ }}"
loop: "{{ lvdata_ }}"
- name: Resize LV
lvol:
lv: "{{ item.name_ }}"
vg: "{{ item.vg_}}"
size: "{{ item.size_ }}"
resizefs: yes
force: yes
loop: "{{ lvdata_ }}"
- name: Mount a patition
mount:
boot: yes
fstype: "{{ item.fs_ }}"
path: "{{ item.mountpoint_ }}"
src: "/dev/{{ item.vg_}}/{{ item.name_ }}"
state: mounted
loop: "{{ lvdata_ }}"