Optional dependencies

I’d like to float the idea of having optional dependencies. For the most part I use supervisor to control the services that I install on my linux hosts, I’ve found that it is almost a prequisite dependency and its’s included in the meta dependencies list of many of my roles. I’d like to share some of my roles through galaxy, but I’m not sure that I want to tie their usage to the supervisor role, which others might not find as useful as I do. I also find that if I download a role which has a dependency I don’t use or have implemented differently, I have to hack it to remove the offender. It would be useful to have a way for users to avoid installing a dependency.

I know this can be achieved using tags, but rather than everyone rolling their own solution, it would be useful I think if there was a uniform way of doing so, particularly for roles shared using galaxy.

What I’d suggest is the ability to veto a dependency when you invoke the role, possibly as follows

  • {role: my_managed_service, without: ‘sgargan.supervisor’}

Using a role would would set a variable {rolename}_applied (or something to that effect) to true or false depending on whether a dependency had been applied so that the parts of the role that utilized the dependency could be skipped

  • name: install the supervisor config for my_managed_service
    template: src=my_managed_service.conf dest={{supervisor.d_config}}
    when: sgargan.supervisor_applied

To avoid suprises, optional dependencies could be marked as such when they are defined, with everything else being mandatory.

  • dependencies:
  • {role: sgargan.supervisord, optional: true}

What are people’s thoughts on this?

thanks,

Steve

I think we’d want to avoid this level of complexity at this time - role dependencies are already a source of confusion.