Passing variables into files for syncing

17 views
Skip to first unread message

Colin Byrne

unread,
Dec 17, 2015, 3:39:52 AM12/17/15
to Ansible Project
Hey, so I have a number of essentially identical development servers which have a set of mostly-identical config files. In the config files are small configuration differences for each server, usually a differing API key or a differing host name, which will need to persist for the life of the file. I would love to use ansible to sync the identical portions of the config files, but am looking for a way to also keep the differing portions separate. Is there a way to pass in the server-specific vars as I sync the config files? Any other ideas? Sincere thanks for any help!

David Karban

unread,
Dec 17, 2015, 5:31:04 AM12/17/15
to ansible...@googlegroups.com
Hi Colin, 

look at group_vars and host_vars directories: http://docs.ansible.com/ansible/intro_inventory.html

Most of the settings will be in group_vars and whenever you will need different api key, or anything, you can add it to host_vars/ directory for that one host.

Regards
David
Linux server specialist/Specialista na správu linuxových serverů
www.karban.eu

2015-12-17 9:39 GMT+01:00 Colin Byrne <coby...@gmail.com>:
Hey, so I have a number of essentially identical development servers which have a set of mostly-identical config files. In the config files are small configuration differences for each server, usually a differing API key or a differing host name, which will need to persist for the life of the file. I would love to use ansible to sync the identical portions of the config files, but am looking for a way to also keep the differing portions separate. Is there a way to pass in the server-specific vars as I sync the config files? Any other ideas? Sincere thanks for any help!

--
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-proje...@googlegroups.com.
To post to this group, send email to ansible...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/c1a71e12-ccb5-4e71-9654-6797c3ccf289%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages