Create /etc/ansible/host_vars and /etc/ansible/group_vars

Create group vars files like
/etc/ansible/group_vars/myhosts.yml

and enter variables for your 'myhosts' group in the myhosts.yml file. 
 Remember that these are YAML files, so vars need to be in the form

key: value

NOT 

key=value

Hope this helps,
Jon


On Tuesday, April 12, 2016 at 2:26:42 PM UTC+1, thanstra wrote:
>
> I currently have been putting both hosts and host related variables into 
> the /etc/ansible/hosts file with variables such as this:
>
> [myhosts]
> host1
> host2
>
> [host1]
> host1.domain
>
> [host1:vars]
> var1="Some data"
> var2="Some other data"
> tag1=myTag
>
> [host2]
> host2.domain
>
> [host2:vars]
> ...
>
> etc.  This all works but is not overly scalable as the number of servers 
> grows.
>
> How can I break this up into a more directory based structure so that 
> things can scale better with many servers. I've tried to read through 
> information on host_vars and group_vars but have not succeeded in getting 
> the syntax set up properly to mimic what I have working with the hosts file.
>
> Can someone help me figure out directory structure, naming, and setup to 
> get that working?
>
> Thanks!
>

-- 
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/e510acb0-0102-4494-856c-fc3ee975760d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to