prometheus/tasks/phpfpm_exporter.yml

52 lines
2.0 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 | phpfpm exporter | get latest release from GitHub'
shell: curl --silent "https://api.github.com/repos/Lusitaniae/phpfpm_exporter/releases/latest" | jq -r .tag_name | sed "s/v//"
args:
warn: false
register: prometheus_phpfpm_exporter_latest_version
run_once: true
- name: 'prometheus | phpfpm exporter | download'
get_url:
url: https://github.com/Lusitaniae/phpfpm_exporter/releases/download/v{{ prometheus_phpfpm_exporter_version|default(prometheus_phpfpm_exporter_latest_version.stdout) }}/phpfpm_exporter-{{ prometheus_phpfpm_exporter_version|default(prometheus_phpfpm_exporter_latest_version.stdout) }}.linux-amd64.tar.gz
dest: /tmp
- name: 'prometheus | phpfpm exporter | unarchive'
unarchive:
remote_src: yes
src: /tmp/phpfpm_exporter-{{ prometheus_phpfpm_exporter_version|default(prometheus_phpfpm_exporter_latest_version.stdout) }}.linux-amd64.tar.gz
dest: /tmp
- name: 'prometheus | phpfpm exporter | move to /usr/local/bin'
copy:
src: /tmp/phpfpm_exporter-{{ prometheus_phpfpm_exporter_version|default(prometheus_phpfpm_exporter_latest_version.stdout) }}.linux-amd64/phpfpm_exporter
dest: /usr/local/bin/prometheus-phpfpm-exporter
remote_src: yes
owner: root
group: root
mode: 0755
notify:
- 'prometheus | phpfpm exporter | restart service'
- name: 'prometheus | phpfpm exporter | install startup script'
template:
src: scripts/prometheus-phpfpm-exporter-script.sh.j2
dest: /usr/local/bin/prometheus-phpfpm-exporter-script.sh
owner: root
group: root
mode: 0600
- name: 'prometheus | phpfpm exporter | install unit file to systemd'
template:
src: systemd/prometheus-phpfpm-exporter.service.j2
dest: /etc/systemd/system/prometheus-phpfpm-exporter.service
owner: root
group: root
mode: 0600
- name: 'prometheus | phpfpm exporter | configure systemd to use service'
systemd:
daemon_reload: yes
enabled: yes
name: prometheus-phpfpm-exporter.service