Created
December 10, 2014 10:50
-
-
Save micw/b323a67a8dc522218bb8 to your computer and use it in GitHub Desktop.
Ansible: shinken-setup
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- hosts: default | |
vars: | |
- NSCA_PASSWORD: topsecret | |
handlers: | |
- name: Restart shinken | |
service: name=shinken state=restarted | |
tasks: | |
- apt_repository: repo='deb http://http.debian.net/debian wheezy-backports main contrib' state=present update_cache=yes | |
- apt: name=python-pip | |
- apt: name=python-pycurl | |
- apt: name=python-cherrypy3 | |
- user: name=shinken home=/var/lib/shinken createhome=yes system=yes | |
# GIT-Version (HEAD) | |
- apt: name=git | |
- git: repo=https://github.com/naparuba/shinken.git dest=/usr/src/shinken | |
- shell: cd /usr/src/shinken; python setup.py install | |
creates=/usr/bin/shinken | |
# Release-Version | |
# - command: /usr/bin/pip install shinken | |
# creates=/usr/bin/shinken | |
- command: /usr/bin/shinken --init | |
creates=/root/.shinken.ini | |
- command: /usr/bin/shinken install {{ item }} | |
creates=/var/lib/shinken/modules/{{ item }} | |
with_items: | |
- webui | |
- auth-htpasswd | |
- auth-cfg-password | |
- nsca | |
- apt: name=python-passlib | |
- htpasswd: path=/etc/shinken/htpasswd.users name=admin password=test | |
- apt: name=monitoring-plugins | |
- apt: name=sendxmpp | |
- copy: src=sendxmpprc dest=/var/lib/shinken/.sendxmpprc owner=shinken group=shinken mode=0600 | |
- copy: src=sendxmpprc dest=/root/.sendxmpprc owner=root group=root mode=0600 | |
- copy: src=notify_xmpp.sh dest=/usr/lib/nagios/plugins/notify_xmpp owner=root group=root mode=0755 | |
# webui settings | |
- lineinfile: name=/etc/shinken/brokers/broker-master.cfg regexp="^\s*modules" line=" modules webui" | |
notify: Restart shinken | |
- lineinfile: name=/etc/shinken/modules/webui.cfg regexp="^\s*modules" line=" modules auth-cfg-password" | |
notify: Restart shinken | |
# receiver settings | |
- lineinfile: name=/etc/shinken/receivers/receiver-master.cfg regexp="^\s*modules" line=" modules nsca" | |
notify: Restart shinken | |
- lineinfile: name=/etc/shinken/modules/nsca.cfg regexp="^\s*password" line=" password {{ NSCA_PASSWORD|default('changeme') }}" | |
notify: Restart shinken | |
# nsca-sender | |
- apt: name=nsca-client | |
- lineinfile: name=/etc/send_nsca.cfg regexp="^#?password=" line="password={{ NSCA_PASSWORD|default('changeme') }}" | |
- lineinfile: name=/etc/send_nsca.cfg regexp="^#?encryption_method=" line="encryption_method=1" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment