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_fs.yml

88 lines
2.1 KiB
YAML
Raw Normal View History

2020-03-09 10:11:07 +01:00
- 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'
- when: 'grow|bool and (fstype != "vfat" or resize_vfat)'
2020-03-09 10:11:07 +01:00
block:
- name: increase fake device
shell: 'dd if=/dev/zero bs=1M count=1 >> {{ image_file }}'
2020-03-09 10:11:07 +01:00
- name: Resize loop device for LVM
command: losetup -c {{ dev }}
when: fstype == 'lvm'
2020-03-09 10:11:07 +01:00
- 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
- when:
- (grow | bool and (fstype != "vfat" or resize_vfat)) or
(fstype == "xfs" and ansible_system == "Linux" and
ansible_distribution not in ["CentOS", "Ubuntu"])
2020-03-09 10:11:07 +01:00
block:
- name: Check that resizefs does nothing if device size is not changed
filesystem:
dev: '{{ dev }}'
fstype: '{{ fstype }}'
resizefs: yes
register: fs5_result
- assert:
that:
- 'fs5_result is not changed'
- 'fs5_result is succeeded'