prometheus/tasks/redis_exporter.yml

55 lines
2.0 KiB
YAML
Raw Normal View History

2021-11-19 12:30:22 +01:00
---
- name: 'prometheus | redis exporter | get latest release from GitHub'
shell: curl --silent "https://api.github.com/repos/oliver006/redis_exporter/releases/latest" | jq -r .tag_name | sed "s/v//"
args:
warn: false
register: prometheus_redis_exporter_latest_version
run_once: true
- name: 'prometheus | redis exporter | download'
get_url:
2021-11-19 14:20:13 +01:00
url: https://github.com/oliver006/redis_exporter/releases/download/v{{ prometheus_redis_exporter_version|default(prometheus_redis_exporter_latest_version.stdout) }}/redis_exporter-v{{ prometheus_redis_exporter_version|default(prometheus_redis_exporter_latest_version.stdout) }}.linux-amd64.tar.gz
2021-11-19 12:30:22 +01:00
dest: /tmp
- name: 'prometheus | redis exporter | unarchive'
unarchive:
remote_src: yes
2021-11-19 14:22:35 +01:00
src: /tmp/redis_exporter-v{{ prometheus_redis_exporter_version|default(prometheus_redis_exporter_latest_version.stdout) }}.linux-amd64.tar.gz
2021-11-19 12:30:22 +01:00
dest: /tmp
- name: 'prometheus | redis exporter | move to /usr/local/bin'
copy:
2021-11-19 14:22:35 +01:00
src: /tmp/redis_exporter-v{{ prometheus_redis_exporter_version|default(prometheus_redis_exporter_latest_version.stdout) }}.linux-amd64/redis_exporter
2021-11-19 12:30:22 +01:00
dest: /usr/local/bin/prometheus-redis-exporter
remote_src: yes
owner: root
group: root
mode: 0755
notify:
- 'prometheus | redis exporter | restart service'
- name: 'prometheus | redis exporter | configuration'
template:
src: conf/prometheus-redis-exporter.j2
dest: /etc/default/prometheus-redis-exporter
owner: root
group: root
mode: 0600
2021-11-19 14:34:30 +01:00
register: prometheus_redis_exporter_configuration
2021-11-19 12:30:22 +01:00
notify:
2021-11-19 14:34:30 +01:00
- 'prometheus | redis exporter | restart service'
2021-11-19 12:30:22 +01:00
- name: 'prometheus | redis exporter | install unit file to systemd'
template:
src: systemd/prometheus-redis-exporter.service.j2
dest: /etc/systemd/system/prometheus-redis-exporter.service
owner: root
group: root
mode: 0600
- name: 'prometheus | redis exporter | configure systemd to use service'
systemd:
daemon_reload: yes
enabled: yes
name: prometheus-redis-exporter.service