Prise en compte du formatage et du montage des LV

This commit is contained in:
Navas 2024-01-13 20:06:17 +01:00
parent 2689088ed9
commit a2591313e7
2 changed files with 41 additions and 6 deletions

View file

@ -0,0 +1,37 @@
- name: Contexte logical volume
debug:
var: _lv
- name: Definit logical volume
lvol:
vg: "{{ _lv.vg }}"
lv: "{{ _lv.name }}"
size: "{{ _lv.size }}"
resizefs: true
delegate_to: "{{ _vm_ip }}"
- name: Verifie que logical volume est formaté
filesystem:
fstype: xfs
dev: "/dev/{{ _lv.vg }}/{{ _lv.name }}"
delegate_to: "{{ _vm_ip }}"
when: _lv.mountpoint is defined
- name: Verifie que mountpoint existe
file:
path: "{{ _lv.mountpoint }}"
state: directory
mode: '0755'
when: _lv.mountpoint is defined
delegate_to: "{{ _vm_ip }}"
- name: Monte logical volume
mount:
path: "{{ _lv.mountpoint }}"
src: "/dev/{{ _lv.vg }}/{{ _lv.name }}"
fstype: xfs
state: mounted
when: _lv.mountpoint is defined
delegate_to: "{{ _vm_ip }}"

View file

@ -74,12 +74,10 @@
- name: Definit logical volume - name: Definit logical volume
lvol: include_tasks: prepare_logical_volume.yml
vg: "{{ item.vg }}" vars:
lv: "{{ item.name }}" _lv: "{{ item }}"
size: "{{ item.size }}" _vm_ip: "{{ pvmt_vm_ip }}"
resizefs: true
delegate_to: "{{ pvmt_vm_ip }}"
with_items: with_items:
- "{{ pvmt_vm_lvm_volumes }}" - "{{ pvmt_vm_lvm_volumes }}"