[FeatureRequest] Be able to get the resolved parameters in a module

Hello

This mail follow-up an issue I opened on GH.

I will summary (on update) my issue here.

In my company we have many different kind of server (applicationA, applicationB, rabbitmq, postgres, …)
So have many roles and many playbook.

We have “basic” role that we ship in every single playbook, like machine configuration, user management,
and obvisouly monitoring.

We are also using diamond (like collectd) for telemetry. So I started looking for a diamond role and found this one:
https://github.com/pythianliappis/ansiblediamond

I quite nice, but It does not play very nice in our kind of architecture, because I’m not able to add with ease
a new collector in the “applicationA” role.

Why? Because the only (clean) way to configure new collector is to feed a special var “diamond_collector_extra_defs”.

So it’s not possible to add a collector from another role.

As a side node, I’m coming from chef community (yeah, ansible is just 10 times more fun/simple/easy/hackable than chef.

So I decided to create a module to be able to register a new collector from any task in any role.

You can see the implementation here

It works well, but I’m not really happy with it for two reasons:

  1. I had to hardcode the path (DEFAULT_COLLECTOR_DIR) to the default collector dir

I would like to be able to get the resolved variables

  1. I would like to be able to notify a service

What do you thing ?

Hi Gregoire.

I’m not sure why you had to hardcode things - typically modules that may have file paths at differing locations (because of distro packaging, custom installs, etc.) usually try to auto-detect the path, or failing that will have a param to the module that defaults to the most common location.

As for notifying a service, Ansible has always supported that:

https://docs.ansible.com/playbooks_intro.html#handlers-running-operations-on-change

Any custom module you write should simply returned changed=True in the JSON return, which is what the ‘notify’ action relies on to send the notification to the handler.

Hope that helps!