Automated changes from linter ;P
This commit is contained in:
parent
44b73a216f
commit
f7f04e7a41
65 changed files with 392 additions and 324 deletions
|
@ -1,17 +1,18 @@
|
|||
---
|
||||
- import_tasks: ../../common/handlers/main.yaml
|
||||
- ansible.builtin.import_tasks:
|
||||
file: ../../common/handlers/main.yaml
|
||||
|
||||
- name: restart mqtt_exporter
|
||||
systemd:
|
||||
ansible.builtin.systemd:
|
||||
name: mqtt_exporter
|
||||
state: restarted
|
||||
|
||||
- name: restart prometheus
|
||||
systemd:
|
||||
ansible.builtin.systemd:
|
||||
name: prometheus
|
||||
state: restarted
|
||||
|
||||
- name: restart grafana
|
||||
systemd:
|
||||
ansible.builtin.systemd:
|
||||
name: grafana-server
|
||||
state: restarted
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
---
|
||||
- name: Install blackbox exporter
|
||||
apt:
|
||||
ansible.builtin.apt:
|
||||
name: prometheus-blackbox-exporter
|
||||
|
|
|
@ -1,24 +1,24 @@
|
|||
---
|
||||
- name: Add key
|
||||
get_url:
|
||||
ansible.builtin.get_url:
|
||||
url: https://apt.grafana.com/gpg.key
|
||||
dest: /etc/apt/keyrings/grafana.asc
|
||||
notify: apt update
|
||||
|
||||
- name: Grafana source
|
||||
copy:
|
||||
ansible.builtin.copy:
|
||||
dest: /etc/apt/sources.list.d/grafana.list
|
||||
content: "deb [signed-by=/etc/apt/keyrings/grafana.asc] https://apt.grafana.com stable main"
|
||||
notify: apt update
|
||||
|
||||
- meta: flush_handlers
|
||||
- ansible.builtin.meta: flush_handlers
|
||||
|
||||
- name: Install Grafana
|
||||
apt:
|
||||
ansible.builtin.apt:
|
||||
name: grafana
|
||||
|
||||
- name: Configure grafana
|
||||
template:
|
||||
ansible.builtin.template:
|
||||
src: "{{ item.src }}"
|
||||
dest: "{{ item.dest }}"
|
||||
owner: root
|
||||
|
@ -30,7 +30,7 @@
|
|||
- { src: grafana-ldap.toml, dest: /etc/grafana/ldap.toml }
|
||||
|
||||
- name: Configure grafana data source
|
||||
template:
|
||||
ansible.builtin.template:
|
||||
src: grafana-data-source.yml
|
||||
dest: "/etc/grafana/provisioning/datasources/{{ item.name | lower }}.yaml"
|
||||
owner: root
|
||||
|
|
|
@ -2,10 +2,11 @@
|
|||
- name: monitoring
|
||||
tags: monitoring
|
||||
block:
|
||||
- import_tasks: ../../../snippets/common-nginx.yaml
|
||||
- ansible.builtin.import_tasks:
|
||||
file: ../../../snippets/common-nginx.yaml
|
||||
|
||||
- name: Install nginx site
|
||||
template:
|
||||
ansible.builtin.template:
|
||||
src: nginx-site.conf
|
||||
dest: /etc/nginx/sites-available/monitoring
|
||||
owner: root
|
||||
|
@ -14,20 +15,20 @@
|
|||
notify: reload nginx
|
||||
|
||||
- name: Enable nginx site
|
||||
file:
|
||||
ansible.builtin.file:
|
||||
src: /etc/nginx/sites-available/monitoring
|
||||
dest: /etc/nginx/sites-enabled/monitoring
|
||||
state: link
|
||||
notify: reload nginx
|
||||
|
||||
- name: Start nginx
|
||||
systemd:
|
||||
ansible.builtin.systemd:
|
||||
name: nginx
|
||||
state: started
|
||||
enabled: yes
|
||||
|
||||
- name: Allow HTTP/HTTPS
|
||||
iptables:
|
||||
ansible.builtin.iptables:
|
||||
chain: INPUT
|
||||
protocol: tcp
|
||||
destination_port: "{{ item.port }}"
|
||||
|
@ -42,16 +43,20 @@
|
|||
|
||||
- name: mqtt_exporter
|
||||
tags: mqtt_exporter
|
||||
import_tasks: mqtt_exporter.yaml
|
||||
ansible.builtin.import_tasks:
|
||||
file: mqtt_exporter.yaml
|
||||
|
||||
- name: blackbox
|
||||
tags: blackbox
|
||||
import_tasks: blackbox.yaml
|
||||
ansible.builtin.import_tasks:
|
||||
file: blackbox.yaml
|
||||
|
||||
- name: prometheus
|
||||
tags: prometheus
|
||||
import_tasks: prometheus.yaml
|
||||
ansible.builtin.import_tasks:
|
||||
file: prometheus.yaml
|
||||
|
||||
- name: grafana
|
||||
tags: grafana
|
||||
import_tasks: grafana.yaml
|
||||
ansible.builtin.import_tasks:
|
||||
file: grafana.yaml
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
---
|
||||
- name: Clone source
|
||||
git:
|
||||
ansible.builtin.git:
|
||||
repo: https://github.com/polyfloyd/mqtt-exporter.git
|
||||
version: main
|
||||
dest: /opt/mqtt_exporter
|
||||
|
@ -8,7 +8,7 @@
|
|||
notify: restart mqtt_exporter
|
||||
|
||||
- name: Install apt dependencies
|
||||
apt:
|
||||
ansible.builtin.apt:
|
||||
name:
|
||||
- python3-paho-mqtt
|
||||
- python3-prometheus-client
|
||||
|
@ -16,7 +16,7 @@
|
|||
state: present
|
||||
|
||||
- name: Install service
|
||||
template:
|
||||
ansible.builtin.template:
|
||||
src: mqtt_exporter.service
|
||||
dest: /etc/systemd/system/mqtt_exporter.service
|
||||
owner: root
|
||||
|
@ -27,7 +27,7 @@
|
|||
- restart mqtt_exporter
|
||||
|
||||
- name: Install config file
|
||||
template:
|
||||
ansible.builtin.template:
|
||||
src: mqtt_exporter_config.yaml
|
||||
dest: /etc/mqtt_exporter.yaml
|
||||
owner: root
|
||||
|
@ -37,10 +37,10 @@
|
|||
- daemon reload
|
||||
- restart mqtt_exporter
|
||||
|
||||
- meta: flush_handlers
|
||||
- ansible.builtin.meta: flush_handlers
|
||||
|
||||
- name: Start service
|
||||
systemd:
|
||||
ansible.builtin.systemd:
|
||||
name: mqtt_exporter
|
||||
state: started
|
||||
enabled: true
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
---
|
||||
- name: Install dependencies
|
||||
apt:
|
||||
ansible.builtin.apt:
|
||||
name: prometheus
|
||||
|
||||
- name: Configure Prometheus
|
||||
template:
|
||||
ansible.builtin.template:
|
||||
src: prometheus.yml
|
||||
dest: "{{ prometheus_config_dir }}/prometheus.yml"
|
||||
owner: root
|
||||
|
@ -13,7 +13,7 @@
|
|||
notify: restart prometheus
|
||||
|
||||
- name: Configure Prometheus args
|
||||
lineinfile:
|
||||
ansible.builtin.lineinfile:
|
||||
path: /etc/default/prometheus
|
||||
line: >-
|
||||
ARGS="
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue