diff options
author | Toshio Kuratomi <a.badger@gmail.com> | 2016-11-20 01:24:16 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-11-20 01:24:16 +0100 |
commit | 493fb4b665225397259e9e6480c6d3e951726989 (patch) | |
tree | 53bf104fcdd7201d6550e10beb3d5f7abad6f782 /test/integration/targets/mount | |
parent | Update submodule ref for mount fixes (diff) | |
download | ansible-493fb4b665225397259e9e6480c6d3e951726989.tar.xz ansible-493fb4b665225397259e9e6480c6d3e951726989.zip |
Test that changing the flags on a mounted filesystem works (#18552)
* Test that changing the flags on a mounted filesystem works
Diffstat (limited to 'test/integration/targets/mount')
-rw-r--r-- | test/integration/targets/mount/tasks/main.yml | 39 |
1 files changed, 38 insertions, 1 deletions
diff --git a/test/integration/targets/mount/tasks/main.yml b/test/integration/targets/mount/tasks/main.yml index ab3e0c5f4a..3c0b79e11f 100644 --- a/test/integration/targets/mount/tasks/main.yml +++ b/test/integration/targets/mount/tasks/main.yml @@ -90,7 +90,44 @@ - name: Make sure we didn't mount a second time assert: that: - - "not bind_result_linux['changed'] and not bind_result_freebsd['changed']" + - "(ansible_system == 'Linux' and not bind_result_linux['changed']) or (ansible_system == 'FreeBSD' and not bind_result_freebsd['changed'])" + when: ansible_system in ('FreeBSD', 'Linux') + +# The opts type of bind mount only works on Linux +- name: Remount filesystem with different opts (Linux) + mount: + src: "{{ outputdir }}/mount_source" + name: "{{ outputdir }}/mount_dest" + state: "mounted" + fstype: "None" + opts: "bind,ro" + when: ansible_system == 'Linux' + register: bind_result_linux + +# Nullfs is freebsd only +- name: Remount filesystem with different opts (FreeBSD) + mount: + src: "{{ outputdir }}/mount_source" + name: "{{ outputdir }}/mount_dest" + state: "mounted" + fstype: "nullfs" + opts: "ro" + when: ansible_system == 'FreeBSD' + register: bind_result_freebsd + +- name: Get mount options + shell: mount | grep mount_dest | grep -E -w '(ro|read-only)' | wc -l + register: remount_options + +- debug: var=remount_options + +- name: Make sure the filesystem now has the new opts + assert: + that: + - "(ansible_system == 'Linux' and bind_result_linux['changed']) or (ansible_system == 'FreeBSD' and bind_result_freebsd['changed'])" + - "'1' in remount_options.stdout" + - "1 == remount_options.stdout_lines | length" + when: ansible_system in ('FreeBSD', 'Linux') - name: Unmount the bind mount mount: |