2021-04-29 18:53:56 +02:00
|
|
|
|
---
|
2021-05-26 18:23:12 +02:00
|
|
|
|
- name: 'prometheus | mongodb exporter | get latest release from GitHub'
|
|
|
|
|
shell: curl --silent "https://api.github.com/repos/percona/mongodb_exporter/releases/latest" | jq -r .tag_name | sed "s/v//"
|
2021-05-27 10:48:47 +02:00
|
|
|
|
args:
|
2021-05-27 10:41:33 +02:00
|
|
|
|
warn: false
|
2021-05-26 18:23:12 +02:00
|
|
|
|
register: prometheus_mongodb_exporter_version
|
|
|
|
|
run_once: true
|
2021-05-26 12:01:00 +02:00
|
|
|
|
|
2021-04-29 18:53:56 +02:00
|
|
|
|
- name: 'prometheus | mongodb exporter | download'
|
|
|
|
|
get_url:
|
2021-05-26 18:23:12 +02:00
|
|
|
|
url: https://github.com/percona/mongodb_exporter/releases/download/v{{ prometheus_mongodb_exporter_version.stdout }}/mongodb_exporter-{{ prometheus_mongodb_exporter_version.stdout }}.linux-amd64.tar.gz
|
2021-04-29 18:53:56 +02:00
|
|
|
|
dest: /tmp
|
|
|
|
|
|
|
|
|
|
- name: 'prometheus | mongodb exporter | unarchive'
|
|
|
|
|
unarchive:
|
|
|
|
|
remote_src: yes
|
2021-05-26 18:23:12 +02:00
|
|
|
|
src: /tmp/mongodb_exporter-{{ prometheus_mongodb_exporter_version.stdout }}.linux-amd64.tar.gz
|
2021-04-29 18:53:56 +02:00
|
|
|
|
dest: /tmp
|
|
|
|
|
|
|
|
|
|
- name: 'prometheus | mongodb exporter | move to /usr/local/bin'
|
|
|
|
|
copy:
|
2021-05-26 18:23:12 +02:00
|
|
|
|
src: /tmp/mongodb_exporter-{{ prometheus_mongodb_exporter_version.stdout }}.linux-amd64/mongodb_exporter
|
2021-04-29 18:53:56 +02:00
|
|
|
|
dest: /usr/local/bin/prometheus-mongodb-exporter
|
|
|
|
|
remote_src: yes
|
|
|
|
|
owner: root
|
|
|
|
|
group: root
|
|
|
|
|
mode: 0755
|
2021-05-26 18:23:12 +02:00
|
|
|
|
notify:
|
|
|
|
|
- 'prometheus | mongodb exporter | restart service'
|
|
|
|
|
|
|
|
|
|
- name: 'prometheus | mongodb exporter | install unit file to systemd'
|
|
|
|
|
template:
|
|
|
|
|
src: systemd/prometheus-mongodb-exporter.service.j2
|
|
|
|
|
dest: /etc/systemd/system/prometheus-mongodb-exporter.service
|
|
|
|
|
owner: root
|
|
|
|
|
group: root
|
|
|
|
|
mode: 0600
|
|
|
|
|
|
|
|
|
|
- name: 'prometheus | mongodb exporter | configure systemd to use service'
|
|
|
|
|
systemd:
|
|
|
|
|
daemon_reload: yes
|
|
|
|
|
enabled: yes
|
|
|
|
|
name: prometheus-mongodb-exporter.service
|
2021-05-26 16:45:18 +02:00
|
|
|
|
|
|
|
|
|
- name: 'prometheus | mongodb exporter | configuration'
|
|
|
|
|
template:
|
|
|
|
|
src: prometheus-mongodb-exporter.conf.j2
|
|
|
|
|
dest: /etc/default/prometheus-mongodb-exporter
|
|
|
|
|
owner: root
|
|
|
|
|
group: root
|
|
|
|
|
mode: 0600
|
2021-05-26 12:01:00 +02:00
|
|
|
|
notify:
|
2021-05-26 15:52:55 +02:00
|
|
|
|
- 'prometheus | mongodb exporter | restart service'
|