On 4/24/20 10:01 AM, jean-christophe manciot wrote: > Yes, of course: you can define the variable anywhere, including in the hosts > file. > There are 2 differences though: > > * the precedence > > <https://docs.ansible.com/ansible/latest/user_guide/playbooks_variables.html#variable-precedence-where-should-i-put-a-variable>. > * the way the variables are defined: the inventory file is not a yaml file > (ini format). Refer to this post > > <https://stackoverflow.com/questions/29856738/how-to-define-hash-dict-in-ansible-inventory-file> > for how to define > your dictionary(ies) in the hosts file. >
The second statement is correct only if you refer to the host file (defaults to
/etc/ansible/host). The inventory for
your playbook can be written completely in YAML.
Regards
Racke
> --
> 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 view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/8a4beb04-ffdd-44fb-b3d8-f0149eff5a61%40googlegroups.com
> <https://groups.google.com/d/msgid/ansible-project/8a4beb04-ffdd-44fb-b3d8-f0149eff5a61%40googlegroups.com?utm_medium=email&utm_source=footer>.
--
Ecommerce and Linux consulting + Perl and web application programming.
Debian and Sympa administration. Provisioning with Ansible.
--
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 view this discussion on the web visit
https://groups.google.com/d/msgid/ansible-project/19afef66-3bb5-229e-3202-6e9e1433f8ed%40linuxia.de.
signature.asc
Description: OpenPGP digital signature
