mirror of
https://github.com/prometheus-community/ansible
synced 2024-12-03 17:19:26 +00:00
39213cfd13
Signed-off-by: gardar <gardar@users.noreply.github.com>
68 lines
1.9 KiB
YAML
68 lines
1.9 KiB
YAML
---
|
|
- name: Alerting rules file
|
|
ansible.builtin.template:
|
|
src: "alert.rules.j2"
|
|
dest: "{{ prometheus_config_dir }}/rules/ansible_managed.rules"
|
|
owner: root
|
|
group: prometheus
|
|
mode: 0640
|
|
validate: "{{ _prometheus_binary_install_dir }}/promtool check rules %s"
|
|
when:
|
|
- prometheus_alert_rules != []
|
|
notify:
|
|
- reload prometheus
|
|
|
|
- name: Copy custom alerting rule files
|
|
ansible.builtin.copy:
|
|
src: "{{ item }}"
|
|
dest: "{{ prometheus_config_dir }}/rules/"
|
|
owner: root
|
|
group: prometheus
|
|
mode: 0640
|
|
validate: "{{ _prometheus_binary_install_dir }}/promtool check rules %s"
|
|
with_fileglob: "{{ prometheus_alert_rules_files }}"
|
|
notify:
|
|
- reload prometheus
|
|
|
|
- name: Configure prometheus
|
|
ansible.builtin.template:
|
|
src: "{{ prometheus_config_file }}"
|
|
dest: "{{ prometheus_config_dir }}/prometheus.yml"
|
|
force: true
|
|
owner: root
|
|
group: prometheus
|
|
mode: 0640
|
|
validate: "{{ _prometheus_binary_install_dir }}/promtool check config %s"
|
|
notify:
|
|
- reload prometheus
|
|
|
|
- name: Configure Prometheus web
|
|
ansible.builtin.copy:
|
|
content: "{{ prometheus_web_config | to_nice_yaml(indent=2, sort_keys=False) }}"
|
|
dest: "{{ prometheus_config_dir }}/web.yml"
|
|
force: true
|
|
owner: root
|
|
group: prometheus
|
|
mode: 0640
|
|
|
|
- name: Configure prometheus static targets
|
|
ansible.builtin.copy:
|
|
content: |
|
|
{{ item.value | to_nice_yaml(indent=2, sort_keys=False) }}
|
|
dest: "{{ prometheus_config_dir }}/file_sd/{{ item.key }}.yml"
|
|
force: true
|
|
owner: root
|
|
group: prometheus
|
|
mode: 0640
|
|
with_dict: "{{ prometheus_targets }}"
|
|
when: prometheus_targets != {}
|
|
|
|
- name: Copy prometheus custom static targets
|
|
ansible.builtin.copy:
|
|
src: "{{ item }}"
|
|
dest: "{{ prometheus_config_dir }}/file_sd/"
|
|
force: true
|
|
owner: root
|
|
group: prometheus
|
|
mode: 0640
|
|
with_fileglob: "{{ prometheus_static_targets_files }}"
|