Deploy Node Exporter using Ansible-playbook on Ubuntu 22.04 LTS


Node Exporter is a Prometheus exporter for hardware and operating system metrics. Prometheus is an open-source monitoring and alerting toolkit designed for reliability and scalability. Node Exporter is specifically focused on exporting system-level metrics from Linux and Unix-based systems.


  • Up and running ubuntu 22.04 LTS machine.
  • Basic knowledge in linux commands.
  • Internet connectivity.
  • Ansible should be installed.

We can use the given link to install Ansible on Ubuntu 22.04 LTS Linux machine.

In this post, We will show you how to deploy Node Exporter using Ansible-play on ubuntu 22.04 LTS Linux machine.

Step 1: Create an Ansible playbook

To deploy Node Exporter using Ansible on Ubuntu 22.04 LTS, you can create an Ansible playbook that installs Node Exporter. Node Exporter is a Prometheus exporter for hardware and OS metrics exposed by *NIX kernels.

To create Ansible playbook.

sudo nano deploy_node_exporter.yml

Paste the following tasks.

- name: Deploy Node Exporter
  hosts: your_target_servers
  become: true

    - name: Create Node Exporter user
        name: node_exporter
        system: yes
        shell: /bin/false

    - name: Download and extract Node Exporter
        url: ""
        dest: "/tmp/node_exporter.tar.gz"

    - name: Extract Node Exporter
        src: "/tmp/node_exporter.tar.gz"
        dest: "/opt/"

    - name: Set permissions and ownership
        path: "/opt/node_exporter-2.2.1.linux-amd64/node_exporter"
        mode: "0755"
        owner: "node_exporter"
        group: "node_exporter"

    - name: Create Node Exporter systemd service
        name: node_exporter
        enabled: yes
        state: started
        daemon_reload: yes
        daemon_reexec: yes
        scope: user
        user: node_exporter
        exec_start: "/opt/node_exporter-2.2.1.linux-amd64/node_exporter"

This playbook does the following:

  • Creates a user named node_exporter for running Node Exporter.
  • Downloads the Node Exporter binary from the official GitHub release page.
  • Extracts the Node Exporter tarball to the /opt/ directory.
  • Sets the necessary permissions and ownership for the Node Exporter binary.
  • Creates a systemd service for Node Exporter and starts it.

Replace your_target_servers with the target servers or server group where you want to install Node Exporter and Save the playbook file.

Step 2: Run the Ansible playbook

We need to execute the following command to deploy the node-exporter on target machine.

ansible-playbook -i inventory.ini deploy_node_exporter.yml

This playbook assumes that you have Ansible installed on your local machine and SSH access to the target servers. Additionally, ensure that the servers have internet access to download Node Exporter during the installation process. Adjust the version number in the URL to the latest version available on the Node Exporter GitHub releases page.


We have successfully deployed Node exporter using Ansible Playbook on Ubuntu 22.04 LTS. If you are still having issues, please leave a comment below.


Deploy Node Exporter using Ansible-playbook on Ubuntu 22.04 LTS

Leave a Reply

Your email address will not be published. Required fields are marked *

Scroll to top