sborenst / ansible_aws_deployer

20 stars 20 forks source link

Convert "Environments" to centrallized group_vars #31

Open johannes-cabal opened 7 years ago

johannes-cabal commented 7 years ago

If we create a "group_vars" directory at the top level, we shouldn't have to do the "include_vars" in each playbooks.

This will centralize and automate the inclusion of variables. Put variable that apply to all playbooks in an "all.yml", others into specific groups files (i.e. masters.yml, nodes.yml, etc).

thoraxe commented 7 years ago

But how do you control which groups get loaded when doing bu-workshop versus ocp-ml versus any other "version" that gets created?

johannes-cabal commented 7 years ago

@thoraxe - I intend on splitting apart the variables. Standard variables (and dynamic) will be maintained in group_vars. For everything else, I'll be adding a default directory named "configs" that will load all .yml files at a depth of 1 for custom configurations, variables, etc.

By variable precendence, we us group vars --> include_vars (standard configs) --> include_vars (custom configs). Using find, I load the custom vars if files are detected in that directory.

The issue I have right now is that we have to restructure a ton of the playbooks to follow best practice. We're currently managing it in a weird way. As of right now, I'm going to push up a bunch of changes I've made for formatting, some basic changes, etc. For the major changes, it will be a significant PR that I'd like to get input from you and others (from testing, review, etc).

Edit:

Also, we need to be splitting roles a little better anyways. Doing a pre-install, install, and post-install will help segregate and clean some of this up.

thoraxe commented 7 years ago

Sounds good. Make a branch and we'll test.

thoraxe commented 7 years ago

Do you have an example of this yet? I kinda need to use it for something else.