ref: bd31e7c59f1fa7ff92ac8c3c1c2f874ba1fe832b cisco/deploy/monitoring/node_exporter.yml -rw-r--r-- 1.4 KiB View raw
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
- name: Node Exporter installation
  hosts: all
  tasks:
  - name: Get intel node exporter archive
    get_url:
      url: https://github.com/prometheus/node_exporter/releases/download/v0.18.1/node_exporter-0.18.1.linux-amd64.tar.gz
      dest: /tmp/node-exporter.tar.gz
    when: 'vars["ansible_architecture"] != "armv7l"'

  - name: Get ARM node exporter archive
    get_url:
      url: https://github.com/prometheus/node_exporter/releases/download/v0.18.1/node_exporter-0.18.1.linux-armv7.tar.gz
      dest: /tmp/node-exporter.tar.gz
    when: 'vars["ansible_architecture"] == "armv7l"'

  - name: Unarchive
    unarchive:
      src: /tmp/node-exporter.tar.gz
      dest: /tmp/
      remote_src: yes

  - name: Copy binary intel
    copy:
      src: /tmp/node_exporter-0.18.1.linux-amd64/node_exporter
      dest: /usr/local/bin/
      remote_src: yes
      mode: +x
    when: 'vars["ansible_architecture"] != "armv7l"'

  - name: Copy binary arm
    copy:
      src: /tmp/node_exporter-0.18.1.linux-armv7/node_exporter
      dest: /usr/local/bin/
      remote_src: yes
      mode: +x
    when: 'vars["ansible_architecture"] == "armv7l"'

  - name: Install system file
    copy:
      src: node-exporter.service
      dest: /etc/systemd/system/

  - name: Enable & Start node exporter
    systemd:
      name: node-exporter
      enabled: yes
      state: restarted
      daemon_reload: yes