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
Extend boolean values section in playbooks_variables #1285
base: devel
Are you sure you want to change the base?
Conversation
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. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Thanks @skilyazhnev
While documentation examples focus on ``true/false`` to be compatible with ``ansible-lint`` default settings, you can use any of the following: | ||
While documentation examples focus on ``true/false`` to be compatible with ``ansible-lint`` default settings. You can use any of the following values: | ||
|
||
Native Boolean |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would avoid using "native boolean" for anything else than true
/false
because the only values that are native booleans in all versions of YAML specification.
Maybe we should mention that bit. Currently Ansible uses a YAML 1.1 loader, but when it will move to a 1.2 loader, only these values will remain booleans. This might help people understand better the long term implications.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the issue is not only YAML, Ansible has internal functions to convert booleans that follow the YAML 1.1 spec, so this can apply to JSON and Jinja2.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would avoid using "native boolean" for anything else than true/false because the only values that are native booleans in all versions of YAML specification.
I can change header to Recognizable as Boolean
(or smth like that) for that section, to separate it from Native boolean
definition in yaml 1.2
And as I see, that section of Recognizable as Boolean\Native boolean
still has to to be present here for new ansible version with new loader if it will support Core Schema of yml 1.2 because there still several valid variants of inputs true | True | TRUE | false | False | FALSE
.
If not (It will wotk only with Json Schema) - in new version ofk make sense to reduce it to only two values.
PS: We can add some note like: just use true\false
because that easier for everyone around
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ssbarnea
Could u plz clarify about yaml schema and name of segment to change PR
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@skilyazhnev Thanks for keeping at this one.
How about we keep the "Native boolean" heading but put only true
/ false
underneath that to reflect what @ssbarnea has mentioned about the spec: https://yaml.org/spec/1.2-old/spec.html#id2803629
For the other values in the current table, maybe we could rename the heading to "Implicit boolean"? Something like this:
Native boolean
--------------
Ansible treats these values as native booleans:
<table goes here>
Implicit boolean
------------------------
Ansible recognizes these values as booleans:
<table goes here>
``'false'`` , ``'f'`` , ``'no'`` , ``'n'`` , ``'off'`` , ``'0'`` , ``0`` Falsy values | ||
|
||
================================================================================= ==================================================================== | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's consider giving an example here with the | bool
filter.
Co-authored-by: Don Naro <dnaro@redhat.com>
Co-authored-by: Don Naro <dnaro@redhat.com>
Hello!
in continuation of this issue
#1279