I define the global variable in group_vars/all. But playbook cannot find out the variable. Please see the red part.
My ansible is 1.1.
/etc/ansible/hosts is:
192.168.126.149
/etc/ansible/group_vars/all is:
test: hello
my playbook is:
I define the global variable in group_vars/all. But playbook cannot find out the variable. Please see the red part.
My ansible is 1.1.
/etc/ansible/hosts is:
192.168.126.149
/etc/ansible/group_vars/all is:
test: hello
my playbook is:
the variable is not resolved in the "name of the task", which is what you
see here (as you didn't set a name, the literal task entry is used as a
name)
you need to execute ansible-playbook verbosely (with the -v switch)
then you should see the value in the extra info
(I think there is an issue/PR addressing this, as to show the debug message
by default)
Serge
Thank you. But when I use vars file in playbook, the task debug can show variable value.
hey Guo,
did you put a -vv in the command line, if not try with ansible -vv or ansible-playbook -vv
ansible-playbook --help
There is no -w.
Then I try:
$ sudo ansible-playbook main.yml -K -k -w
[sudo] password for agilairedev:
Usage: ansible-playbook playbook.yml
ansible-playbook: error: no such option: -w
it a double ‘v’ aka v followed by a v not a w
Yeah, this variable is “inventory scope” and tasks are at a higher scope, it is fine if it does not show up in the name of the task, it is still usable in action lines, templates, and so on.