From 077e1bfe17b99d805dfa94ad9f67e2384077808c Mon Sep 17 00:00:00 2001 From: wnjuguna Date: Thu, 1 Sep 2022 21:28:03 +0300 Subject: [PATCH] Added section about boolean variables (#78653) Co-authored-by: William Njuguna --- .../playbook_guide/playbooks_variables.rst | 20 +++++++++++++++++++ .../rst/reference_appendices/YAMLSyntax.rst | 2 +- 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/docs/docsite/rst/playbook_guide/playbooks_variables.rst b/docs/docsite/rst/playbook_guide/playbooks_variables.rst index 746c0057836..ad31c0ea055 100644 --- a/docs/docsite/rst/playbook_guide/playbooks_variables.rst +++ b/docs/docsite/rst/playbook_guide/playbooks_variables.rst @@ -95,6 +95,26 @@ You will see: ``ERROR! Syntax Error while loading YAML.`` If you add quotes, Ans vars: app_path: "{{ base_path }}/22" +.. _boolean_variables: + +Boolean variables +================= + +Ansible accepts a broad range of values for boolean variables: ``true/false``, ``1/0``, ``yes/no``, ``True/False`` and so on. The matching of valid strings is case insensitive. +While documentation examples focus on ``true/false`` to be compatible with ``ansible-lint`` default settings, you can use any of the following: + +.. table:: + :class: documentation-table + + =============================================================================================== ==================================================================== + Valid values Description + =============================================================================================== ==================================================================== + ``True`` , ``'true'`` , ``'t'`` , ``'yes'`` , ``'y'`` , ``'on'`` , ``'1'`` , ``1`` , ``1.0`` Truthy values + + ``False`` , ``'false'`` , ``'f'`` , ``'no'`` , ``'n'`` , ``'off'`` , ``'0'`` , ``0`` , ``0.0`` Falsy values + + =============================================================================================== ==================================================================== + .. _list_variables: List variables diff --git a/docs/docsite/rst/reference_appendices/YAMLSyntax.rst b/docs/docsite/rst/reference_appendices/YAMLSyntax.rst index 5cdd2f10b50..d72d31628ce 100644 --- a/docs/docsite/rst/reference_appendices/YAMLSyntax.rst +++ b/docs/docsite/rst/reference_appendices/YAMLSyntax.rst @@ -72,7 +72,7 @@ These are called "Flow collections". .. _truthiness: -Ansible doesn't really use these too much, but you can also specify a boolean value (true/false) in several forms:: +Ansible doesn't really use these too much, but you can also specify a :ref:`boolean value ` (true/false) in several forms:: create_key: yes needs_agent: no