41 lines
1.0 KiB
YAML
41 lines
1.0 KiB
YAML
- name: Create volume group
|
|
community.general.lvg:
|
|
vg: longhorn_vg
|
|
pvs:
|
|
- /dev/sdb
|
|
pvresize: yes
|
|
|
|
- name: Create logical volume
|
|
community.general.lvol:
|
|
vg: longhorn_vg
|
|
lv: longhorn_lv
|
|
size: 100%VG
|
|
|
|
- name: Store begin timestamp
|
|
ansible.builtin.set_fact:
|
|
start_time: "{{ lookup('pipe', 'date +%s') }}"
|
|
|
|
- name: Create filesystem
|
|
community.general.filesystem:
|
|
dev: /dev/mapper/longhorn_vg-longhorn_lv
|
|
fstype: ext4
|
|
|
|
- name: Store end timestamp
|
|
ansible.builtin.set_fact:
|
|
end_time: "{{ lookup('pipe', 'date +%s') }}"
|
|
|
|
- name: Calculate crude storage benchmark
|
|
ansible.builtin.set_fact:
|
|
storage_benchmark: "{{ [storage_benchmark, (end_time | int - start_time | int)] | max }}"
|
|
|
|
- name: Log benchmark actual duration
|
|
ansible.builtin.debug:
|
|
msg: "Benchmark actual duration: {{ (end_time | int - start_time | int) }} second(s)"
|
|
|
|
- name: Mount dynamic disk
|
|
ansible.posix.mount:
|
|
path: /mnt/blockstorage
|
|
src: /dev/mapper/longhorn_vg-longhorn_lv
|
|
fstype: ext4
|
|
state: mounted
|