ableton.prometheus_node_exporter
Ansible Role: ableton.prometheus_node_exporter
This role sets up the Prometheus node_exporter as a service on your specified host. If the system has a package manager that includes the node_exporter, this role will install it in that way. If not, it will build the software from its source code.
On Windows machines, this role installs windows_exporter.
Requirements
You need Ansible version 2.10 or higher. This role can install using packages on the following operating systems:
- Debian Linux (using the
aptmodule) - macOS (using the
homebrewmodule) - Windows (using the
win_chocolateymodule)
For other systems, the installation will be done from the source. If package installation is not an option, you need to have the following software:
- Go (golang)
- GNU Make
This role does not install either of these on your system; you must install them before using this role.
Role Variables
Here are the role variables for configuring the node_exporter service:
node_exporter_args: A list of options to pass to thenode_exporterservice, with one option per item.node_exporter_create_user: If set totrue, it creates a user namednode_exporter_userand a group namednode_exporter_group(only for Unix systems, default istrue).node_exporter_group: Group for thenode_exporter_user(only for Unix systems).node_exporter_port: The port on which metrics will be shown.node_exporter_user: The user that runsnode_exporter(only for Unix systems).
These variables are used when building node_exporter from the source:
node_exporter_install_from_binary: Iftrue, it will installnode_exporterfrom a binary file, not through a package manager. This option may not work on all systems (check the "Requirements" section).node_exporter_binary_arch: The architecture of the binary to download fornode_exporter.node_exporter_version: The version ofnode_exporterto install from source.
For Windows, you will use this variable:
windows_exporter_version: The version ofwindows_exporterto install via Chocolatey.
For a complete guide on required and optional role variables, see the defaults/main.yml file.
Example Playbook
---
- name: Install node_exporter on hosts
hosts: "all"
vars:
node_exporter_port: 9100
node_exporter_binary_arch: "amd64"
node_exporter_group: "{{ ansible_user }}"
node_exporter_user: "{{ ansible_user }}"
node_exporter_version: "0.18.1"
pre_tasks:
- name: Ensure macOS hosts install from source for a specific version
set_fact:
node_exporter_install_from_binary: true
when: ansible_os_family == "Darwin"
- name: Install necessary software for macOS hosts
homebrew:
name: golang
state: present
roles:
- ableton.prometheus_node_exporter
License
MIT
Maintainers
This project is maintained by the following GitHub users:
ansible-galaxy install ableton.prometheus_node_exporter