-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2 from blalop/features/1
#1 Pi-Hole Exporter
- Loading branch information
Showing
12 changed files
with
200 additions
and
33 deletions.
There are no files selected for viewing
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
--- | ||
|
||
pihole_exporter_private_tmp: no | ||
pihole_exporter_arch: linux-amd64 |
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
--- | ||
|
||
service: | ||
pihole_exporter: | ||
enabled: true | ||
running: true | ||
|
||
http: | ||
http://localhost:9617/metrics: | ||
status: 200 | ||
body: | ||
- pihole_status{hostname="127.0.0.1"} 1 | ||
|
||
file: | ||
/usr/bin/pihole_exporter: | ||
exists: true | ||
owner: root | ||
group: root | ||
filetype: symlink | ||
/opt/pihole_exporter: | ||
exists: true | ||
owner: pihole_exporter | ||
group: pihole_exporter | ||
filetype: directory |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
--- | ||
|
||
- name: Pi-hole Exporter | Ensure pihole_exporter group | ||
group: | ||
name: "{{ pihole_exporter_group }}" | ||
system: yes | ||
state: present | ||
|
||
- name: Pi-hole Exporter | Ensure pihole_exporter user | ||
user: | ||
name: "{{ pihole_exporter_user }}" | ||
group: "{{ pihole_exporter_group }}" | ||
system: yes | ||
shell: /usr/sbin/nologin | ||
createhome: no | ||
|
||
- name: Pi-hole Exporter | Ensure skeleton paths | ||
file: | ||
dest: "{{ item }}" | ||
owner: "{{ pihole_exporter_user }}" | ||
group: "{{ pihole_exporter_group }}" | ||
state: directory | ||
with_items: | ||
- "{{ pihole_exporter_skeleton_paths }}" | ||
|
||
- name: Pi-hole Exporter | Check pihole_exporter version | ||
command: pihole_exporter --help | ||
register: pihole_exporter_check | ||
changed_when: false | ||
ignore_errors: true | ||
|
||
- name: Pi-hole Exporter | Download package | ||
get_url: | ||
url: "{{ pihole_exporter_url }}" | ||
dest: "{{ pihole_exporter_bin_path }}/{{ pihole_exporter_exec_name }}-{{ pihole_exporter_version }}" | ||
owner: "{{ pihole_exporter_user }}" | ||
group: "{{ pihole_exporter_group }}" | ||
mode: "0755" | ||
when: pihole_exporter_force_reinstall or pihole_exporter_check is failed | ||
|
||
- name: Pi-hole Exporter | Create symbolic link | ||
file: | ||
src: "{{ pihole_exporter_bin_path }}/{{ pihole_exporter_exec_name }}-{{ pihole_exporter_version }}" | ||
dest: /usr/bin/pihole_exporter | ||
state: link | ||
when: pihole_exporter_force_reinstall or pihole_exporter_check is failed |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
--- | ||
|
||
- name: Pi-hole Exporter | Copy Daemon script | ||
template: | ||
src: pihole_exporter.service.j2 | ||
dest: /etc/systemd/system/pihole_exporter.service | ||
mode: 0644 | ||
owner: root | ||
group: root | ||
notify: restart pihole_exporter | ||
|
||
- name: Pi-hole Exporter | Configuring service | ||
systemd: | ||
name: pihole_exporter | ||
state: "{{ pihole_exporter_state }}" | ||
enabled: "{{ pihole_exporter_enabled }}" | ||
daemon_reload: yes |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
{{ ansible_managed | comment }} | ||
[Unit] | ||
Description=pihole_exporter | ||
Documentation={{ pihole_exporter_documentation_link }} | ||
Requires=network-online.target | ||
After=network-online.target | ||
|
||
[Service] | ||
PrivateTmp={{ pihole_exporter_private_tmp }} | ||
User={{ pihole_exporter_user }} | ||
Group={{ pihole_exporter_group }} | ||
RuntimeDirectory=pihole_exporter | ||
LimitNOFILE={{ pihole_exporter_max_files }} | ||
|
||
|
||
ExecStart={{ pihole_exporter_exec_name }} {% for option in pihole_exporter_options %}-{{ option }} {% endfor %} | ||
|
||
StandardOutput={{ pihole_exporter_log_output }} | ||
StandardError={{ pihole_exporter_log_output }} | ||
ExecReload=/bin/kill -HUP $MAINPID | ||
KillSignal=SIGTERM | ||
Restart=always | ||
|
||
[Install] | ||
WantedBy=multi-user.target |