What is the proper way to express f(g(const)) where f and g are variables
in task files?
Example:
vars:
git_merge_tool: meld
merge_tools: { 'meld': { 'path': '/usr/local/opt/meld/bin/meld' },
<other tools> }
tasks:
# I tried this
- name: Create symlinks to the git tools
file: state=link src="{{item.src}}" dest="{{item.dest}}"
- { src: "/usr/local/bin/{{git_merge_tool}}",
dest: "{{merge_tools[git_merge_tool['path']]}}" } <-
this is the problem
fatal: [ansible-os1] => One or more undefined variables: dict object has no
element Undefined
# And this
- { src: "/usr/local/bin/{{git_merge_tool}}",
dest: "{{merge_tools[{{git_merge_tool}}['path']]}}" }
NO ERROR: but creates a link to the string
{{merge_tools[git_merge_tool['path']]}}
# And even this
- { src: "/usr/local/bin/{{git_merge_tool}}",
dest: "{{merge_tools | attr(git_merge_tool) | attr('path') }}" }
TASK: [git | Create symlinks to the git tools]
********************************
fatal: [ansible-os1] => One or more undefined variables: 'dict object' has
no attribute 'meld'
Are nested vars supported in ansible task files?
kesten
--
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].
For more options, visit https://groups.google.com/groups/opt_out.