This is my Reddit comment about using one role from another in Ansible. I wrote it and realized it’s more deep than people asked for (their specific question), so I’m re-posting it as a separate article.
I’d like to write down my thoughts about ‘role’ abstraction in Ansible. There is a rather pushy opinion out there that ‘role is the way to reuse and share code’, but I’d like to refute it.
Sometime projects has a very stringent requirements on ansible.cfg. F.e. ceph-ansible uses it to specify location for plugins and modules. Some may have quirks for network_cli (f.e. additional retries), etc, etc. I even don’t…
There is a very, very deep problem for every Ansible project: app/database relation. We need to configure database and users for application to access it, we need application to have that information to…
In this article I discuss a problem of robust linking of two host in different groups. It’s not a beginner problem, and I think we need an example here.
Let’s say we have some kind of ‘consumers’ and ‘providers’. There is a group ‘consumers’ and a…
This is an endless story: your handler need two (or more) actions, and you are allowed to have only one. Because block is not a valid action for a handler.
There is a widely assumed idea in Ansible circles, that using roles is a sign of a better code. If you write everything in roles, it’s like you are writing a good libraries, reusable…
If you need to have some code for your playbook, your options are, usually: