ansible/roles/node_explorer/tasks/install.yml

49 lines
1.3 KiB
YAML
Raw Normal View History

2021-09-19 15:34:38 +00:00
---
- name: Create temp dir
file:
path: /tmp/node_exporter
state: directory
- name: Download node-explorer
when: ansible_architecture == "aarch64"
2021-09-19 15:34:38 +00:00
unarchive:
src: https://github.com/prometheus/node_exporter/releases/download/v{{version}}/node_exporter-{{version}}.linux-arm64.tar.gz
dest: /tmp/node_exporter
remote_src: yes
mode: 0755
2023-07-05 19:55:26 +00:00
- name: Download node-explorer
when: ansible_architecture == "x86_64"
unarchive:
src: https://github.com/prometheus/node_exporter/releases/download/v{{version}}/node_exporter-{{version}}.linux-amd64.tar.gz
dest: /tmp/node_exporter
remote_src: yes
mode: 0755
- name: Download node-explorer
when: ansible_architecture == "armv7l"
unarchive:
src: https://github.com/prometheus/node_exporter/releases/download/v{{version}}/node_exporter-{{version}}.linux-armv7.tar.gz
dest: /tmp/node_exporter
remote_src: yes
mode: 0755
2021-09-19 15:34:38 +00:00
- name: get folder name
shell: ls /tmp/node_exporter
register: dir_name
- name: Move to /usr/local/sbin
become: yes
command: cp -ra /tmp/node_exporter/{{ dir_name.stdout }}/node_exporter /usr/local/sbin/node_exporter
- name: Remove temp directory
become: yes
file:
path: /tmp/node_exporter
state: absent
- name: change chmod
become: yes
file:
2021-09-19 16:47:14 +00:00
path: /usr/local/sbin/node_exporter
2021-09-19 15:34:38 +00:00
mode: '0755'