I cannot get this seemingly simple example to work in Ansible 1.8.3. The variable interpolation does not kick in the task name. All examples I have seen seem to suggest this sho
Whether the variable gets interpolated depends on where it has been declared.
Imagine You have two hosts: A
and B
.
foo
has only per-host values, when Ansible runs the play, it cannot decide which value to use.Source: https://github.com/ansible/ansible/issues/3103#issuecomment-18835432
ansible_user
is an inventory variablegreeting
is an invariant variable- name: Test variable substitution in names
hosts: localhost
connection: local
vars:
greeting: Hello
tasks:
- name: Sorry {{ ansible_user }}
debug:
msg: this won't work
- name: You say '{{ greeting }}'
debug:
var: ansible_user