unifi: Deploy unifi_exporter
`unifi_exporter` provides Prometheus metrics for UniFi controller.
This commit is contained in:
58
roles/unifi/tasks/exporter.yml
Normal file
58
roles/unifi/tasks/exporter.yml
Normal file
@@ -0,0 +1,58 @@
|
||||
- name: ensure unifi_exporter is configured
|
||||
copy:
|
||||
dest: /etc/unifi_exporter.yml
|
||||
content: >-
|
||||
{{ unifi_exporter_config | to_nice_yaml(indent=2) }}
|
||||
mode: u=rw,g=r,o=
|
||||
owner: root
|
||||
group: 200
|
||||
notify:
|
||||
- restart unifi_exporter
|
||||
tags:
|
||||
- config
|
||||
|
||||
- name: ensure unifi_exporter container is configured
|
||||
template:
|
||||
src: unifi_exporter.container.j2
|
||||
dest: /etc/containers/systemd/unifi_exporter.container
|
||||
mode: u=rw,go=r
|
||||
owner: root
|
||||
group: root
|
||||
notify:
|
||||
- reload systemd
|
||||
- restart unifi_exporter
|
||||
tags:
|
||||
- container
|
||||
|
||||
- name: ensure unifi_exporter container image is present
|
||||
podman_image:
|
||||
name: '{{ unifi_exporter_container_image }}:{{ unifi_exporter_version }}'
|
||||
state: present
|
||||
tags:
|
||||
- container
|
||||
|
||||
- name: flush handlers
|
||||
meta: flush_handlers
|
||||
|
||||
- name: ensure unifi_exporter service is enabled
|
||||
systemd:
|
||||
name: unifi_exporter
|
||||
enabled: true
|
||||
tags:
|
||||
- service
|
||||
- name: ensure unifi_exporter service is running
|
||||
systemd:
|
||||
name: unifi_exporter
|
||||
state: started
|
||||
tags:
|
||||
- service
|
||||
|
||||
- name: ensure firewall is configured for unifi_exporter
|
||||
firewalld:
|
||||
port: 9130/tcp
|
||||
state: enabled
|
||||
permanent: true
|
||||
immediate: true
|
||||
when: host_uses_firewalld|d(true)
|
||||
tags:
|
||||
- firewalld
|
||||
Reference in New Issue
Block a user