ansible/test/integration/targets/filesystem/tasks/overwrite_another_fs.yml
Pilou e9e316c76b Filesystem: refactor, improvements, add tests (#25519)
* filesystem: list used tools

* filesystem: btrfs and reiserfs don't support resizing

* filesystem: list supported filesystems

use formatting functions and 'filesystem' instead of 'file system'

* filesystem: PEP8

* filesystem: remove useless calls to module.boolean

* filesystem: fail when the requested action isn't implemented

* filesystem: resizefs: list supported FS rather than unsupported

* filesystem: refactor

* filesystem: add integration tests

* filesystem: allow to use image file with 'dev' param

* filesystem: test resizefs (ext2/3/4 filesystems only)

* filesystem: Btrfs, handle older version than v0.20-rc1

* filesystem: use loop keyword (integration tests)

* filesystem: new test, check when another filesystem already exists

* filesystem: add myself as a maintainer

* filesystem: fix tests as filters
2018-01-11 11:10:14 -05:00

44 lines
1.2 KiB
YAML

- name: 'Recreate "disk" file'
command: 'dd if=/dev/zero of={{ dev }} bs=1M count={{ fssize }}'
- name: 'Create a vfat filesystem'
command: 'mkfs.vfat {{ dev }}'
when: ansible_system != 'FreeBSD'
- name: 'Create a vfat filesystem'
command: 'newfs_msdos -F12 {{ dev }}'
when: ansible_system == 'FreeBSD'
- command: 'blkid -c /dev/null -o value -s UUID {{ dev }}'
register: uuid
- name: "Check that an existing filesystem (not handled by this module) isn't overwritten when force isn't used"
filesystem:
dev: '{{ dev }}'
fstype: '{{ fstype }}'
register: fs_result
ignore_errors: True
- command: 'blkid -c /dev/null -o value -s UUID {{ dev }}'
register: uuid2
- assert:
that:
- 'fs_result is failed'
- 'uuid.stdout == uuid2.stdout'
- name: "Check that an existing filesystem (not handled by this module) is overwritten when force is used"
filesystem:
dev: '{{ dev }}'
fstype: '{{ fstype }}'
force: yes
register: fs_result2
- command: 'blkid -c /dev/null -o value -s UUID {{ dev }}'
register: uuid3
- assert:
that:
- 'fs_result2 is successful'
- 'fs_result2 is changed'
- 'uuid2.stdout != uuid3.stdout'