Four Environments, Two Different Config Files

42 views
Skip to first unread message

Chris Short

unread,
Feb 13, 2015, 6:36:01 PM2/13/15
to ansible...@googlegroups.com

I have four environments (each having their own inventories, host_vars, and group_vars). I have a config that's the same for three of those environments (labs) and a different config for use in the last environment (production). At least two servers in each environment are utilizing this config. I have one role to deploy the bits for all the environments except this one configuration file and I can't seem to grasp how to handle the one off. Thoughts?

Thanks,
Chris Short

Brian Coca

unread,
Feb 16, 2015, 9:25:13 AM2/16/15
to ansible...@googlegroups.com
you can set group_vars at play level, for this config you can still
have an all and a production file.


--
Brian Coca

Chris Short

unread,
Feb 16, 2015, 9:27:28 AM2/16/15
to ansible...@googlegroups.com
I am actually in the process of just making a template for each environment. Would you happen to have an example of what you're talking about? If not, that's fine.

Brian Coca

unread,
Feb 16, 2015, 9:55:45 AM2/16/15
to ansible...@googlegroups.com
normally you only need 1 template and feed it the different vars, I
don't have a usable example but it is simply like this:

play.yml
templates/template.j2
group_vars/
all
production

production will override all for those values, all should have the
vaules that are common to the 3 envs, production the values for just
production.


--
Brian Coca

Chris Short

unread,
Feb 16, 2015, 9:58:27 AM2/16/15
to ansible...@googlegroups.com
Ah, okay. I was overthinking this. Your solution makes sense. Much appreciated!
Reply all
Reply to author
Forward
0 new messages