mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
Add some additional value quoting examples (#20464)
The existing examples in the "Gotchas" section were rather simple. Expanded upon those to add some additional clarity around how the quoting in YAML works.
This commit is contained in:
parent
df07866e8f
commit
6c2585f0c8
1 changed files with 10 additions and 0 deletions
|
@ -142,6 +142,16 @@ with a "{", YAML will think it is a dictionary, so you must quote it, like so::
|
|||
|
||||
foo: "{{ variable }}"
|
||||
|
||||
If your value starts with a quote the entire value must be quoted, not just part of it. Here are some additional examples of how to properly quote things::
|
||||
|
||||
foo: "{{ variable }}/additional/string/literal"
|
||||
foo2: "{{ variable }}\\backslashes\\are\\also\\special\\characters"
|
||||
foo3: "even if it's just a string literal it must all be quoted"
|
||||
|
||||
Not valid::
|
||||
|
||||
foo: "E:\\path\\"rest\\of\\path
|
||||
|
||||
The same applies for strings that start or contain any YAML special characters ``[] {} : > |`` .
|
||||
|
||||
Boolean conversion is helpful, but this can be a problem when you want a literal `yes` or other boolean values as a string.
|
||||
|
|
Loading…
Reference in a new issue