Can someone give me a more complete example of how to tie together ansible 
hosts file and the hosts_var directory?

My ansible hosts file is getting out of hand and I want to break it up 
better. I use variables for various pieces of info. Currently my hosts file 
has sections like this:

[myserver]
myserver.my.domain


[myserver:vars]
host=myserver.my.domain
tagName=myserver
tagOwner=thanstra
tagBackup=True

And then I can later use the variables which are set there:

- name: Tag the instance Name
  command: aws ec2 create-tags --resources {{ ansible_ec2_instance_id }} 
--tags Key=Name,Value={{ tagName }}

I'd like to break this up to build files in hosts_var with those various 
vars in separate files for each server. But I'm having trouble figuring out 
the right syntax, naming conventions, etc for what needs to go in ansible 
hosts file and host_vars/[connected file].

Can someone give me clear information on what files I need and what the 
syntax of the files should look like?

Thank you!

-- 
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 ansible-project+unsubscr...@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/8817aa9d-5289-4c8b-a912-7e2449364ed5%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to