feat: Download and install Node Exporter.

This commit is contained in:
William 2022-12-28 13:52:23 +01:00
parent 58c1d948da
commit b3cec09961
2 changed files with 23 additions and 2 deletions

View File

@ -2,7 +2,12 @@
## How to run playbook ## How to run playbook
``` ```bash
NODE_EXPORTER_VERSION=1.5.0
INVENTORY=vps.example.com, INVENTORY=vps.example.com,
ansible-playbook -i $INVENTORY -e ansible_python_interpreter=/usr/bin/python3 main.yml ansible-playbook \
-i $INVENTORY \
-e ansible_python_interpreter=/usr/bin/python3 \
-e node_exporter_version=$NODE_EXPORTER_VERSION \
main.yml
``` ```

View File

@ -19,3 +19,19 @@
home: "/usr/local/bin/node-exporter" home: "/usr/local/bin/node-exporter"
system: true system: true
state: present state: present
- name: Download and unzip Node Exporter
unarchive:
src: "https://github.com/prometheus/node_exporter/releases/download/v{{ node_exporter_version }}/node_exporter-{{ node_exporter_version }}.linux-amd64.tar.gz"
dest: /tmp/
remote_src: yes
validate_certs: no
- name: Move the binary to the installation directory
copy:
src: "/tmp/node_exporter-{{ node_exporter_version }}.linux-amd64/node_exporter"
dest: "/usr/local/bin/node-exporter"
owner: "node-exporter"
group: "node-exporter"
mode: 0755
remote_src: true