This Ansible playbook is designed to automate the installation and configuration of Prometheus Node Exporter on target Linux systems. It downloads the specified version of Node Exporter, sets up a system user with limited privileges, and configures the systemd service to ensure Node Exporter runs as a background service.
-
Downloads the specified version of Node Exporter.
-
Creates a dedicated system user for running Node Exporter with /bin/false as the default shell for security.
-
Configures Node Exporter as a systemd service for easy management.
-
Ensures the service starts on boot and is running.
-
Ansible installed on your local machine or control node.
-
Target servers must support SSH connections and have root privileges (or be sudo-enabled).
node_exporter_version: Specifies the version of Node Exporter to be installed. This can be passed as an extra variable when running the playbook.
Clone this repository to your local machine:
$ git clone https://github.com/krasimirstoev/node-exporter-ansible-playbook.gitUse the following command to run the playbook:
$ ansible-playbook install.yml -i hosts.ini -e node_exporter_version=1.8.2-
Replace
hosts.iniwith the inventory file specifying the target hosts. -
Use the
-eflag to specify the desired version of Node Exporter.
The inventory file (hosts.ini) should contain the target servers where you want to install Node Exporter. Example:
[node_exporter_servers]
server1 ansible_host=192.168.1.101 ansible_user=root
server2 ansible_host=192.168.1.102 ansible_user=rootThis project is licensed under the MIT License - see the LICENSE file for details.