Menu
Caution
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 .
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.
Steps
To add Grafana Agent Flow to a host:
Create a file named
grafana-agent.yml
and add the following:yaml- name: Install Grafana Agent Flow hosts: all become: true tasks: - name: Install Grafana Agent Flow ansible.builtin.include_role: name: grafana.grafana.grafana_agent vars: 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>" grafana_agent_flags_extra: server.http.listen-addr: '0.0.0.0:12345'
Replace the following:
<path-to-config-file-on-localhost>
: The path to the River configuration file on the Ansible Controller (Localhost).
Run the Ansible playbook. Open a terminal window and run the following command from the Ansible playbook directory.
shellansible-playbook grafana-agent.yml
Validate
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:
shell
$ 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
Was this page helpful?
Related resources from Grafana Labs
Additional helpful documentation, links, and articles:
Video
Getting started with Grafana dashboard design
In this webinar, you'll learn how to design stylish and easily accessible Grafana dashboards that tell a story.
Video
Building advanced Grafana dashboards
In this webinar, we’ll demo how to build and format Grafana dashboards.
Video
Intro to Alerting with Grafana
Master alerting with Grafana: Navigate the complexities, reduce false positives, and boost reliability for your systems.