On 05/20/14 13:01, James Perrin wrote:
> Hi,
>
> I want to ask what is the correct syntax for assigning one variable to
> another? I wish to do this in roles/for/vars/main.yml.
>
> It should be something like:
>
> ip_address: {{ static_ip_address }}
>
>
> but I think I've read somewhere that yml requires quotes around the
> template:
>
> ip_address: "{{ static_ip_address }}"
>
> is this correct?
>
>
Playbooks must be valid YAML, so, quotes are needed since you cannot
_start_ a YAML string with a curly brace '{' character, because that
character is used to define YAML dictionaries. If you were to use the
var in the middle of a string though you would not need to use quotes.
For example, the following syntax is correct:
welcome_message: Hello {{ name }}
> Thanks
> James
> --
> You received this message because you are subscribed to the Google
> Groups "Ansible Project" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to [email protected]
> <mailto:[email protected]>.
> To post to this group, send email to [email protected]
> <mailto:[email protected]>.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/21dc952f-2130-4307-b33c-7a2cdb0cca3e%40googlegroups.com
> <https://groups.google.com/d/msgid/ansible-project/21dc952f-2130-4307-b33c-7a2cdb0cca3e%40googlegroups.com?utm_medium=email&utm_source=footer>.
> For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/ansible-project/537B40C8.6010007%40yahoo.gr.
For more options, visit https://groups.google.com/d/optout.