Ansible Workflow with Roles as Git Submodules

What are people’s experiences with using git submodules to incorporate reusable roles into Ansible repos?

We’ve just started trying this out because we are incorporating roles from affiliated public role repos as submodules, and we need to manage integration of public roles into private “master” repos. We need to be able to make edits to submodules and push those out to the public roles without a lot of overhead. We also need to keep multiple developers in sync.

Any experiences, regrets, or recommendations with regards to Ansible roles as submodules? Any recommendations for submodule workflows, or alternate strategies such as managed vendoring ala golang?

I think the solutions discussed in https://groups.google.com/forum/#!topic/ansible-project/TawjChwaV08
start to look like managed vendoring ala golang.

Not to say it’s the only solution and git submodules might work, but the above approach is where I’m thinking of going with managing versioning of roles.

Will

Keep it simple solution is to just copy paste the code in. I’d wager for most vendored roles the benefits of the upstream changes will be outweighed by the cost of maintaining the submodule connections.

We are the maintainers of the upstream repos in this case. I’m starting to think, though, that we need to shift the burden to the side of keeping upstream repos up-to-date, and keep our working repositories nice and simple. I don’t want our working repos to be brittle, and I can already see that’s going to be the case with submodules.

So what I intend to do is just vendor the roles in from the upstream repos so that developers can use a normal git workflow in the working repos. But I would like to look at scripting the process of updating our upstreams. We’ll have to live with either losing or recreating commit messages when updating our upstream repos, but I think it’s a small price to pay for a simplified and robust workflow in the working repos.

Generally you’ll find roles in things like galaxy are just starting points, and it’s not expected that you follow them as upstream copies change.

I would consider starting your own company roles repo, maybe call it foocorp-roles, as you are likely going to want modifications.

But I would not look at it as per-project vendoring or anything complicated like that.

It’s not source code, and most likely the content is not going to need to change, so use things as a starting point, and then make them your own.

–Michael