Here's what i do.

    - name: Schedule Nagios downtime
      nagios: action=downtime minutes=20 service="{{ item }}"
              host="{{ inventory_hostname }}" author="Ansible Bot"
              comment="Planned maintenance"
      delegate_to: "{{ nagios_server }}"
      with_items:
        - host
        - all

I have {{nagios_server}} set to the name of the server that runs Nagios. 
Make sure you use {{inventory_hostname}}; in your post you wrote 
{{inventor_hostname}}, which is most likely not defined and won't work.


On Thursday, April 25, 2019 at 1:51:36 PM UTC-5, Douglas Thompson wrote:
>
> Hello,
>
> I'm trying to the Ansible nagios module to schedule downtime. In the 
> documentation it says for 'host' to use '{{ inventor_hostname }}'. I'm 
> assuming this is an internal variable that gets the host name from the 
> inventory file. This is not working. Not only that but we only have one 
> nagios server, which is where the commands apparently need to be executed 
> in order to schedule the downtime.
>
> So, my question is: how do you setup the playbook to execute on the nagios 
> server but use the hosts listed in the inventory file to schedule the 
> downtime? As of right now the only way I've been able to do this is to 
> create an extra-vars files and populate that with the hosts names, but this 
> becomes cumbersome.
> Any thoughts?
> Thank you,
>

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/e8b19f87-87fe-4ee5-a540-d7cddca61b15%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to