Skip to content

Instantly share code, notes, and snippets.

@filviu
Created March 17, 2020 11:22
Show Gist options
  • Save filviu/26f2c3c65b0a7d4563d6106318deb592 to your computer and use it in GitHub Desktop.
Save filviu/26f2c3c65b0a7d4563d6106318deb592 to your computer and use it in GitHub Desktop.
# First define your dict:
nfsmounts:
- { path: "/mnt/nfs_mount", src: "192.168.0.55:/nfsshare" }
- { path: "/mnt/nfs_mount_2", src: "192.168.0.55:/nfsshare_2" }
# Shamelessly lifted from here:
# https://stackoverflow.com/questions/45387791/mount-different-shares-from-nfs-on-a-linux-os-using-ansible
# Then loop through it:
- name: mount the nfsshare in client side
mount:
fstype: nfs
opts: defaults
dump: 0
passno: 0
state: mounted
src: {{ item.src }}
path: "{{ item.path }}"
with_items: nfsmounts
You can use the dic to parametrize more arguments of mount task too if you want
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment