I re-read your ansible config and I must have looked at it 10 times and COMPLETELY MISSED the command vs contact! That was the issue!
Looks like it works well now!
Now that it is working I have 2 related followup questions if you could assist.
1. the documentation shows adding a user looking like this:
Code: Select all
- name: Add sns_critical user to OnShoreITNotificationGroup contact group in Nagios XI
uri:
url: http://{{ ansible_host }}/nagiosxi/api/v1/config/contactgroup/testcontactgroup?apikey={{ NagiosAPIKey }}&pretty=1&contactgroup_name=OnshoreITNotificationGroup&members=sns_critical
method: PUT
validate_certs: no
timeout: 30Code: Select all
- name: Add sns_critical user to OnShoreITNotificationGroup contact group in Nagios XI
uri:
url: http://{{ ansible_host }}/nagiosxi/api/v1/config/contactgroup/testcontactgroup?apikey={{ NagiosAPIKey }}&pretty=1
body: contactgroup_name=OnshoreITNotificationGroup&members=sns_critical
method: PUT
validate_certs: no
timeout: 302. Is there a way to check to see if the API call was successful and update to "changed" if I see a "success" to the API call? Unless it totally bombs, I am not sure if it worked or not unless I check it in the GUI. I was hoping you may have an example.
Thanks!