aboutsummaryrefslogtreecommitdiff
path: root/roles/services/monitoring/prometheus/nginx_exporter/tasks
diff options
context:
space:
mode:
Diffstat (limited to 'roles/services/monitoring/prometheus/nginx_exporter/tasks')
-rw-r--r--roles/services/monitoring/prometheus/nginx_exporter/tasks/main.yml44
1 files changed, 44 insertions, 0 deletions
diff --git a/roles/services/monitoring/prometheus/nginx_exporter/tasks/main.yml b/roles/services/monitoring/prometheus/nginx_exporter/tasks/main.yml
new file mode 100644
index 0000000..819f71e
--- /dev/null
+++ b/roles/services/monitoring/prometheus/nginx_exporter/tasks/main.yml
@@ -0,0 +1,44 @@
1- name: install package (Debian)
2 when: ansible_facts['distribution'] == "Debian"
3 package:
4 name: "{{ nginx_exporter_debian_package }}"
5
6- name: allow port
7 ufw:
8 rule: allow
9 direction: in
10 proto: tcp
11 src: "{{ prometheus_server_ip }}"
12 to_port: "{{ nginx_exporter_port }}"
13
14- name: copy defaults file
15 notify: restart nginx-exporter
16 copy:
17 src: "{{ nginx_exporter_defaults }}"
18 dest: /etc/default/prometheus-nginx-exporter
19 owner: root
20 group: root
21 mode: '0644'
22
23- name: deploy nginx configuration
24 notify: restart nginx
25 copy:
26 src: "{{ nginx_exporter_config }}"
27 dest: /etc/nginx/sites-available/metrics.conf
28 owner: root
29 group: root
30 mode: '0644'
31
32- name: symlink site
33 file:
34 src: /etc/nginx/sites-available/metrics.conf
35 dest: /etc/nginx/sites-enabled/metrics.conf
36 owner: root
37 group: root
38 state: link
39
40- name: enable service
41 systemd:
42 name: prometheus-nginx-exporter
43 enabled: yes
44 masked: no