I'm running into an issue with with two YAML gotchas at the same time. I've tried a number of variation from around the web to try to get around this with no success.
The Task:
- name: Mount nfs on cluster1
mount:
path: /mnt/nfs_jenkins
src: "{{ item[0] }}:{{ item[1] }}"
fstype: nfs
state: mounted
with_nested:
- "{{ groups['nfs'] }}"
- "{{ hostvars[groups['cluster1'][0]].nfs_location }}
The Error
I get the standard error when a value starts with an unquoted jinja2 variable:
The offending line appears to be:
path: /mnt/nfs_jenkins
src: "{{ item[0] }}:{{ item[1] }}"
with_items:
- {{ foo }}
Should be written as:
with_items:
- "{{ foo }}"
What I've tried instead:
src: "{{ item[0] }}":"{{ item[1] }}"
src: "{{ item[0] }}{{':'}}{{ item[1] }}"
src: "{{ item[0] }}{{":"}}{{ item[1] }}"
src: "{{ item[0] }}"":""{{ item[1] }}"
src: '"{{ item[0] }}:{{ item[1] }}"'
none of which work either.