mirror of
https://github.com/mrlesmithjr/ansible-manage-lvm.git
synced 2026-09-06 23:48:12 +03:00
Merge pull request #3 from OsgiliathEnterprise/id2
makes xfs mountpoint repeatable
This commit is contained in:
+42
-19
@@ -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)
|
- name: manage_lvm | creating new filesystem on new LVM logical volume(s)
|
||||||
filesystem:
|
filesystem:
|
||||||
@@ -25,6 +41,31 @@
|
|||||||
)
|
)
|
||||||
# unable to resize xfs: looks like we've to reference the mountpoint instead of the device
|
# 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)
|
- name: manage_lvm | creating new xfs filesystem on new LVM logical volume(s)
|
||||||
filesystem:
|
filesystem:
|
||||||
fstype: "{{ lv.filesystem }}"
|
fstype: "{{ lv.filesystem }}"
|
||||||
@@ -35,6 +76,7 @@
|
|||||||
become: true
|
become: true
|
||||||
when: >
|
when: >
|
||||||
(
|
(
|
||||||
|
mountedxfs is failed and
|
||||||
(vg.create is defined and
|
(vg.create is defined and
|
||||||
vg.create) and
|
vg.create) and
|
||||||
(lv is defined and
|
(lv is defined and
|
||||||
@@ -46,24 +88,6 @@
|
|||||||
lv.filesystem == 'xfs'
|
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"
|
- name: "debug mount"
|
||||||
loop: "{{ vg.lvnames }}"
|
loop: "{{ vg.lvnames }}"
|
||||||
@@ -71,7 +95,6 @@
|
|||||||
loop_control:
|
loop_control:
|
||||||
loop_var: lv
|
loop_var: lv
|
||||||
|
|
||||||
|
|
||||||
- name: manage_lvm | mounting new filesystem(s)
|
- name: manage_lvm | mounting new filesystem(s)
|
||||||
mount:
|
mount:
|
||||||
path: "{{ lv.mntp }}"
|
path: "{{ lv.mntp }}"
|
||||||
|
|||||||
Reference in New Issue
Block a user