mirror of https://github.com/ansible/ansible.git
filesystem tests: enable LVM
Co-authored-by: Pierre-Louis Bonicoli <pierre-louis.bonicoli@libregerbil.fr>pull/46690/head
parent
42730cffc4
commit
e016af3cc6
@ -0,0 +1,27 @@
|
|||||||
|
- name: 'Create a "disk" file'
|
||||||
|
command: 'dd if=/dev/zero of={{ image_file }} bs=1M count={{ fssize }}'
|
||||||
|
|
||||||
|
- vars:
|
||||||
|
dev: '{{ image_file }}'
|
||||||
|
block:
|
||||||
|
- when: fstype == 'lvm'
|
||||||
|
block:
|
||||||
|
- name: 'Create a loop device for LVM'
|
||||||
|
command: 'losetup --show -f {{ dev }}'
|
||||||
|
register: loop_device_cmd
|
||||||
|
|
||||||
|
- set_fact:
|
||||||
|
dev: "{{ loop_device_cmd.stdout }}"
|
||||||
|
|
||||||
|
- include_tasks: '{{ action }}.yml'
|
||||||
|
|
||||||
|
always:
|
||||||
|
- name: 'Detach loop device used for LVM'
|
||||||
|
command: 'losetup -d {{ dev }}'
|
||||||
|
args:
|
||||||
|
removes: '{{ dev }}'
|
||||||
|
when: fstype == 'lvm'
|
||||||
|
|
||||||
|
- file:
|
||||||
|
name: '{{ image_file }}'
|
||||||
|
state: absent
|
Loading…
Reference in New Issue