Node Exporter role

Deploy node-exporter container and install custom metric script.


Configure the role.


node_exporter_image: prom/node-exporter:v1.0.1
node_exporter_hostname: node01
node_exporter_description: Host metrics for server1 # default: "Node Exporter {{ inventory_hostname_short }}"
node_exporter_nginx_data_dir: /usr/share/nginx/proxies # default: "{{ nginx_data_dir }}/proxies"
node_exporter_requires_package: python2-passlib # default: python3-passlib
node_exporter_proxy_basic_auth_username: exporter # default: node-exporter
node_exporter_proxy_basic_auth_password: "{{ vault_node_exporter_proxy_basic_auth_password }}"

Ensure the nginx proxy includes the node-exporter config:

  - src_hostname:
    ssl: true
    options: |
      include /etc/nginx/conf.d/proxies/node-exporter.nginx;

And include it in your playbook.

- hosts: node_exporter
  - role: node_exporter

The following tags are available:

  • node_exporter
  • node_exporter_nginx_config


Install command line tools

The installation script requires that you have sudo access to root.

Run curl -L | bash in your terminal.

Host filesystem mount

By default to node-exporter mounts the host filesystem to /hostfs.