mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
Adding a section to the FAQ about array notation. (#30782)
* Adding a section to the FAQ about array notation. * Fixing spelling of jinja and Celsius. * Adding an example that uses dots.
This commit is contained in:
parent
86d8a4ff50
commit
aaaf88908d
1 changed files with 16 additions and 5 deletions
|
@ -305,6 +305,20 @@ You shouldn't put plaintext passwords in your playbook or host_vars; instead, us
|
||||||
|
|
||||||
.. _commercial_support:
|
.. _commercial_support:
|
||||||
|
|
||||||
|
Ansible supports dot notation and array notation for variables. Which notation should I use?
|
||||||
|
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||||
|
|
||||||
|
The dot notation comes from Jinja and works fine for variables without special
|
||||||
|
characters. If your variable contains dots (.), colons (:), or dashes (-) it is
|
||||||
|
safer to use the array notation for variables.
|
||||||
|
|
||||||
|
.. code-block:: jinja
|
||||||
|
|
||||||
|
item[0]['checksum:md5']
|
||||||
|
item['section']['2.1']
|
||||||
|
item['region']['Mid-Atlantic']
|
||||||
|
It is {{ temperature['Celsius']['-3'] }} outside.
|
||||||
|
|
||||||
Can I get training on Ansible?
|
Can I get training on Ansible?
|
||||||
++++++++++++++++++++++++++++++
|
++++++++++++++++++++++++++++++
|
||||||
|
|
||||||
|
@ -407,6 +421,3 @@ Please see the section below for a link to IRC and the Google Group, where you c
|
||||||
Have a question? Stop by the google group!
|
Have a question? Stop by the google group!
|
||||||
`irc.freenode.net <http://irc.freenode.net>`_
|
`irc.freenode.net <http://irc.freenode.net>`_
|
||||||
#ansible IRC chat channel
|
#ansible IRC chat channel
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue