prometheus/tasks/exporter/memcached.yml

55 lines
2.2 KiB
YAML
Raw Normal View History

2022-11-11 17:32:23 +01:00
---
- name: 'prometheus | memcached exporter | get latest release from GitHub'
shell: curl --silent "https://api.github.com/repos/prometheus/memcached_exporter/releases/latest" | jq -r .tag_name | sed "s/v//"
args:
warn: false
register: prometheus_memcached_exporter_latest_version
run_once: true
- name: 'prometheus | memcached exporter | download'
get_url:
2022-11-11 18:42:05 +01:00
url: https://github.com/prometheus/memcached_exporter/releases/download/v{{ prometheus_memcached_exporter_version|default(prometheus_memcached_exporter_latest_version.stdout) }}/memcached_exporter-{{ prometheus_memcached_exporter_version|default(prometheus_memcached_exporter_latest_version.stdout) }}.linux-amd64.tar.gz
2022-11-11 17:32:23 +01:00
dest: /tmp
- name: 'prometheus | memcached exporter | unarchive'
unarchive:
remote_src: yes
2022-11-11 18:44:40 +01:00
src: /tmp/memcached_exporter-{{ prometheus_memcached_exporter_version|default(prometheus_memcached_exporter_latest_version.stdout) }}.linux-amd64.tar.gz
2022-11-11 17:32:23 +01:00
dest: /tmp
- name: 'prometheus | memcached exporter | move to /usr/local/bin'
copy:
2022-11-11 18:43:01 +01:00
src: /tmp/memcached_exporter-{{ prometheus_memcached_exporter_version|default(prometheus_memcached_exporter_latest_version.stdout) }}.linux-amd64/memcached_exporter
2022-11-11 17:32:23 +01:00
dest: /usr/local/bin/prometheus-memcached-exporter
remote_src: yes
owner: root
group: root
mode: 0755
- name: 'prometheus | memcached exporter | install unit file to systemd'
template:
src: systemd/prometheus-memcached-exporter.service.j2
dest: /etc/systemd/system/prometheus-memcached-exporter.service
owner: root
group: root
mode: 0600
2022-11-11 18:52:42 +01:00
notify:
- 'prometheus | memcached exporter | restart service'
2022-11-11 17:32:23 +01:00
# - name: 'prometheus | memcached exporter | configuration'
# template:
# src: conf/prometheus-memcached-exporter.j2
# dest: /etc/default/prometheus-memcached-exporter
# owner: root
# group: root
# mode: 0600
# register: prometheus_memcached_exporter_configuration
# notify:
# - 'prometheus | memcached exporter | restart service'
- name: 'prometheus | memcached exporter | configure systemd to use service'
systemd:
daemon_reload: yes
enabled: yes
name: prometheus-memcached-exporter.service