summaryrefslogtreecommitdiff
path: root/roles/install_monitoring/tasks/main.yml
blob: eb6b4a354e0c2ff7db5a6dcd706aa016b2f5dda6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
---
- 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: install gd which is needed for graph generation
  pacman:
      name: gd
      state: present

- 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: create ffmyk-influx folder
  file:
      path: /opt/ffmyk-influx
      state: directory

- name: copy ffmyk-influx daemon.sh
  copy:
      src: ffmyk-influx/daemon.sh
      dest: /opt/ffmyk-influx/daemon.sh
      mode: 0755

- name: copy ffmyk-influx php.ini
  copy:
      src: ffmyk-influx/php.ini
      dest: /opt/ffmyk-influx/php.ini

- name: copy ffmyk-influx systemd service
  copy:
      src: ffmyk-influx/ffmyk-influx.service
      dest: /etc/systemd/system/ffmyk-influx.service

- name: copy ffmyk-influx dhcp.php
  template:
      src: ffmyk-influx/dhcp.php.j2
      dest: /opt/ffmyk-influx/dhcp.php

- name: copy ffmyk-influx fastd.php
  template:
      src: ffmyk-influx/fastd.php.j2
      dest: /opt/ffmyk-influx/fastd.php

- name: copy ffmyk-influx func.php
  template:
      src: ffmyk-influx/func.php.j2
      dest: /opt/ffmyk-influx/func.php

- name: copy ffmyk-influx traffic.php
  template:
      src: ffmyk-influx/traffic.php.j2
      dest: /opt/ffmyk-influx/traffic.php

- name: start and enable ffmyk-influx.service
  systemd:
      name: ffmyk-influx.service
      enabled: yes
      state: started

- 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/munin_fastd_plugin
      dest: /usr/lib/munin/plugins/fastd_
      mode: 0755

- name: copy dhcp-pool plugin
  copy:
      src: munin/munin_dhcp_pool_plugin
      dest: /usr/lib/munin/plugins/dhcp-pool
      mode: 0755

- name: copy fastd plugin config
  copy:
      src: munin/munin_fastd_conf
      dest: /etc/munin/plugin-conf.d/fastd

- name: copy global config
  copy:
      src: munin/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