For each of our servers (webs and perls), we have different mount points 
for each type of servers. So for web servers, I want to use the entries for 
"web_mounts" and perls would be "perl_mounts." 

If I hard code "web_mounts" into the "with_items," it works fine. 
Otherwise, it tells me "nfs_group" is undefined.


# Top Level

roles:
 - { role: webs, nfs_group: "web_mounts" }


# roles/nfs_mounts/vars/main.yml

---

web_mounts:

 - { source: "nfs.local:/nfs/web1, dest: "/web1", opts: "rw,noatime" }

 - { source: "nfs.local:/nfs/web2, dest: "/web2", opts: "rw,noatime" }


perl_mounts:

- { source: "nfs.local:/nfs/perl1, dest: "/web1", opts: "rw,noatime" }

- { source: "nfs.local:/nfs/perl2, dest: "/web2", opts: "rw,noatime" }

# roles/nfs_mounts/tasks/main.yml

- name: Create fstab entries
  mount: fstab=nfs state=present opts="{{ item.opts }}" src="{{ item.source }}" 
name="{{ item.dest }}"
  with_items: "{{ nfs_group }}"

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/a75b2321-3f5e-44d5-bbb7-bb1e628e595a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to