Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
HouzuoGuo opened this issue Jun 24, 2024 · 3 comments
Labels
new_contributor This PR is the first contribution by a new community member.

Comments

@HouzuoGuo
Copy link

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 ansible-documentation-bot bot added needs_triage Needs a first human triage before being processed. new_contributor This PR is the first contribution by a new community member. labels Jun 24, 2024
@ansible-documentation-bot
Copy link
Contributor

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.

@samccann
Copy link
Contributor

Documentation fix:
Add a sentence to say when you pull that data, drop the ansible_ prefix. For example we use {{ ansible_facts['devices']['xvda']['model'] }} instead of {{ ansible_facts['ansible_devices']['xvda']['model'] }}

@samccann
Copy link
Contributor

We need to test the prior comment out first before adding that sentence/example.

@samccann samccann removed the needs_triage Needs a first human triage before being processed. label Jul 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
new_contributor This PR is the first contribution by a new community member.
Projects
Status: 🆕 Triage
Development

No branches or pull requests

2 participants