Adding Servers to Icinga 2 for Monitoring Using Ansible script

Hello,

Is there any way to add servers to Icinga web 2 for monitoring using Ansible script. Please let me know if we have any similar documentation for this activity.

Thanks,
Sai

Not aware of any good documentation, but it is possible for sure.

First question is where should your configuration go?

If it is file based configuration on the master, you can use delegate_to and create the configuration there as long as your ansible control machine can access the master.

If it is managed via Icinga 2’s API as single objects, you need an ApiUser with password or client certificate to access it and then it depends on which system can connect to the API to determine where to execute the task, perhaps the ansible control machine would be a good choice.

If it should be created in the director, there are two options using delegate_to and the Director CLI or accessing its API. The last one can easily be setup to do an autologin from a specific address using Rewrite condition and setting the remote user environment variable if you always use the same system to access it.

Probably the easiest solution would be the Director CLI.

You can user our icinga director ansible modules: Ansible modules for Icinga Director - #17 by rndmh3ro