|
|
|
@ -18,24 +18,24 @@
|
|
|
|
|
- name: Create the mount point
|
|
|
|
|
file:
|
|
|
|
|
state: "directory"
|
|
|
|
|
path: "{{ outputdir }}/mount_dest"
|
|
|
|
|
path: "{{ output_dir }}/mount_dest"
|
|
|
|
|
|
|
|
|
|
- name: Create a directory to bind mount
|
|
|
|
|
file:
|
|
|
|
|
state: "directory"
|
|
|
|
|
path: "{{ outputdir }}/mount_source"
|
|
|
|
|
path: "{{ output_dir }}/mount_source"
|
|
|
|
|
|
|
|
|
|
- name: Put something in the directory so we see that it worked
|
|
|
|
|
copy:
|
|
|
|
|
content: "Testing\n"
|
|
|
|
|
dest: "{{ outputdir }}/mount_source/test_file"
|
|
|
|
|
dest: "{{ output_dir }}/mount_source/test_file"
|
|
|
|
|
register: orig_info
|
|
|
|
|
|
|
|
|
|
# The opts type of bind mount only works on Linux
|
|
|
|
|
- name: Bind mount a filesystem (Linux)
|
|
|
|
|
mount:
|
|
|
|
|
src: "{{ outputdir }}/mount_source"
|
|
|
|
|
name: "{{ outputdir }}/mount_dest"
|
|
|
|
|
src: "{{ output_dir }}/mount_source"
|
|
|
|
|
name: "{{ output_dir }}/mount_dest"
|
|
|
|
|
state: "mounted"
|
|
|
|
|
fstype: "None"
|
|
|
|
|
opts: "bind"
|
|
|
|
@ -45,8 +45,8 @@
|
|
|
|
|
# Nullfs is freebsd only
|
|
|
|
|
- name: Bind mount a filesystem (FreeBSD)
|
|
|
|
|
mount:
|
|
|
|
|
src: "{{ outputdir }}/mount_source"
|
|
|
|
|
name: "{{ outputdir }}/mount_dest"
|
|
|
|
|
src: "{{ output_dir }}/mount_source"
|
|
|
|
|
name: "{{ output_dir }}/mount_dest"
|
|
|
|
|
state: "mounted"
|
|
|
|
|
fstype: "nullfs"
|
|
|
|
|
when: ansible_system == 'FreeBSD'
|
|
|
|
@ -54,7 +54,7 @@
|
|
|
|
|
|
|
|
|
|
- name: get checksum for bind mounted file
|
|
|
|
|
stat:
|
|
|
|
|
path: "{{ outputdir }}/mount_dest/test_file"
|
|
|
|
|
path: "{{ output_dir }}/mount_dest/test_file"
|
|
|
|
|
when: ansible_system in ('FreeBSD', 'Linux')
|
|
|
|
|
register: dest_stat
|
|
|
|
|
|
|
|
|
@ -69,8 +69,8 @@
|
|
|
|
|
# The opts type of bind mount only works on Linux
|
|
|
|
|
- name: Bind mount a filesystem (Linux)
|
|
|
|
|
mount:
|
|
|
|
|
src: "{{ outputdir }}/mount_source"
|
|
|
|
|
name: "{{ outputdir }}/mount_dest"
|
|
|
|
|
src: "{{ output_dir }}/mount_source"
|
|
|
|
|
name: "{{ output_dir }}/mount_dest"
|
|
|
|
|
state: "mounted"
|
|
|
|
|
fstype: "None"
|
|
|
|
|
opts: "bind"
|
|
|
|
@ -80,8 +80,8 @@
|
|
|
|
|
# Nullfs is freebsd only
|
|
|
|
|
- name: Bind mount a filesystem (FreeBSD)
|
|
|
|
|
mount:
|
|
|
|
|
src: "{{ outputdir }}/mount_source"
|
|
|
|
|
name: "{{ outputdir }}/mount_dest"
|
|
|
|
|
src: "{{ output_dir }}/mount_source"
|
|
|
|
|
name: "{{ output_dir }}/mount_dest"
|
|
|
|
|
state: "mounted"
|
|
|
|
|
fstype: "nullfs"
|
|
|
|
|
when: ansible_system == 'FreeBSD'
|
|
|
|
@ -96,8 +96,8 @@
|
|
|
|
|
# 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"
|
|
|
|
|
src: "{{ output_dir }}/mount_source"
|
|
|
|
|
name: "{{ output_dir }}/mount_dest"
|
|
|
|
|
state: "mounted"
|
|
|
|
|
fstype: "None"
|
|
|
|
|
opts: "bind,ro"
|
|
|
|
@ -107,8 +107,8 @@
|
|
|
|
|
# Nullfs is freebsd only
|
|
|
|
|
- name: Remount filesystem with different opts (FreeBSD)
|
|
|
|
|
mount:
|
|
|
|
|
src: "{{ outputdir }}/mount_source"
|
|
|
|
|
name: "{{ outputdir }}/mount_dest"
|
|
|
|
|
src: "{{ output_dir }}/mount_source"
|
|
|
|
|
name: "{{ output_dir }}/mount_dest"
|
|
|
|
|
state: "mounted"
|
|
|
|
|
fstype: "nullfs"
|
|
|
|
|
opts: "ro"
|
|
|
|
@ -131,14 +131,14 @@
|
|
|
|
|
|
|
|
|
|
- name: Unmount the bind mount
|
|
|
|
|
mount:
|
|
|
|
|
name: "{{ outputdir }}/mount_dest"
|
|
|
|
|
name: "{{ output_dir }}/mount_dest"
|
|
|
|
|
state: "absent"
|
|
|
|
|
when: ansible_system in ('Linux', 'FreeBSD')
|
|
|
|
|
register: unmount_result
|
|
|
|
|
|
|
|
|
|
- name: Make sure the file no longer exists in dest
|
|
|
|
|
stat:
|
|
|
|
|
path: "{{ outputdir }}/mount_dest/test_file"
|
|
|
|
|
path: "{{ output_dir }}/mount_dest/test_file"
|
|
|
|
|
when: ansible_system in ('FreeBSD', 'Linux')
|
|
|
|
|
register: dest_stat
|
|
|
|
|
|
|
|
|
|