mirror of
https://github.com/mdlayher/homelab.git
synced 2024-12-14 11:47:32 +00:00
ansible/node_exporter: enable installing node_exporter on multiple architectures
Signed-off-by: Matt Layher <mdlayher@gmail.com>
This commit is contained in:
parent
e5135d5ab1
commit
856992d212
6 changed files with 37 additions and 19 deletions
ansible
|
@ -1,11 +0,0 @@
|
|||
[server]
|
||||
servnerr-3
|
||||
|
||||
[workstation]
|
||||
matt@nerr-3
|
||||
|
||||
[router]
|
||||
routnerr-1
|
||||
|
||||
[unifi]
|
||||
unifi.servnerr.com
|
25
ansible/production.yml
Normal file
25
ansible/production.yml
Normal file
|
@ -0,0 +1,25 @@
|
|||
---
|
||||
server:
|
||||
hosts:
|
||||
servnerr-3:
|
||||
bin_path: "/usr/local/bin"
|
||||
node_exporter_arch: "amd64"
|
||||
node_exporter_sha256: "b2503fd932f85f4e5baf161268854bf5d22001869b84f00fd2d1f57b51b72424"
|
||||
node_exporter_use_textfile: true
|
||||
workstation:
|
||||
hosts:
|
||||
nerr-3:
|
||||
bin_path: "/usr/local/bin"
|
||||
node_exporter_arch: "amd64"
|
||||
node_exporter_sha256: "b2503fd932f85f4e5baf161268854bf5d22001869b84f00fd2d1f57b51b72424"
|
||||
node_exporter_use_textfile: true
|
||||
router:
|
||||
hosts:
|
||||
routnerr-1:
|
||||
bin_path: "/usr/bin"
|
||||
node_exporter_arch: "mips64"
|
||||
node_exporter_sha256: "c2721c1b85e3024e61f37fb2dc44a57f6d4eed8cc0576185a1dedea20e36fb31"
|
||||
node_exporter_use_textfile: false
|
||||
unifi:
|
||||
hosts:
|
||||
unifi.servnerr.com:
|
|
@ -1,5 +1,5 @@
|
|||
---
|
||||
- name: download and checksum node_exporter binary
|
||||
- name: download and checksum node_exporter {{ node_exporter_arch }} binary
|
||||
tags:
|
||||
- node_exporter
|
||||
get_url:
|
||||
|
@ -38,16 +38,16 @@
|
|||
name: node_exporter
|
||||
state: stopped
|
||||
|
||||
- name: copy node_exporter binary to /usr/local/bin
|
||||
- name: copy node_exporter binary to {{ bin_path }}
|
||||
tags:
|
||||
- node_exporter
|
||||
command: "cp /tmp/{{ node_exporter_dir }}/node_exporter /usr/local/bin/"
|
||||
command: "cp /tmp/{{ node_exporter_dir }}/node_exporter {{ bin_path }}/"
|
||||
|
||||
- name: set permissions on node_exporter binary
|
||||
tags:
|
||||
- node_exporter
|
||||
file:
|
||||
path: "/usr/local/bin/node_exporter"
|
||||
path: "{{ bin_path }}/node_exporter"
|
||||
owner: node_exporter
|
||||
group: node_exporter
|
||||
mode: 0755
|
||||
|
@ -67,6 +67,7 @@
|
|||
- name: create node_exporter textfile collector directory
|
||||
tags:
|
||||
- node_exporter
|
||||
when: node_exporter_use_textfile
|
||||
file:
|
||||
path: "{{ node_exporter_textfile_dir }}"
|
||||
state: directory
|
||||
|
@ -77,6 +78,7 @@
|
|||
- name: download textfile collector scripts
|
||||
tags:
|
||||
- node_exporter
|
||||
when: node_exporter_use_textfile
|
||||
get_url:
|
||||
url: "{{ item }}"
|
||||
dest: "{{ node_exporter_textfile_dir }}/"
|
||||
|
@ -88,6 +90,7 @@
|
|||
- name: set cron PATH entries for scripts
|
||||
tags:
|
||||
- node_exporter
|
||||
when: node_exporter_use_textfile
|
||||
cron:
|
||||
name: PATH
|
||||
env: true
|
||||
|
@ -96,6 +99,7 @@
|
|||
- name: enable textfile collector cronjobs
|
||||
tags:
|
||||
- node_exporter
|
||||
when: node_exporter_use_textfile
|
||||
cron:
|
||||
name: "{{ item }}"
|
||||
minute: "*"
|
||||
|
|
|
@ -9,8 +9,8 @@ After=network-online.target
|
|||
User=node_exporter
|
||||
Group=node_exporter
|
||||
Type=simple
|
||||
ExecStart=/usr/local/bin/node_exporter \
|
||||
--collector.textfile.directory {{ node_exporter_textfile_dir }}
|
||||
ExecStart={{ bin_path }}/node_exporter \
|
||||
{% if node_exporter_use_textfile is sameas true %} --collector.textfile.directory {{ node_exporter_textfile_dir }} {% endif %}
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
|
|
|
@ -2,8 +2,7 @@
|
|||
node_exporter_textfile_dir: "/var/lib/node_exporter"
|
||||
# Version configuration.
|
||||
node_exporter_version: "0.18.1"
|
||||
node_exporter_sha256: "b2503fd932f85f4e5baf161268854bf5d22001869b84f00fd2d1f57b51b72424"
|
||||
# Static configuration.
|
||||
node_exporter_dir: "node_exporter-{{ node_exporter_version }}.linux-amd64"
|
||||
node_exporter_dir: "node_exporter-{{ node_exporter_version }}.linux-{{ node_exporter_arch }}"
|
||||
node_exporter_url: "https://github.com/prometheus/node_exporter/releases/download/v{{ node_exporter_version }}/{{ node_exporter_dir }}.tar.gz"
|
||||
node_exporter_tgz: "/tmp/node_exporter.tgz"
|
||||
|
|
|
@ -3,4 +3,5 @@
|
|||
become: true
|
||||
become_user: root
|
||||
roles:
|
||||
- node_exporter
|
||||
- wireguard_exporter
|
||||
|
|
Loading…
Reference in a new issue