ansible.posix/tests/integration/targets/mount/tasks/fstab_last_fields.yml
quidame eafd8f8935 feature: mount - implement swapon/swapoff (#106)
* Declare functions swapon() & swapoff(), is_swap() & reswap().
* Apply swapon/swapoff for states mounted, unmounted, remounted and
  absent.
* Override default opts and boot when fstype=swap.
* Do not honor 'fstab' when fstype=swap (fail instead).
* Also fail when fstype=swap and 'path' is not 'none' ('-' for Solaris).
* Update module documentation accordingly.
+ Replace all platform.system() calls by a variable.

refactor integration tests

* Improve readability/understanding of what is tested, and what OS is
  targeted.
* Move 'swap' related test cases into dedicated file (swap.yml).
* Add new test cases about swap enabling/disabling.
* Extend tests to FreeBSD when possible.
2021-03-28 01:21:08 +01:00

32 lines
1 KiB
YAML

---
# Tasks to validate the two last fields in fstab, that are optional on Linux,
# are added if missing.
- name: Create fstab record with missing last two fields
copy:
dest: /etc/fstab
content: '//nas/photo /home/jik/pictures cifs defaults,credentials=/etc/security/nas.creds,uid=jik,gid=users,forceuid,forcegid,noserverino,_netdev
'
- name: Try to change the fstab record with the missing last two fields
mount:
src: //nas/photo
path: /home/jik/pictures
fstype: cifs
opts: defaults,credentials=/etc/security/nas.creds,uid=jik,gid=users,forceuid,forcegid,noserverino,_netdev,x-systemd.mount-timeout=0
state: present
register: optional_fields_update
- name: Get the content of the fstab file
command:
cmd: cat /etc/fstab
changed_when: false
register: optional_fields_content
- name: Check if the line containing the missing last two fields was changed
assert:
that:
- optional_fields_update is changed
- ''' 0 0'' in optional_fields_content.stdout'
- 1 == optional_fields_content.stdout_lines | length