I try to find an easy way to test jinja2 statments. I tried the debug
module in ad-hoc mode and found that machine facts are not availabe.
Is this so by design?
How else can I test jinja2 statments?
$ ansible -m debug -a "msg={{ansible_processor}}" -i localhost, localhost
localhost | FAILED! => {
"msg": "The task includes an option with an undefined variable. The error was: 'ansible_processor' is undefined"
}
$ ansible -m debug -a "var=ansible_processor" -i localhost, localhost
localhost | SUCCESS => {
"ansible_processor": "VARIABLE IS NOT DEFINED!"
}
I forgot to mention, another option is using ansilbe-console:
#>ansible-console
Welcome to the ansible console.
Type help or ? to list commands.
bcoca@all (0)[f:5]$ cd localhost
bcoca@localhost (1)[f:5]$ setup
.....
bcoca@localhost (1)[f:5]$ debug var=ansible_processor
localhost | SUCCESS => {
"ansible_processor": [
"0",
"GenuineIntel",
"Intel(R) Core(TM) i7-4790K CPU @ 4.00GHz",
"1",
"GenuineIntel",
...