summaryrefslogtreecommitdiff
path: root/roles/install_monitoring/tasks
diff options
context:
space:
mode:
authorNiklas Yann Wettengel <niyawe@niyawe.de>2017-03-18 18:38:46 +0100
committerNiklas Yann Wettengel <niyawe@niyawe.de>2017-03-18 18:38:46 +0100
commitcd31d75443119be6580e91d5a9a3ab7742f875ab (patch)
tree0d12fe52bbb796969336dae613e66ca5f433aba4 /roles/install_monitoring/tasks
parent710a210ae6f165c2e3ce165d30d27f189311656b (diff)
updated setup_fastd.yml
added features: - fastd-services-api - install_nginx - install_monitoring
Diffstat (limited to 'roles/install_monitoring/tasks')
-rw-r--r--roles/install_monitoring/tasks/main.yml124
1 files changed, 124 insertions, 0 deletions
diff --git a/roles/install_monitoring/tasks/main.yml b/roles/install_monitoring/tasks/main.yml
new file mode 100644
index 0000000..5ca468d
--- /dev/null
+++ b/roles/install_monitoring/tasks/main.yml
@@ -0,0 +1,124 @@
+---
+- name: install vnstat
+ pacman:
+ name: vnstat
+ state: present
+
+- name: start and enable vnstat service
+ systemd:
+ name: vnstat.service
+ enabled: yes
+ state: started
+
+- name: add interfaces to vnstat
+ command: /usr/bin/vnstat -u -i {{ item }}
+ args:
+ creates: '/var/lib/vnstat/{{ item }}'
+ with_items:
+ - bat0
+ - ens3
+ - ffmyk-mesh-vpn
+ - mullvad
+
+- name: add output folder for vnstat graphs
+ file:
+ path: /srv/http/vnstat
+ state: directory
+
+- name: add bash script to generate vnstat graphs
+ copy:
+ src: vnstat.sh
+ dest: /usr/local/bin/vnstat.sh
+ mode: 0744
+
+- name: add cronjob to generate vnstat graphs
+ cron:
+ name: vnstat
+ minute: '*/5'
+ user: root
+ cron_file: fastd-api
+ job: '/usr/local/bin/vnstat.sh'
+
+- name: add vnstat nginx config
+ copy:
+ src: vnstat
+ dest: /etc/nginx/sites-available/vnstat
+ register: nginx_config
+
+- name: enable vnstat nginx config
+ file:
+ src: /etc/nginx/sites-available/vnstat
+ dest: /etc/nginx/sites-enabled/vnstat
+ state: link
+
+- name: reload nginx
+ when: nginx_config.changed
+ systemd:
+ name: nginx.service
+ state: reloaded
+
+- name: add bash script to check internet
+ copy:
+ src: check_internet.sh
+ dest: /usr/local/bin/check_internet.sh
+ mode: 0744
+
+- name: add cronjob to check internet
+ cron:
+ name: check_internet
+ user: root
+ cron_file: fastd-api
+ job: '/usr/local/bin/check_internet.sh'
+
+- name: install munin
+ pacman:
+ name: munin-node
+ state: present
+
+- name: copy munin-node config
+ template:
+ src: munin-node.conf.j2
+ dest: /etc/munin/munin-node.conf
+
+- name: copy fastd plugin
+ copy:
+ src: munin_fastd_plugin
+ dest: /usr/lib/munin/plugins/fastd_
+
+- name: copy dhcp-pool plugin
+ copy:
+ src: munin_dhcp_pool_plugin
+ dest: /usr/lib/munin/plugins/dhcp-pool
+
+- name: copy fastd plugin config
+ copy:
+ src: munin_fastd_conf
+ dest: /etc/munin/plugin-conf.d/fastd
+
+- name: copy global config
+ copy:
+ src: munin_global_conf
+ dest: /etc/munin/plugin-conf.d/global
+
+- name: install netstat
+ pacman:
+ name: net-tools
+ state: present
+
+- name: install perl-lwp-protocol-https
+ pacman:
+ name: perl-lwp-protocol-https
+ state: present
+
+- name: enable munin plugins
+ file:
+ path: /etc/munin/plugins/{{ item.name }}
+ src: /usr/lib/munin/plugins/{{ item.plugin | default( item.name ) }}
+ state: link
+ with_items: "{{ munin_node_plugins }}"
+
+- name: start and enable munin-node
+ systemd:
+ name: munin-node.service
+ enabled: yes
+ state: started