Working with Ansible Galaxy Roles

Hi Everyone

There’s about 10 developers working on our ansible codebase, configuring approx 20 VM’s, it’s going to grow rapidly.

We’ve just started working with ansible galaxy roles and I was wondering if anyone has any links/tips/suggestions on how to manage the workflow?

We’d like to be able to update the ansible galaxy roles easily.

Are we talking about using git submodules here? I’ve read a bit about a requirements file?

Any tips or help will be greatly appreciated.

Thanks in advance

Matt

checkout requirements.yml and having each role in a seperate git repo.

Thanks for the prompt response Jonathan

So the roles being separate git repos would then be git submodules?

Is that the idea?

I’ll read up on requirements.yml now.

Matt

You can also update ansible.cfg to point to one or more role directories. Which is nice if each of your roles is in a git repo, but you want to work on things locally without pushing up changes every time. See the roles_path option: https://docs.ansible.com/ansible/latest/reference_appendices/config.html#default-roles-path

not exactly. Each role will be in its own git repository then requirements.yml will list all the roles you need for that specific play. Makes it easier to manage the roles in different git repositories and not have other changes mixed together.

I can really recommend submodules, but it’s probably a bit more advance than requirements.yml. We manage over 150 roles this way and it’s working like a charm.