34 lines
888 B
YAML
34 lines
888 B
YAML
|
---
|
||
|
- name: Install prometheus-nginx-exporter
|
||
|
apt:
|
||
|
update_cache: true
|
||
|
name:
|
||
|
- nginx # Nginx may be not already installed
|
||
|
- prometheus-nginx-exporter
|
||
|
register: apt_result
|
||
|
retries: 3
|
||
|
until: apt_result is succeeded
|
||
|
|
||
|
- name: Make prometheus-nginx-exporter listen on adm only
|
||
|
lineinfile:
|
||
|
path: /etc/default/prometheus-nginx-exporter
|
||
|
regexp: '^ARGS='
|
||
|
line: |
|
||
|
ARGS="-web.listen-address={{ prometheus_nginx_exporter.listen_addr }}:9117 -nginx.scrape-uri=http://[::1]:6424/stub_status"
|
||
|
notify:
|
||
|
- Restart nginx
|
||
|
- Restart prometheus-nginx-exporter
|
||
|
|
||
|
- name: Configure nginx
|
||
|
template:
|
||
|
src: nginx/status.j2
|
||
|
dest: /etc/nginx/sites-available/status
|
||
|
notify: Restart nginx
|
||
|
|
||
|
- name: Activate nginx site
|
||
|
file:
|
||
|
src: /etc/nginx/sites-available/status
|
||
|
dest: /etc/nginx/sites-enabled/status
|
||
|
state: link
|
||
|
notify: Restart nginx
|