updated integration of agent
This commit is contained in:
parent
c677a02fde
commit
588fe344f1
6 changed files with 121 additions and 13 deletions
|
|
@ -8,13 +8,20 @@
|
|||
groups: ssl-cert
|
||||
append: yes
|
||||
|
||||
- name: wrtie prometheus config
|
||||
notify: restart prometheus
|
||||
template:
|
||||
src: prometheus.j2
|
||||
dest: /etc/default/prometheus
|
||||
|
||||
- name: wrtie prometheus (base) config
|
||||
notify: regenerate prometheus config
|
||||
copy:
|
||||
owner: root
|
||||
group: root
|
||||
mode: 0644
|
||||
dest: /etc/prometheus/conf.d/prometheus.yml
|
||||
content: "{{ prometheus.config|to_nice_yaml }}"
|
||||
dest: /etc/prometheus/conf.d/prometheus.conf
|
||||
content: "{{ prometheus.config|to_nice_yaml(indent=2) }}"
|
||||
|
||||
- name: create ssl certificate folder
|
||||
file:
|
||||
|
|
@ -34,9 +41,26 @@
|
|||
loop:
|
||||
- /etc/prometheus/conf.d
|
||||
- /etc/prometheus/conf.d/scrape_configs
|
||||
- /etc/prometheus/conf.d/rule_files
|
||||
- /etc/prometheus/conf.d/alerting
|
||||
|
||||
- name: add self scrape job
|
||||
notify: regenerate prometheus config
|
||||
template:
|
||||
src: scrape_self.conf.j2
|
||||
dest: /etc/prometheus/conf.d/scrape_configs/selfscrape.conf
|
||||
|
||||
- name: add config generating script
|
||||
notify: regenerate prometheus config
|
||||
copy:
|
||||
dest: /usr/local/sbin/prometheus-generate-config.sh
|
||||
src: generate-config.sh
|
||||
mode: 0755
|
||||
owner: root
|
||||
group: root
|
||||
|
||||
- name: add cronjob to regenerate config
|
||||
cron:
|
||||
name: regenerate prometheus config
|
||||
minute: 3,18,33,48
|
||||
job: cat /etc/prometheus/conf.d/* /etc/prometheus/conf.d/scrape_configs/* 2> /dev/null > /etc/prometheus/prometheus.yml; /usr/sbin/service prometheus reload
|
||||
job: /usr/local/sbin/prometheus-generate-config.sh
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue