forked from FF-RGB/ansible
fast-exporter: export fastd statistics
This commit is contained in:
parent
f40a674a0d
commit
bc1fadd083
4
roles/fastd-exporter/defaults/main.yml
Normal file
4
roles/fastd-exporter/defaults/main.yml
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
---
|
||||||
|
|
||||||
|
fastd_instances: 3
|
||||||
|
fastd_exporter_source: "github.com/freifunk-darmstadt/fastd-exporter"
|
12
roles/fastd-exporter/files/fastd-exporter.service
Normal file
12
roles/fastd-exporter/files/fastd-exporter.service
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
[Unit]
|
||||||
|
Description=fastd Exporter
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
Type=simple
|
||||||
|
User=fastd-exporter
|
||||||
|
Environment=PATH=/usr/bin:/usr/local/bin
|
||||||
|
EnvironmentFile=/etc/default/fastd-exporter
|
||||||
|
ExecStart=/opt/go/bin/fastd-exporter $OPTIONS
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=multi-user.target
|
7
roles/fastd-exporter/handlers/main.yml
Normal file
7
roles/fastd-exporter/handlers/main.yml
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
---
|
||||||
|
|
||||||
|
- name: Restart fastd-exporter
|
||||||
|
service: name=fastd-exporter state=restarted
|
||||||
|
|
||||||
|
- name: Reload systemd
|
||||||
|
command: systemctl daemon-reload
|
25
roles/fastd-exporter/tasks/main.yml
Normal file
25
roles/fastd-exporter/tasks/main.yml
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
---
|
||||||
|
|
||||||
|
- name: Create user
|
||||||
|
user: name=fastd-exporter
|
||||||
|
|
||||||
|
- name: Install fastd-exporter
|
||||||
|
shell: /usr/local/go/bin/go get -v -u {{ fastd_exporter_source }}
|
||||||
|
args:
|
||||||
|
creates: /opt/go/bin/fastd-exporter
|
||||||
|
environment:
|
||||||
|
GOPATH: /opt/go
|
||||||
|
notify: Restart fastd-exporter
|
||||||
|
|
||||||
|
- name: Configure fastd-exporter
|
||||||
|
template: src=fastd-exporter.j2 dest=/etc/default/fastd-exporter
|
||||||
|
notify: Restart fastd-exporter
|
||||||
|
|
||||||
|
- name: Install systemd unit
|
||||||
|
copy: src=fastd-exporter.service dest=/lib/systemd/system/fastd-exporter.service
|
||||||
|
notify:
|
||||||
|
- Reload systemd
|
||||||
|
- Restart fastd-exporter
|
||||||
|
|
||||||
|
- name: Enable fastd-exporter
|
||||||
|
service: name=fastd-exporter state=started enabled=yes
|
1
roles/fastd-exporter/templates/fastd-exporter.j2
Normal file
1
roles/fastd-exporter/templates/fastd-exporter.j2
Normal file
@ -0,0 +1 @@
|
|||||||
|
OPTIONS="-metrics.perpeer -instances {{ site_code }}{{ range(fastd_instances)|join(',' + site_code) }}"
|
Loading…
Reference in New Issue
Block a user