In this final video before we start looking at some real world Ansible-managed system builds, we are going to take a look at Ansible Galaxy.

We have already used Ansible Galaxy a number of times in this series.

Back in the Ansible Roles tutorial video, we saw how we could use ansible-galaxy init __template__ to create our a template role directory prefilled with all the expected folders, and a main.yml file living neatly inside awaiting our further meddling.

We covered using a real Ansible role in the 'How to Manage Users with Ansible video' where we used the brilliant Users Role by mivok0 to abstract away the workings of implementing User Management.

That's really the selling point of Ansible for me - being able to jump over to the Ansible Galaxy website and within a few minutes have found a way to centralise, automate and manage some pain in the arse systems task that used to cost me a bunch of time, or worse, become a task I would leave for later (aka, never do, or never do properly).

How I Use Ansible Galaxy

Before we go further, I want to briefly touch on how I use Ansible Galaxy.

Having recently been forced to wipe my Ansible Master server to get a different task done, I was then caught with the chore of re-installing all the roles I had been using on my previous Ansible master.

Initially I had had enough forethought to make a note of my downloaded, in-use Ansible Galaxy roles in a file I'd called ansible_galaxy_roles. In there, I'd kept my list - but had become a little lazy on updating it. As such, after re-downloading all my roles using the ansible-galaxy install -r ansible_galaxy_roles command, I was still caught out a day after re-installing when I ran a less-often run playbook.

I had to figure out what had gone wrong (which wasn't that hard, the error message was good), and then remember the ansible-galaxy command, and then re-run the playbook.

I got frustrated.

I had already recently swapped to doing a git clone on any new role I had been using, so instead, decided to ditch the ansible-galaxy command and pull the files down locally. I would then remove the .git folder, and assume local control of the role.

Now, this obviously has its downsides - bug fixes, losing the community side of things, and anyone else using the roles to perhaps mistake me for their creator. As such, I don't delete the documentation or license files, if there are any.

The upshot being - I now keep any roles in my own local dev environment, and as such have much better visibility and management of my dependencies.

It works for me.


I want to explain the benefits - to me - of doing this.

Firstly, I get to see all the Roles I use, locally. I mentioned this above.

Secondly, I can easily make any edits or config changes, particularly in the role defaults/main.yml, that better match my environment.

Thirdly, I have learned a ton by doing this. By reading other roles in more depth, I have found loads of tips and tricks to make my own roles better in the process.

Combined, these reasons outweigh the cons of infrequently, potentially having to dig the role back out on github and cherry pick any changes (or just re-download the whole, updated role again).

As ever though, do what works best for you.

Code For This Course

Get the code for this course.

Share This Episode

If you have found this video helpful, please consider sharing. I really appreciate it.

Episodes in this series

# Title Duration
1 How To Install Ubuntu Server in Oracle VirtualBox 10:21
2 How to Rename our Ubuntu Server 02:00
3 Installing Ansible on Ubuntu Server 00:33
4 Safety First, Safety Second - Snapshots are like Ctrl+Z 00:11
5 Managing the Ansible Inventory Hosts File 02:16
6 Ansible Ad Hoc Commands 04:27
7 Introduction to Ansible Playbooks 02:14
8 Ansible Handlers 01:38
9 Ansible Variables 03:16
10 Git Your Deploy Just Right 05:34
11 Ansible Roles 05:51
12 Looping in Ansible with_items 04:34
13 Ansible Files For Beginners 06:14
14 Variable Precedence - Where To Put Your Role Vars? 04:13
15 Ansible Templates 05:51
16 Ansible Inventory With Our Own Hosts Files 06:57
17 How to Manage Users with Ansible 08:32
18 Ansible Vault Tutorial 03:48
19 Ansible Galaxy Tutorial 10:03
20 Real World Ansible - Common Role Walkthrough 06:19
21 Ansible MySQL Tutorial 13:44
22 Ansible Symfony and nginx 09:37