I have the following task
- name: Load sensu checks
sensu_check: name={{ item.key }}
command="{{ item.value.command }}"
handlers={{ item.value.handlers }}
subscribers={{ item.value.subscribers }}
interval={{ item.value.interval }}
with_dict: "{{ sensu_checks }}"
notify:
- restart sensu server
My handler looks like
- name: restart sensu server
service: name=sensu-{{ item }} state=restarted
with_items:
- server
- api
If I remove the file to try to restart sensu my output from a -v looks like
TASK [sensu : Load sensu checks] ***********************************************
changed: [localhost] => (item={'value': {u'interval': 30, u'command': u'/etc/sensu/plugins/check-kube-apiserver-available.rb -s http://10.33.3.10:8080', u'subscribers': u'monitor', u'handlers': u'slack'}, 'key': u'check_kube_apiserver'}) => {"changed": true, "gid": 0, "group": "root", "item": {"key": "check_kube_apiserver", "value": {"command": "/etc/sensu/plugins/check-kube-apiserver-available.rb -s http://10.33.3.10:8080", "handlers": "slack", "interval": 30, "subscribers": "monitor"}}, "mode": "0644", "msg": "OK", "name": "check_kube_apiserver", "owner": "root", "path": "/etc/sensu/conf.d/checks.json", "reasons": ["`checks' section did not exist", "check was absent and state is `present'", "`command' did not exist or was different", "`handlers' did not exist or was different", "`subscribers' did not exist or was different", "`interval' did not exist or was different"], "size": 276, "state": "file", "uid": 0}
changed: [localhost] => (item={'value': {u'interval': 30, u'command': u'/etc/sensu/plugins/check-kube-pods-pending.rb -s http://10.33.3.10:8080', u'subscribers': u'monitor', u'handlers': u'slack'}, 'key': u'check_kube_pods'}) => {"changed": true, "gid": 0, "group": "root", "item": {"key": "check_kube_pods", "value": {"command": "/etc/sensu/plugins/check-kube-pods-pending.rb -s http://10.33.3.10:8080", "handlers": "slack", "interval": 30, "subscribers": "monitor"}}, "mode": "0644", "msg": "OK", "name": "check_kube_pods", "owner": "root", "path": "/etc/sensu/conf.d/checks.json", "reasons": ["check was absent and state is `present'", "`command' did not exist or was different", "`handlers' did not exist or was different", "`subscribers' did not exist or was different", "`interval' did not exist or was different"], "size": 520, "state": "file", "uid": 0}
changed: [localhost] => (item={'value': {u'interval': 30, u'command': u'/etc/sensu/plugins/check-ports.rb -p 22', u'subscribers': u'all', u'handlers': u'slack'}, 'key': u'check_ssh'}) => {"changed": true, "gid": 0, "group": "root", "item": {"key": "check_ssh", "value": {"command": "/etc/sensu/plugins/check-ports.rb -p 22", "handlers": "slack", "interval": 30, "subscribers": "all"}}, "mode": "0644", "msg": "OK", "name": "check_ssh", "owner": "root", "path": "/etc/sensu/conf.d/checks.json", "reasons": ["check was absent and state is `present'", "`command' did not exist or was different", "`handlers' did not exist or was different", "`subscribers' did not exist or was different", "`interval' did not exist or was different"], "size": 723, "state": "file", "uid": 0}
changed: [localhost] => (item={'value': {u'interval': 30, u'command': u'/etc/sensu/plugins/check-kube-nodes-ready.rb -s http://10.33.3.10:8080', u'subscribers': u'monitor', u'handlers': u'slack'}, 'key': u'check_kube_nodes'}) => {"changed": true, "gid": 0, "group": "root", "item": {"key": "check_kube_nodes", "value": {"command": "/etc/sensu/plugins/check-kube-nodes-ready.rb -s http://10.33.3.10:8080", "handlers": "slack", "interval": 30, "subscribers": "monitor"}}, "mode": "0644", "msg": "OK", "name": "check_kube_nodes", "owner": "root", "path": "/etc/sensu/conf.d/checks.json", "reasons": ["check was absent and state is `present'", "`command' did not exist or was different", "`handlers' did not exist or was different", "`subscribers' did not exist or was different", "`interval' did not exist or was different"], "size": 967, "state": "file", "uid": 0}
changed: [localhost] => (item={'value': {u'interval': 30, u'command': u'/etc/sensu/plugins/check-ntp.rb -c 5000 -w 2000', u'subscribers': u'all', u'handlers': u'slack'}, 'key': u'check_ntp'}) => {"changed": true, "gid": 0, "group": "root", "item": {"key": "check_ntp", "value": {"command": "/etc/sensu/plugins/check-ntp.rb -c 5000 -w 2000", "handlers": "slack", "interval": 30, "subscribers": "all"}}, "mode": "0644", "msg": "OK", "name": "check_ntp", "owner": "root", "path": "/etc/sensu/conf.d/checks.json", "reasons": ["check was absent and state is `present'", "`command' did not exist or was different", "`handlers' did not exist or was different", "`subscribers' did not exist or was different", "`interval' did not exist or was different"], "size": 1178, "state": "file", "uid": 0}
The sensu-server is never restarted.. I can restart it just fine via command line.
- - , .
برچسب:
نویسنده: استخدام کار