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

Extend boolean values section in playbooks_variables #1285

Open
wants to merge 10 commits into
base: devel
Choose a base branch
from

Conversation

skilyazhnev
Copy link

Hello!

in continuation of this issue

#1279

@ansible-documentation-bot ansible-documentation-bot bot added the new_contributor This PR is the first contribution by a new community member. label Apr 18, 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.

@oraNod oraNod added backport-2.15 Automatically create a backport for the stable-2.15 branch backport-2.16 Automatically create a backport for the stable-2.16 branch backport-2.17 Automatically create a backport for the stable-2.17 branch labels Apr 19, 2024
@skilyazhnev skilyazhnev requested a review from bcoca April 22, 2024 10:55
@oraNod oraNod added the backport-2.14 Automatically create a backport for the stable-2.14 branch label Apr 22, 2024
Copy link
Contributor

@oraNod oraNod left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Thanks @skilyazhnev

@skilyazhnev skilyazhnev requested a review from ssbarnea May 7, 2024 08:03
Co-authored-by: Don Naro <dnaro@redhat.com>
Co-authored-by: Don Naro <dnaro@redhat.com>
Copy link
Contributor

@oraNod oraNod left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some minor nits but the rest LGTM

docs/docsite/rst/playbook_guide/playbooks_variables.rst Outdated Show resolved Hide resolved
docs/docsite/rst/playbook_guide/playbooks_variables.rst Outdated Show resolved Hide resolved
docs/docsite/rst/playbook_guide/playbooks_variables.rst Outdated Show resolved Hide resolved
@oraNod
Copy link
Contributor

oraNod commented Jun 4, 2024

@ssbarnea and @bcoca Please take a minute to review the latest round of edits. The details seem good to me and I'd like to get them merged.

Thanks again for the docs contribution @skilyazhnev

Co-authored-by: Don Naro <dnaro@redhat.com>
Co-authored-by: Don Naro <dnaro@redhat.com>
Co-authored-by: Don Naro <dnaro@redhat.com>
=============================================================================================== ====================================================================
``True`` , ``'true'`` , ``'t'`` , ``'yes'`` , ``'y'`` , ``'on'`` , ``'1'`` , ``1`` , ``1.0`` Truthy values
================= =================
Valid values Description
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not really 'ansible native' but YAML that uses true and false and the rest of the list below, it would be 'more true' that True and False are the 'native' options as Ansible evaluation happens inside Python and those are the 'Python native booleans', this also depends on context as inside a {{ }} expression it is Jinja doing the evaluation, which is again using Python under the hood.


=============================================================================================== ====================================================================
.. table::
Copy link
Member

@bcoca bcoca Jun 4, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the bool filter, while is it Jinja, it is an Ansible customization which approximates (but does not really match) the YAML booleans, the table below is incorrect as this is the actual code:

    if a is None or isinstance(a, bool):
        return a
    if isinstance(a, string_types):
        a = a.lower()
    if a in ('yes', 'on', '1', 'true', 1):
        return True
    return False

so it realy only converts 'matching True' and everything else is False

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

though this is something I'm planning to fix so they are closer to YAML by default but can be 'pythonic' otherwise.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport-2.14 Automatically create a backport for the stable-2.14 branch backport-2.15 Automatically create a backport for the stable-2.15 branch backport-2.16 Automatically create a backport for the stable-2.16 branch backport-2.17 Automatically create a backport for the stable-2.17 branch new_contributor This PR is the first contribution by a new community member.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants