I’m trying to wrap my brain around something. Can Ansible deploy different application configuration files based upon a hostname, IP address, network address, etc? To take that a step further, could Ansible look at a template and then fill in the blanks based upon hostname, IP, and/or network address? If so, how? Is there an example somewhere.
I’m trying to wrap my mind around this concept still so I might not be asking this in the right way.
I kinda get it? Maybe I’m not presenting this correctly or largely enough. I need to deploy multiple configuration files (dozens) across multiple environments. Configurations would likely not share many values. For example:
AppA
_ConfigA - 7 different option/variable pairs
_ConfigB - 4 different option/variable pairs
_ConfigC - 12 different option/variable pairs
AppB
_ConfigD - 2 different option/variable pairs
_ConfigE - 17 different option/variable pairs
_ConfigF - 24 different option/variable pairs
The list goes on and on. Also, some environments might have one option/variable pair where others have multiples (dev lab moving on up through production).
Can anyone point me to an example of this? The documentation doesn’t seem to be helping me see this on a grander scale (or maybe I’m missing something).
Ansible definitely supports the scenario you’re describing. I think you might need to just go through the docs from start to finish, or start building a proof of concept (e.g. start with 3 machines/environments and 2 configs per machine/environment). I don’t know of an open source example (or a contrived example) that is going to convince you that ansible will do this at the scale you’re referencing, but it will, and it has a nice abstraction for it. It’s what ansible was designed for - orchestration of machines/environments at scale.
Here’s a couple links that might point you in the right direction, but I recommend reading through the entire ansible documentation, it’s pretty decent. And spending a day doing a proof of concept will help focus your questions from the general “can it do this conceptual thing” to the specific “where do I define my option/variable pairs for configA.conf.j2 template of AppB” and should take you in the right direction.
Well worth looking at doing this with inventory and group_vars Chris - ideally you want to avoid embedding lots of {% if %} stuff in templates, because it makes it harder for people to follow what you’re doing.