mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
9023d4dba1
* extend support for FreeBSD * Check if FS exists with `fstyp` if `blkid` fails to find FS signature (fix a potential data loss) * Add support for FreeBSD special devices (character devices). * Add support for FreeBSD native fstype (UFS). * Update DOCUMENTATION accordingly. * add/update integration tests * Add tests for `fstype=ufs` on FreeBSD. * Run `remove_fs` tests (`state=absent`) on FreeBSD. * Run `overwrite_another_fs` tests on FreeBSD. * add a changelog fragment * fix indentation * restrict new tests to regular files * fix typo * fix searching of providersize (block count) * add '-y' option to growfs command * remove references to versions older than the collection itself * bump version adding new feats to 3.4.0 * reformat *collection* and *version added* for better DOCUMENTATION parsing * skip tests for FreeBSD < 12.2 * run tests for FreeBSD >= 12.2 * re-enable tests for FreeBSD < 12.2 and give it a try with group1 * util-linux not available on FreeBSD < 12.2
98 lines
2.3 KiB
YAML
98 lines
2.3 KiB
YAML
---
|
|
# We assume 'create_fs' tests have passed.
|
|
|
|
- name: "Create filesystem"
|
|
community.general.filesystem:
|
|
dev: '{{ dev }}'
|
|
fstype: '{{ fstype }}'
|
|
|
|
- name: "Get filesystem UUID with 'blkid'"
|
|
ansible.builtin.shell:
|
|
cmd: "{{ get_uuid_cmd }}"
|
|
changed_when: false
|
|
register: blkid_ref
|
|
|
|
- name: "Assert that a filesystem exists on top of the device"
|
|
ansible.builtin.assert:
|
|
that:
|
|
- blkid_ref.stdout | length > 0
|
|
|
|
|
|
# Test check_mode first
|
|
- name: "Remove filesystem (check mode)"
|
|
community.general.filesystem:
|
|
dev: '{{ dev }}'
|
|
state: absent
|
|
register: wipefs
|
|
check_mode: yes
|
|
|
|
- name: "Get filesystem UUID with 'blkid' (should remain the same)"
|
|
ansible.builtin.shell:
|
|
cmd: "{{ get_uuid_cmd }}"
|
|
changed_when: false
|
|
register: blkid
|
|
|
|
- name: "Assert that the state changed but the filesystem still exists"
|
|
ansible.builtin.assert:
|
|
that:
|
|
- wipefs is changed
|
|
- blkid.stdout == blkid_ref.stdout
|
|
|
|
# Do it
|
|
- name: "Remove filesystem"
|
|
community.general.filesystem:
|
|
dev: '{{ dev }}'
|
|
state: absent
|
|
register: wipefs
|
|
|
|
- name: "Get filesystem UUID with 'blkid' (should be empty)"
|
|
ansible.builtin.shell:
|
|
cmd: "{{ get_uuid_cmd }}"
|
|
changed_when: false
|
|
failed_when: false
|
|
register: blkid
|
|
|
|
- name: "Assert that the state changed and the device has no filesystem"
|
|
ansible.builtin.assert:
|
|
that:
|
|
- wipefs is changed
|
|
- blkid.stdout | length == 0
|
|
- blkid.rc == 2
|
|
|
|
# Do it again
|
|
- name: "Remove filesystem (idempotency)"
|
|
community.general.filesystem:
|
|
dev: '{{ dev }}'
|
|
state: absent
|
|
register: wipefs
|
|
|
|
- name: "Assert that the state did not change"
|
|
ansible.builtin.assert:
|
|
that:
|
|
- wipefs is not changed
|
|
|
|
# and again
|
|
- name: "Remove filesystem (idempotency, check mode)"
|
|
community.general.filesystem:
|
|
dev: '{{ dev }}'
|
|
state: absent
|
|
register: wipefs
|
|
check_mode: yes
|
|
|
|
- name: "Assert that the state did not change"
|
|
ansible.builtin.assert:
|
|
that:
|
|
- wipefs is not changed
|
|
|
|
|
|
# By the way, test removal of a filesystem on unexistent device
|
|
- name: "Remove filesystem (unexistent device)"
|
|
community.general.filesystem:
|
|
dev: '/dev/unexistent_device'
|
|
state: absent
|
|
register: wipefs
|
|
|
|
- name: "Assert that the state did not change"
|
|
ansible.builtin.assert:
|
|
that:
|
|
- wipefs is not changed
|