Facts not available when using debug module in ad-hoc mode

Hi,

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!"
}

If you are not using a cache, you need to gather facts yourself, but
adhoc is a 'single task' and that would make it 2 tasks.

Use a play or setup the fact cache..

* Brian Coca <bcoca@redhat.com> (2018-07-02 13:30:33 -0400):

If you are not using a cache, you need to gather facts yourself, but
adhoc is a 'single task' and that would make it 2 tasks.

Use a play or setup the fact cache..

I went for the fact cache option.
Thanks for the answer.

Kai

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",
...