-
Notifications
You must be signed in to change notification settings - Fork 389
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use group_vars rather than env_vars for playbook variables. #111
Use group_vars rather than env_vars for playbook variables. #111
Conversation
Hey! Thanks for doing this. I have no inherent objections, but would love to review this and read up a bit more on the trade-offs. Obviously, this would require some work from those of us who maintain forks in order to stay up to date with the project. =) The link to Ansible best practices is interesting, and that strategy definitely solves a lot of the problems I've had with Ansible Vault. While the practice of keeping two files seems sensible, I've been using another standard strategy to encrypt some variables that keeps everything
In short, Over in my fork of this project, I use this strategy for managing production secrets: https://github.com/DavidCain/mitoc-ansible/blob/master/env_vars/production.yml (anywhere in that file with the string "REDACTED" was formerly an encrypted secret, before I used |
@DavidCain thanks for sharing! Offhand - does In terms of searchability, here's the strategy with ansible-vault (which I'd include in the updated README with instructions on using ansible-vault): Your In this way, you can easily find variables that are encrypted by grepping in Example vars.yml
vault.yml (decrypted)
|
Yup, |
@DavidCain got it. I'm still inclined to move in the direction of this PR because (for me at least) encrypting each secret one at a time would take a really long time. Making it so that there's only one file to edit (two with a vault file) to deploy a new instance is another goal that I think this brings us closer to. In any case, take your time to go through it and read up on the trade-offs like you said. If there's a better solution I'd be happy to do that! |
That line of thinking makes perfect sense to me, and it's backed up with a standard Ansible pattern! I'll go through this diff soon when I have some time, but I think your approach is very reasonable. |
@jcalazan @DavidCain @dpward thoughts on merging this PR in? It's backwards incompatible but in-line with Ansible best practices. I'm currently using a forked version with this setup for my own deployments and it's working well; for me as a maintainer merging this in would make updates a lot smoother, but I don't want to be selfish if any of you has very strong objections. |
Would it make sense for the project to adopt semver and resume making occasional releases? Happy for you to make backwards incompatible changes any time you need to as long as it's very obvious to everyone. |
@isedwards that makes a lot of sense. I'd propose releasing the current version as 1.2 and then merging this PR would be v2.0. I would also include the summary of the breaking change in the release notes. |
Perfect. Perhaps you could then do a v2.1 either when People like me can then stick with the releases rather than being on a competing random commit for a random amount of time... (I've got no real feeling for how old the commit I'm currently using is, or whether there's been anything really significant I should be updating to). |
Just wanted to chime in that I'm in support of adopting this change and using semver to indicate major changes to the repo. +1 to Ian's thoughts - it might be nice to lump in some other major breaking change (like dropping support for Ubuntu 16.04, which loses LTS support in April 2021). |
27166fe
to
13e845c
Compare
@StuartMacKay thoughts on this PR? I believe this is the canonical way to manage multiple sites under one playbook. I also know it potentially replaces one of your PR's. I'm aiming to release this as a 2.0 version of this repo but want to make sure others are on board! |
I like that this is inline with best practices and is vault friendly. This is a good playbook anything that makes it stronger is definitely OK by me. When I started using
This gives me complete control and it allows me to use one checked out version of the playbook which I can use with other projects. More importantly it means I can also use the same playbook for development. There's no risk I end up committing deployment related changes. So this last point is my only reservation over group_vars. I'd really rather leave the playbook source tree completely alone and not have my site related stuff laying around in it. However I probably don't know very much about how group_vars work and I can probably still use my "master override" yaml file. tl;dr; go for it. I can adapt to any change. |
19a7d81
to
d0344b3
Compare
6ec14c6
to
c20d479
Compare
@StuartMacKay great point - and your "master override" should be able to work fine using the I'm going to merge this in and we'll be at v2.0. I've also updated most of the underlying libraries and gotten tests working again. |
This is the initial fix for #66.
This PR replaces the current
env_vars
directory with agroup_vars
directory as can be found in Ansible best practices as well as in the best practices for incorporating Ansible Vault.There are (at least) three goals here:
server_user_password
in both staging and production environments.@jcalazan @DavidCain @dpward @StuartMacKay do any of you have an objection to this change which would be breaking vs. the current playbook?