prometheus/tasks/exporter/varnish.yml

44 lines
1.7 KiB
YAML
Raw Normal View History

2021-10-08 15:22:59 +02:00
---
2022-11-11 21:08:07 +01:00
- name: 'varnish exporter | get latest release from GitHub'
2021-10-08 15:22:59 +02:00
shell: curl --silent "https://api.github.com/repos/jonnenauha/prometheus_varnish_exporter/releases/latest" | jq -r .tag_name | sed "s/v//"
args:
warn: false
register: prometheus_varnish_exporter_latest_version
run_once: true
2022-11-11 21:08:07 +01:00
- name: 'varnish exporter | download'
2021-10-08 15:22:59 +02:00
get_url:
2021-10-08 15:33:39 +02:00
url: https://github.com/jonnenauha/prometheus_varnish_exporter/releases/download/{{ prometheus_varnish_exporter_version|default(prometheus_varnish_exporter_latest_version.stdout) }}/prometheus_varnish_exporter-{{ prometheus_varnish_exporter_version|default(prometheus_varnish_exporter_latest_version.stdout) }}.linux-amd64.tar.gz
2021-10-08 15:22:59 +02:00
dest: /tmp
2022-11-11 21:08:07 +01:00
- name: 'varnish exporter | unarchive'
2021-10-08 15:22:59 +02:00
unarchive:
remote_src: yes
2021-10-08 15:33:39 +02:00
src: /tmp/prometheus_varnish_exporter-{{ prometheus_varnish_exporter_version|default(prometheus_varnish_exporter_latest_version.stdout) }}.linux-amd64.tar.gz
2021-10-08 15:22:59 +02:00
dest: /tmp
2022-11-11 21:08:07 +01:00
- name: 'varnish exporter | move to /usr/local/bin'
2021-10-08 15:22:59 +02:00
copy:
2021-10-08 15:33:39 +02:00
src: /tmp/prometheus_varnish_exporter-{{ prometheus_varnish_exporter_version|default(prometheus_varnish_exporter_latest_version.stdout) }}.linux-amd64/prometheus_varnish_exporter
2021-10-08 15:22:59 +02:00
dest: /usr/local/bin/prometheus-varnish-exporter
remote_src: yes
owner: root
group: root
mode: 0755
notify:
- 'prometheus | varnish exporter | restart service'
2022-11-11 21:08:07 +01:00
- name: 'varnish exporter | install unit file to systemd'
2021-10-08 15:22:59 +02:00
template:
src: systemd/prometheus-varnish-exporter.service.j2
dest: /etc/systemd/system/prometheus-varnish-exporter.service
owner: root
group: root
mode: 0600
2022-11-11 21:08:07 +01:00
- name: 'varnish exporter | configure systemd to use service'
2021-10-08 15:22:59 +02:00
systemd:
daemon_reload: yes
enabled: yes
name: prometheus-varnish-exporter.service