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

docs: Update docs to use yaml style when defining vars #219

Merged
merged 1 commit into from
Dec 8, 2023

Conversation

spetrosi
Copy link
Contributor

@spetrosi spetrosi commented Dec 8, 2023

Enhancement: Update docs to use yaml style when defining vars

Reason: The role was using an old jinja style definitions

@richm
Copy link
Contributor

richm commented Dec 8, 2023

some background - constructs like varname: {key: value, ...} are JSON "embedded" in YAML. This is generally discouraged in Ansible - https://github.com/redhat-cop/automation-good-practices/tree/main/coding_style "Even if JSON is valid YAML and Ansible understands it, do only use JSON syntax if it makes sense (e.g. a variable file automatically generated) or adds to the readability. In doubt, nobody expects JSON so stick to YAML."

However, in some cases, it can make the code more readable e.g.

list_var: [a, b, c, d]

is imo more readable than

list_var:
  - a
  - b
  - c
  - d

for short lists with short list members

@richm richm merged commit 365843b into linux-system-roles:main Dec 8, 2023
16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants