prometheus/tasks/varnish_exporter.yml
2021-10-08 15:33:39 +02:00

44 lines
1.8 KiB
YAML
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

---
- name: 'prometheus | varnish exporter | get latest release from GitHub'
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
- name: 'prometheus | varnish exporter | download'
get_url:
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
dest: /tmp
- name: 'prometheus | varnish exporter | unarchive'
unarchive:
remote_src: yes
src: /tmp/prometheus_varnish_exporter-{{ prometheus_varnish_exporter_version|default(prometheus_varnish_exporter_latest_version.stdout) }}.linux-amd64.tar.gz
dest: /tmp
- name: 'prometheus | varnish exporter | move to /usr/local/bin'
copy:
src: /tmp/prometheus_varnish_exporter-{{ prometheus_varnish_exporter_version|default(prometheus_varnish_exporter_latest_version.stdout) }}.linux-amd64/prometheus_varnish_exporter
dest: /usr/local/bin/prometheus-varnish-exporter
remote_src: yes
owner: root
group: root
mode: 0755
notify:
- 'prometheus | varnish exporter | restart service'
- name: 'prometheus | varnish exporter | install unit file to systemd'
template:
src: systemd/prometheus-varnish-exporter.service.j2
dest: /etc/systemd/system/prometheus-varnish-exporter.service
owner: root
group: root
mode: 0600
- name: 'prometheus | varnish exporter | configure systemd to use service'
systemd:
daemon_reload: yes
enabled: yes
name: prometheus-varnish-exporter.service