This support forum board is for support questions relating to
Nagios XI , our flagship commercial network monitoring solution.
DoubleDoubleA
Posts: 286 Joined: Thu Feb 09, 2017 5:07 pm
Post
by DoubleDoubleA » Tue Mar 06, 2018 6:39 pm
Actually, I think that chaining modular playbooks together with import / include in a master playbook will be the way to address that.
http://docs.ansible.com/ansible/latest/ ... reuse.html
The last one in the chain would be an apply config playbook like
Code: Select all
---
- name: apply configs
hosts: all
connection: ssh
gather_facts: True
remote_user: root
tasks:
- uri:
url: http://{{ xi_ip }}/nagiosxi/api/v1/config/host?apikey={{ xi_api_key }}
body: "force=1&applyconfig=1"
bennyboy
Posts: 157 Joined: Thu Oct 29, 2015 9:42 am
Post
by bennyboy » Tue Mar 06, 2018 9:25 pm
DoubleDoubleA wrote: Actually, I think that chaining modular playbooks together with import / include in a master playbook will be the way to address that.
http://docs.ansible.com/ansible/latest/ ... reuse.html
The last one in the chain would be an apply config playbook like
Code: Select all
---
- name: apply configs
hosts: all
connection: ssh
gather_facts: True
remote_user: root
tasks:
- uri:
url: http://{{ xi_ip }}/nagiosxi/api/v1/config/host?apikey={{ xi_api_key }}
body: "force=1&applyconfig=1"
You have to pass the information about the host you want to add in Nagios XI. I suggest you to not use applyconfig=1 and separate it like I do, to be able to runit at once instead of each time you want to add a host in Nagios XI. I also use delegate_to to force ansible to run that command from a specific server instead of all the server.
Last edited by
bennyboy on Wed Mar 07, 2018 1:28 pm, edited 1 time in total.