Hi! I have some ansible code that deploys an app . . . some structure of the app has changed which is reflected in the ansible code . . . I’m wondering if anyone has some good techniques for keeping versions of app code and deployment code “married”
The best mariage I see is to make them live in the same repository.
Any reason why they are kind of separated for you ?
a very good reason to have them in separate repositories is that your
deployment repository contain secret things like database passwords,
private TLS keys etc. which are required for deployment, but should not
be included in your app's source repository.
In case you use git, you could make your app's source a git submodule
of your ansible scripts git repo.
Another way is to keep track of your app builds in a YAML file which is
checked into your ansible scripts repo; then your ansible scripts can
deploy the current version mentioned in the YAML file. If you use the
app repo's commit as the deployment tags in the YAML file you get your
"marriage".
The best mariage I see is to make them live in the same repository.
Any reason why they are kind of separated for you ?
a very good reason to have them in separate repositories is that your
deployment repository contain secret things like database passwords,
private TLS keys etc. which are required for deployment, but should not
be included in your app's source repository.
In case you use git, you could make your app's source a git submodule
of your ansible scripts git repo.
Maybe it's just me but git submodules cause no end of grief every time
I've worked somewhere that used them.
How about just using ansible-vault and a single repo?
Another way is to keep track of your app builds in a YAML file which is
checked into your ansible scripts repo; then your ansible scripts can
deploy the current version mentioned in the YAML file. If you use the
app repo's commit as the deployment tags in the YAML file you get your
"marriage".
We used that model successfully before now, except in our case a
'deployment' would consist of 2 tags; one for the config repo and one for the
app repo.