2021-11-19 12:30:22 +01:00
|
|
|
|
---
|
2022-11-11 21:08:07 +01:00
|
|
|
|
- name: 'redis exporter | get latest release from GitHub'
|
2021-11-19 12:30:22 +01:00
|
|
|
|
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
|
|
|
|
|
|
2022-11-11 21:08:07 +01:00
|
|
|
|
- name: 'redis exporter | download'
|
2021-11-19 12:30:22 +01:00
|
|
|
|
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
|
|
|
|
|
|
2022-11-11 21:08:07 +01:00
|
|
|
|
- name: 'redis exporter | unarchive'
|
2021-11-19 12:30:22 +01:00
|
|
|
|
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
|
|
|
|
|
|
2022-11-11 21:08:07 +01:00
|
|
|
|
- name: 'redis exporter | move to /usr/local/bin'
|
2021-11-19 12:30:22 +01:00
|
|
|
|
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
|
2022-01-17 16:41:33 +01:00
|
|
|
|
|
2022-11-11 21:08:07 +01:00
|
|
|
|
- name: 'redis exporter | configuration'
|
2021-11-19 12:30:22 +01:00
|
|
|
|
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
|
|
|
|
|
2022-11-11 21:08:07 +01:00
|
|
|
|
- name: 'redis exporter | install unit file to systemd'
|
2022-11-11 19:10:30 +01:00
|
|
|
|
template:
|
|
|
|
|
src: systemd/prometheus-redis-exporter.service.j2
|
|
|
|
|
dest: /etc/systemd/system/prometheus-redis-exporter.service
|
|
|
|
|
owner: root
|
|
|
|
|
group: root
|
|
|
|
|
mode: 0600
|
|
|
|
|
|
2022-11-11 21:08:07 +01:00
|
|
|
|
- name: 'redis exporter | configure systemd to use service'
|
2021-11-19 12:30:22 +01:00
|
|
|
|
systemd:
|
|
|
|
|
daemon_reload: yes
|
|
|
|
|
enabled: yes
|
|
|
|
|
name: prometheus-redis-exporter.service
|