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 explain the meaning of '{{ }}' in ansible.cfg doc and the output generated by ansible-config init #1211

Open
1 task done
ecchong opened this issue Mar 13, 2024 · 6 comments
Assignees
Labels
new_contributor This PR is the first contribution by a new community member.

Comments

@ecchong
Copy link

ecchong commented Mar 13, 2024

Summary

Some default value in ansible.cfg doc and output generated by

ansible-config init --disabled --format ini -t base

contains value like this, for example

roles_path={{ ANSIBLE_HOME ~ "/roles:/usr/share/ansible/roles:/etc/ansible/roles" }}

It does not seems to be valid syntax. The documentation does not explain clearly how to interpret it.

Issue Type

Documentation Report

Component Name

lib/ansible/config/base.yml

Ansible Version

$ ansible --version
ansible [core 2.15.9]
  config file = /private/tmp/my_test/ansible.cfg
  configured module search path = ['/Users/echong/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /Users/echong/venv-ansible/lib/python3.9/site-packages/ansible
  ansible collection location = /Users/echong/.ansible/collections:/usr/share/ansible/collections
  executable location = /Users/echong/venv-ansible/bin/ansible
  python version = 3.9.6 (default, Jul 14 2021, 21:53:15) [Clang 12.0.5 (clang-1205.0.22.11)] (/Users/echong/venv-ansible/bin/python3)
  jinja version = 3.1.3
  libyaml = True

Configuration

# if using a version older than ansible-core 2.12 you should omit the '-t all'
$ ansible-config dump --only-changed -t all
CONFIG_FILE() = /private/tmp/my_test/ansible.cfg
DEFAULT_ROLES_PATH(/private/tmp/my_test/ansible.cfg) = ['/private/tmp/my_test/{{ ANSIBLE_HOME ~ "/roles', '/usr/share/ansible/rol>

OS / Environment

MacOS 14
RHEL 8/9

Additional Information

Please explain how to interpret '{{ }}' in doc

Code of Conduct

  • I agree to follow the Ansible Code of Conduct
@ansibot ansibot added the needs_triage Needs a first human triage before being processed. label Mar 13, 2024
@ansibot
Copy link
Contributor

ansibot commented Mar 13, 2024

Files identified in the description:

If these files are incorrect, please update the component name section of the description or use the component bot command.

@jborean93 jborean93 removed the needs_triage Needs a first human triage before being processed. label Mar 14, 2024
@jborean93 jborean93 self-assigned this Mar 14, 2024
@jborean93 jborean93 transferred this issue from ansible/ansible Mar 14, 2024
@ansible-documentation-bot ansible-documentation-bot bot added the new_contributor This PR is the first contribution by a new community member. label Mar 14, 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.

@jborean93
Copy link
Contributor

The syntax represents that the value uses another config option in the default. It uses the Jinja2 templating syntax so the value {{ ANSIBLE_HOME ~ "/roles:/usr/share/ansible/roles:/etc/ansible/roles" }} means that the default include the value of ANSIBLE_HOME becoming ~/.ansible/roles:/usr/share/ansible/roles:/etc/ansible/roles.

I've transferred this issue to the ansible-documentation repo as that is where the doc pages are and where changes would have to be made to clarify this syntax in the docs.

@bcoca
Copy link
Member

bcoca commented Mar 15, 2024

But you shouldn't see this, the output should be templated to avoid confusion, while these templates do work 'internally', they won't work in most cases if defined by the user.

@bcoca bcoca self-assigned this Mar 15, 2024
@ecchong
Copy link
Author

ecchong commented Mar 15, 2024

Both the doc and ansible-config init output have this syntax inside. I think there should be an explanation that they can't be used directly in the ansible.cfg file.

@bcoca
Copy link
Member

bcoca commented Mar 15, 2024

yes, but its not that simple as things like {{CWD}} are usable anywhere the type is a path. Still it should not show up as it shows above in the init ... im not sure about docs since they won't have the specific values for 'everyone's system'.

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

4 participants