ansible/roles/prometheus/tasks/main.yml

54 lines
1.1 KiB
YAML

---
- name: Install Prometheus Components
apt:
name:
- prometheus
- prometheus-alertmanager
- prometheus-pushgateway
state: latest
update_cache: true
register: apt_result
retries: 3
until: apt_result is succeeded
- name: Ensure the alert folder exist
file:
path: /etc/prometheus/alerts
state: directory
group: prometheus
owner: prometheus
mode: u=rwx,g=rx,o=rx
- name: Setup the prometheus config
template:
src: prometheus.yml
dest: /etc/prometheus/prometheus.yml
owner: prometheus
group: prometheus
mode: '0640'
notify: Restart prometheus
no_log: true
- name: Add node targets file
template:
src: node-targets.json
dest: /etc/prometheus/node-targets.json
owner: prometheus
group: prometheus
mode: '0640'
force: no
notify: Restart prometheus
no_log: true
- name: Setup the arguments for prometheus
template:
src: prometheus
dest: /etc/default/prometheus
owner: root
group: root
mode: '0644'
notify: Restart prometheus
vars:
args:
- name: web.listen-address
value: "{{ lan_address }}:9090"