diff options
Diffstat (limited to 'test/integration/targets/mount/tasks/main.yml')
-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: |