1
0
Fork 0
mirror of https://github.com/mdlayher/homelab.git synced 2024-12-14 11:47:32 +00:00

hdhomerun_exporter: initial commit

This commit is contained in:
Matt Layher 2017-09-13 13:11:53 -04:00
parent b141080006
commit 2bfad5b2f7
No known key found for this signature in database
GPG key ID: 77BFE531397EDE94
4 changed files with 91 additions and 0 deletions

View file

@ -0,0 +1,72 @@
---
- name: download and checksum hdhomerun_exporter binary
tags:
- hdhomerun_exporter
get_url:
url: "{{ hdhomerun_exporter_url }}"
dest: "/tmp/hdhomerun_exporter"
checksum: "sha256:{{ hdhomerun_exporter_sha256 }}"
- name: create hdhomerun_exporter user
tags:
- hdhomerun_exporter
user:
name: hdhomerun_exporter
shell: "/bin/false"
comment: "hdhomerun_exporter service user"
- name: check if hdhomerun_exporter service exists
tags:
- hdhomerun_exporter
stat:
path: "/etc/systemd/system/hdhomerun_exporter.service"
register: checked
- name: stop hdhomerun_exporter service if it exists
tags:
- hdhomerun_exporter
when: checked.stat.exists
service:
name: hdhomerun_exporter
state: stopped
- name: copy hdhomerun_exporter binary to /usr/local/bin
tags:
- hdhomerun_exporter
command: "cp /tmp/hdhomerun_exporter /usr/local/bin/"
- name: set permissions on hdhomerun_exporter binary
tags:
- hdhomerun_exporter
file:
path: "/usr/local/bin/hdhomerun_exporter"
owner: hdhomerun_exporter
group: hdhomerun_exporter
mode: 0755
- name: create hdhomerun_exporter systemd unit
tags:
- hdhomerun_exporter
template:
src: hdhomerun_exporter.service.j2
dest: "/etc/systemd/system/hdhomerun_exporter.service"
- name: reload systemd configurations
tags:
- hdhomerun_exporter
command: "systemctl daemon-reload"
- name: start hdhomerun_exporter service
tags:
- hdhomerun_exporter
service:
name: hdhomerun_exporter
state: started
enabled: yes
- name: remove temporary files
tags:
- hdhomerun_exporter
file:
path: "/tmp/hdhomerun_exporter"
state: absent

View file

@ -0,0 +1,15 @@
# {{ ansible_managed }}
[Unit]
Description=Prometheus hdhomerun exporter
Documentation=https://github.com/mdlayher/hdhomerun_exporter
Wants=network-online.target
After=network-online.target hdhomerun.service
[Service]
User=hdhomerun_exporter
Group=hdhomerun_exporter
Type=simple
ExecStart=/usr/local/bin/hdhomerun_exporter
[Install]
WantedBy=multi-user.target

View file

@ -0,0 +1,3 @@
---
hdhomerun_exporter_url: "https://mdlayher.nyc3.digitaloceanspaces.com/bin/hdhomerun_exporter"
hdhomerun_exporter_sha256: "29dd7e5a27b038272aa33da38770aa1eafd68de6b94692830deacb038c64703d"

View file

@ -9,6 +9,7 @@
- apcupsd_exporter
- golang
- grafana
- hdhomerun_exporter
- kvm
- mpd
- mpdsubd