mirror of
https://github.com/mrlesmithjr/ansible-manage-lvm.git
synced 2025-12-14 13:54:58 +03:00
makes xfs mountpoint repeatable
This commit is contained in:
@@ -1,4 +1,20 @@
|
||||
---
|
||||
- name: manage_lvm | unmounting filesystem(s)
|
||||
mount:
|
||||
path: "{{ lv.mntp }}"
|
||||
src: "/dev/{{ vg.vgname }}/{{ lv.lvname }}"
|
||||
fstype: "{{ lv.filesystem | default(omit) }}"
|
||||
state: "absent"
|
||||
become: true
|
||||
loop: "{{ vg.lvnames }}"
|
||||
loop_control:
|
||||
loop_var: lv
|
||||
when: >
|
||||
(lv is defined and
|
||||
lv != 'None') and
|
||||
(lv.create is defined and
|
||||
not lv.create and
|
||||
lv.filesystem != "swap")
|
||||
|
||||
- name: manage_lvm | creating new filesystem on new LVM logical volume(s)
|
||||
filesystem:
|
||||
@@ -25,6 +41,32 @@
|
||||
)
|
||||
# unable to resize xfs: looks like we've to reference the mountpoint instead of the device
|
||||
|
||||
- name: lvm | check already converted
|
||||
# at least xfs is executed twice if the partition has changed in the meantime
|
||||
# then it tries to recreate the fs on the mounted fs which indeed fails...
|
||||
shell: "xfs_info /dev/{{ vg.vgname }}/{{ lv.lvname }} | grep -c 'ftype=1'"
|
||||
become: yes
|
||||
loop: "{{ vg.lvnames }}"
|
||||
loop_control:
|
||||
loop_var: lv
|
||||
register: mountedxfs
|
||||
ignore_errors: True
|
||||
changed_when: no
|
||||
when: >
|
||||
(
|
||||
(lv is defined and item.1 != 'None') and
|
||||
(
|
||||
lv.filesystem is defined and
|
||||
lv.filesystem == "xfs"
|
||||
)
|
||||
and
|
||||
(
|
||||
lv.create is defined and
|
||||
lv.create
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
- name: manage_lvm | creating new xfs filesystem on new LVM logical volume(s)
|
||||
filesystem:
|
||||
fstype: "{{ lv.filesystem }}"
|
||||
@@ -35,6 +77,7 @@
|
||||
become: true
|
||||
when: >
|
||||
(
|
||||
mountedxfs is failed and
|
||||
(vg.create is defined and
|
||||
vg.create) and
|
||||
(lv is defined and
|
||||
@@ -46,24 +89,6 @@
|
||||
lv.filesystem == 'xfs'
|
||||
)
|
||||
)
|
||||
# unable to resize xfs: looks like we've to reference the mountpoint instead of the device
|
||||
|
||||
- name: manage_lvm | unmounting filesystem(s)
|
||||
mount:
|
||||
path: "{{ lv.mntp }}"
|
||||
src: "/dev/{{ vg.vgname }}/{{ lv.lvname }}"
|
||||
fstype: "{{ lv.filesystem | default(omit) }}"
|
||||
state: "absent"
|
||||
become: true
|
||||
loop: "{{ vg.lvnames }}"
|
||||
loop_control:
|
||||
loop_var: lv
|
||||
when: >
|
||||
(lv is defined and
|
||||
lv != 'None') and
|
||||
(lv.create is defined and
|
||||
not lv.create and
|
||||
lv.filesystem != "swap")
|
||||
|
||||
- name: "debug mount"
|
||||
loop: "{{ vg.lvnames }}"
|
||||
@@ -71,7 +96,6 @@
|
||||
loop_control:
|
||||
loop_var: lv
|
||||
|
||||
|
||||
- name: manage_lvm | mounting new filesystem(s)
|
||||
mount:
|
||||
path: "{{ lv.mntp }}"
|
||||
|
||||
Reference in New Issue
Block a user