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.

-- 
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/8a4beb04-ffdd-44fb-b3d8-f0149eff5a61%40googlegroups.com.

Reply via email to