From 851e8e18b2a75635c9d4974ac197313c473fc38f Mon Sep 17 00:00:00 2001 From: Alicia Cozine <879121+acozine@users.noreply.github.com> Date: Thu, 11 Jun 2020 13:16:41 -0500 Subject: [PATCH] clarifies that vars can begin with _, with a warning (#69749) Co-authored-by: Sayee <57951841+sayee-jadhav@users.noreply.github.com> Co-authored-by: Alicia Cozine Co-authored-by: Sayee <57951841+sayee-jadhav@users.noreply.github.com> --- docs/docsite/rst/user_guide/playbooks_variables.rst | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/docs/docsite/rst/user_guide/playbooks_variables.rst b/docs/docsite/rst/user_guide/playbooks_variables.rst index c51369d413f..5e296ec08e8 100644 --- a/docs/docsite/rst/user_guide/playbooks_variables.rst +++ b/docs/docsite/rst/user_guide/playbooks_variables.rst @@ -18,7 +18,9 @@ Once you understand the concepts and examples on this page, read about :ref:`Ans Creating valid variable names ============================= -Not all strings are valid Ansible variable names. A variable name must start with a letter, and can only include letters, numbers, and underscores. `Python keywords`_ and :ref:`playbook keywords` are not valid variable names. +Not all strings are valid Ansible variable names. A variable name can only include letters, numbers, and underscores. `Python keywords`_ and :ref:`playbook keywords` are not valid variable names. A variable name cannot begin with a number. + +Variable names can begin with an underscore. In many programming languages, variables that begin with an underscore are private. This is not true in Ansible. Variables that begin with an underscore are treated exactly the same as any other variable. Do not rely on this convention for privacy or security. .. table:: :class: documentation-table @@ -32,7 +34,7 @@ Not all strings are valid Ansible variable names. A variable name must start wit ``foo_port`` ``foo-port``, ``foo port``, ``foo.port`` - ``foo5`` ``5foo``, ``12`` + ``foo5``, ``_foo`` ``5foo``, ``12`` ====================== ==================================================================== .. _Python keywords: https://docs.python.org/3/reference/lexical_analysis.html#keywords