ansible/test/integration/targets/filesystem/tasks/create_fs.yml
Kai f30a08d049 Add vfat support for the filesystem module (#23527)
* Add fat filesystem support

fatresize is temporarily disabled

* Refactor Filesystem.get_dev_size

For more sharing with vFAT class

* Fix filesystem tests on some OSs

I think this is due to older mke2fs on those systems.

* Fix vFAT command on FreeBSD

newfs doesn't seem to work on image files

* Refactor filesystem.grow()

Split out grow_cmd generation and Device operations

* Use swap as unsupported filesystem

Except FreeBSD, which doesn't have mkswap

* Be consistent about str(dev) vs dev.path

Prefer str(dev), this works transparently with '%s' formatting.

* Enable vfat resize, only test fatresize >= 1.0.4

Lower versions have a segfault bug.

* Only install fatresize where available

FreeBSD, OpenSUSE, RHEL and CentOS < 7 don't ship it.
2018-02-06 11:56:43 +01:00

89 lines
2.1 KiB
YAML

- block:
- name: 'Create a "disk" file'
command: 'dd if=/dev/zero of={{ dev }} bs=1M count={{ fssize }}'
- name: filesystem creation
filesystem:
dev: '{{ dev }}'
fstype: '{{ fstype }}'
register: fs_result
- assert:
that:
- 'fs_result is changed'
- 'fs_result is success'
- command: 'blkid -c /dev/null -o value -s UUID {{ dev }}'
register: uuid
- name: "Check that filesystem isn't created if force isn't used"
filesystem:
dev: '{{ dev }}'
fstype: '{{ fstype }}'
register: fs2_result
- command: 'blkid -c /dev/null -o value -s UUID {{ dev }}'
register: uuid2
- assert:
that:
- 'not (fs2_result is changed)'
- 'fs2_result is success'
- 'uuid.stdout == uuid2.stdout'
- name: Check that filesystem is recreated if force is used
filesystem:
dev: '{{ dev }}'
fstype: '{{ fstype }}'
force: yes
register: fs3_result
- command: 'blkid -c /dev/null -o value -s UUID {{ dev }}'
register: uuid3
- assert:
that:
- 'fs3_result is changed'
- 'fs3_result is success'
- 'uuid.stdout != uuid3.stdout'
- name: increase fake device
shell: 'dd if=/dev/zero bs=1M count=20 >> {{ dev }}'
- when: 'grow|bool and (fstype != "vfat" or resize_vfat)'
block:
- name: Expand filesystem
filesystem:
dev: '{{ dev }}'
fstype: '{{ fstype }}'
resizefs: yes
register: fs4_result
- command: 'blkid -c /dev/null -o value -s UUID {{ dev }}'
register: uuid4
- assert:
that:
- 'fs4_result is changed'
- 'fs4_result is success'
- 'uuid3.stdout == uuid4.stdout' # unchanged
- name: Try to expand filesystem again
filesystem:
dev: '{{ dev }}'
fstype: '{{ fstype }}'
resizefs: yes
register: fs5_result
- assert:
that:
- 'not (fs5_result is changed)'
- 'fs5_result is successful'
- import_tasks: overwrite_another_fs.yml
when: ansible_system != 'FreeBSD'
always:
- file:
name: '{{ dev }}'
state: absent