mirror of
https://github.com/mrlesmithjr/ansible-manage-lvm.git
synced 2026-09-06 15:38:11 +03:00
molecule test and idempotence
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
---
|
||||
- name: manage_lvm | check existing physical volume group(s)
|
||||
shell: "vgdisplay | grep '{{ item['vgname'] }}'"
|
||||
become: true
|
||||
with_items: "{{ lvm_groups }}"
|
||||
ignore_errors: True
|
||||
changed_when: no
|
||||
register: vg_exist
|
||||
|
||||
- debug: var=vg_exist
|
||||
|
||||
- name: manage_lvm | creating new LVM physical volume group(s)
|
||||
lvg:
|
||||
vg: "{{ item.item['vgname'] }}"
|
||||
pvs: "{{ item.item['disks']|join(',') }}"
|
||||
state: "present"
|
||||
become: true
|
||||
with_items: "{{ vg_exist.results }}"
|
||||
when: >
|
||||
item.rc != 0 and
|
||||
item.item['create'] is defined and
|
||||
item.item['create']
|
||||
Reference in New Issue
Block a user