I found debops via ansible galaxy and I first attempted to use a bunch of the roles in my playbooks. However I later find out they all have a unique set of dependencies that really require the whole debops package. This doesn't work in my use case as I need to stay with stock ansible as close as possible. Debops is one of the best collections of ansible roles that I have come across and I would like to help contribute to making these roles better versus forking them.
It is my hope that you would consider going "native" on some of the functionality. This may involve some alternative approaches to functionality or collectively working with ansible to try and get some missing functionality in core. The end goal is to be able to use these roles independently and in insolation of the playbooks repository. These are some of the problems I encountered when using devops.
Pre / post role hooks
I definitely understand the use case for these, but I don't know that debops should cater to it. This seems like it could easily be accomplished with stock ansible with something like:
roles:
- { role: custom-pre-mysql }
- { role: debops.mysql, tags: [mysql] }
- { role: custom-post-mysql }
If you want something to happen before or after a role, you just include your own role, before or after. If you want to override functionality, you can do it in the post role.
Alternatively, maybe you can add some feature detection:
- name: DebOps pre_tasks hook
include: "{{ lookup('task_src', 'mysql/pre_main.yml') }}"
when: debops_env == 'native'
That way it should work without it, and when ran in debops environment you can pass in the extra vars, put it in group vars, hosts, etc.
Template src
If I understand this correctly the goal is to be able to override templates to provide your own? I have seen this in some roles, but not others. So it seems this may be legacy or new functionality? that is not consistent across all roles yet?
I am not familiar with ansible internals but this seems like something better suited at the ansible level to be able to override any templates. For example {{ lookup("template", "etc/fail2ban/jail.local.d/default.local.j2") }}
should have a way in the config to search custom paths for that file. if this doesn't exist, and hasn't been proposed, then we should voice our support or submit a pull request to introduce this functionality to core.
In the interim, you could always convert it to a var like fail2ban_template_jail_local: 'etc/fail2ban/jail.local.d/default.local.j2'
. This would allow overrides. On templates with loops, you could specify a folder instead template: src={{ fail2ban_template_jail_local + item.name }}
.
Also, maybe you can consider the feature detection mentioned above? One that loads your template_src
when in the right environment, otherwise use a normal template that doesn't allow it to be overwritten.
Other role dependencies
I was also wondering about mysql for example, requiring secret, ferm, and tcpwrappers. It seems these dependencies offer some security or other features, but are not actually required by the role. Is there another way to have these dependencies installed and configured when they are part of a playbook that has them, but not a hard dependency on the individual role.
I am also not sure how this works if we try to override all the ferm_input_list
, but if there are 5 roles with ferm as a dependency that add more inputs, do the group vars override all of that or also add to it?
Maybe the dependencies can be removed and replace with documentation suggesting the installation of ferm and its inputs when using mysql? Or maybe there is a way to make the dependencies optional when you want to use mysql but not ferm or tcpwrappers?