ansible / ansible-documentation

Ansible community documentation
https://docs.ansible.com/
GNU General Public License v3.0
62 stars 369 forks source link

Please emphasise the distinct lack of "ansible_" prefix used in template syntax on the "Discovering variables" page #1638

Open HouzuoGuo opened 1 week ago

HouzuoGuo commented 1 week ago

The "Discovering variables" page suggests to use setup module to spell out all host facts:

anshot | SUCCESS => {
    "ansible_facts": {
        "ansible_all_ipv4_addresses": [...],
        "ansible_all_ipv6_addresses": [...]

It also illustrates the usage of host facts in an example: {{ ansible_facts['devices']['xvda']['model'] }}

Notably, the dictionary key omits the ansible_ prefix, even though the prefix shows up in the setup module output.

Please add a clarification on the page to emphasise that the lack of ansible_ prefix is working as implemented, and that users should avoid repeating the ansible_ prefix in template.

ansible-documentation-bot[bot] commented 1 week ago

Thanks for your Ansible docs contribution! We talk about Ansible documentation on matrix at #docs:ansible.im and on libera IRC at #ansible-docs if you ever want to join us and chat about the docs! We meet there on Tuesdays (see the Ansible calendar) and welcome additions to our weekly agenda items - scroll down to find the upcoming agenda and add a comment to put something new on that agenda.