2022-11-11 21:08:07 +01:00

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