'Figure out what you want to do from ansible, and then do the
needful (at the earliest).'

def act(self):

    if (self.action == 'downtime'):
        if (self.services == 'host'):
            self.schedule_host_downtime(self.host, self.minutes)
        elif (self.services == 'all'):
            self.schedule_host_svc_downtime(self.host, self.minutes)
        else:
            self.schedule_svc_downtime(self.host, services=self.services, minutes=self.minutes)
    elif (self.action == 'delete_downtime'):
        if (self.services == 'host'):
            self.delete_host_downtime(self.host)
        elif (self.services == 'all'):
            self.delete_host_downtime(self.host, comment='')
        else:
            self.delete_host_downtime(self.host, services=self.services)
    elif (self.action == 'servicegroup_host_downtime'):
        if self.servicegroup:
            self.schedule_servicegroup_host_downtime(servicegroup=self.servicegroup, minutes=self.minutes)
    elif (self.action == 'servicegroup_service_downtime'):
        if self.servicegroup:
            self.schedule_servicegroup_svc_downtime(servicegroup=self.servicegroup, minutes=self.minutes)
    elif (self.action == 'silence'):
        self.silence_host(self.host)
    elif (self.action == 'unsilence'):
        self.unsilence_host(self.host)
    elif (self.action == 'enable_alerts'):
        if (self.services == 'host'):
            self.enable_host_notifications(self.host)
        elif (self.services == 'all'):
            self.enable_host_svc_notifications(self.host)
        else:
            self.enable_svc_notifications(self.host, services=self.services)
    elif (self.action == 'disable_alerts'):
        if (self.services == 'host'):
            self.disable_host_notifications(self.host)
        elif (self.services == 'all'):
            self.disable_host_svc_notifications(self.host)
        else:
            self.disable_svc_notifications(self.host, services=self.services)
    elif (self.action == 'silence_nagios'):
        self.silence_nagios()
    elif (self.action == 'unsilence_nagios'):
        self.unsilence_nagios()
    elif (self.action == 'command'):
        self.nagios_cmd(self.command)
    else:
        self.module.fail_json(msg=("unknown    action    specified:    '%s'" % self.action))
    self.module.exit_json(nagios_commands=self.command_results, changed=True)
