0

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.

  • @techraf I saw that question already and it's not the same issue I'm facing. I've tried the solution offered there and it doesn't work either. In that question the value doens't start with a jinja template AND have a colon. my issue seems to arise when both problems are present –  Mar 16 '18 at 17:54
  • 1
    That does not change the fact, that the other question contains the correct answers to the question you asked. ・ Read [How to debug small programs](https://ericlippert.com/2014/03/05/how-to-debug-small-programs/) and [How to create a Minimal, Complete, and Verifiable example](https://stackoverflow.com/help/mcve). – techraf Mar 16 '18 at 17:55
  • The other question does NOT contain the correct answer to my question. you can see from my question that I have tried all of the solutions offered there. and it is NOT the same question either, my question is unique from that one, I'm not simply trying to escape the colon. –  Mar 16 '18 at 18:07
  • Unfortunately, I have a different opinion. ・ On top of being a duplicate, your post lacks MCVE, does not show any effort, and is not useful for others. – techraf Mar 16 '18 at 18:07

0 Answers0