Grafana Alloy is the new name for our distribution of the OTel collector. Grafana Agent has been deprecated and is in Long-Term Support (LTS) through October 31, 2025. Grafana Agent will reach an End-of-Life (EOL) on November 1, 2025. Read more about why we recommend migrating to Grafana Alloy.

Important: This documentation is about an older version. It's relevant only to the release noted, many of the features and functions have been updated or replaced. Please view the current version.

Open source

Install or uninstall Grafana Agent Flow using Ansible

You can use Ansible to install and manage Grafana Agent Flow on Linux hosts.

Before you begin

  • These steps assume you already have a working Ansible setup and a pre-existing inventory.
  • You can add the tasks below to any new or existing role.


To add Grafana Agent Flow to a host:

  1. Create a file named grafana-agent.yml and add the following:

    - name: Install Grafana Agent Flow
      hosts: all
      become: true
        - name: Install Grafana Agent Flow
            name: grafana.grafana.grafana_agent
            grafana_agent_mode: flow
            # Destination file name
            grafana_agent_config_filename: config.river
            # Local file to copy
            grafana_agent_provisioned_config_file:  "<path-to-config-file-on-localhost>"
              server.http.listen-addr: ''

    Replace the following:

    • <path-to-config-file-on-localhost>: The path to the River configuration file on the Ansible Controller (Localhost).
  2. Run the Ansible playbook. Open a terminal window and run the following command from the Ansible playbook directory.

    ansible-playbook grafana-agent.yml


To verify that the Grafana Agent Flow service on the target machine is active and running, open a terminal window and run the following command:

$ sudo systemctl status grafana-agent.service

If the service is active and running, the output should look similar to this:

grafana-agent.service - Grafana Agent
  Loaded: loaded (/etc/systemd/system/grafana-agent.service; enabled; vendor preset: enabled)
  Active: active (running) since Wed 2022-07-20 09:56:15 UTC; 36s ago
Main PID: 3176 (agent-linux-amd)
  Tasks: 8 (limit: 515)
  Memory: 92.5M
    CPU: 380ms
  CGroup: /system.slice/grafana-agent.service
    └─3176 /usr/local/bin/agent-linux-amd64 --config.file=/etc/grafana-cloud/agent-config.yaml

Next steps