1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00
community.general/tests/integration/targets/filesystem/tasks/create_device.yml
quidame aa95d8a5b7
module filesystem: partially fix idempotency issue #1457 (resizefs) (#1478)
* Use 'xfs_info' to query fs size, that doesn't always require the device be
  mounted. Although still query mountpoint first for backward compatibility.
* Do not fail whith fstype=xfs and resizefs=yes if filesystem already fills
  its underlying device.
* Include xfs in the tasks that test idempotency of resizefs option
* Add changelogs/fragments/1478-filesystem-fix-1457-resizefs-idempotency.yml
2021-02-03 07:54:04 +01:00

33 lines
790 B
YAML

---
- 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'
- name: 'Clean correct device for LVM'
set_fact:
dev: '{{ image_file }}'
when: fstype == 'lvm'
- file:
name: '{{ image_file }}'
state: absent