Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add task docs for ansible #6129

Closed
wants to merge 14 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
86 changes: 86 additions & 0 deletions docs/sources/flow/get-started/install/ansible.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
---
aliases:
- /docs/grafana-cloud/agent/flow/get-started/install/ansible/
canonical: https://grafana.com/docs/agent/latest/flow/get-started/install/ansible/
description: Learn how to install Grafana Agent Flow with Ansible
menuTitle: Ansible
title: Install Grafana Agent Flow with Ansible
weight: 550
---

# Install or uninstall {{% param "PRODUCT_NAME" %}} using Ansible

You can use Ansible to install and manage {{< param "PRODUCT_NAME" >}}.

## Before you begin

- These steps assume you already have a working [Ansible](https://www.ansible.com/) setup,
and a pre-existing inventory.
- You can add the tasks below to any new or existing Role you choose.
- These tasks install {{< param "PRODUCT_NAME" >}} from the package repositories. They expect to target Linux systems using
APT or YUM package managers.

## Steps

To add {{% param "PRODUCT_NAME" %}} to a host:

1. Add these tasks to your playbook to add the Grafana package repositories to your system:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
1. Add these tasks to your playbook to add the Grafana package repositories to your system:
1. Add the following tasks to your playbook to add the Grafana package repositories to your system:

```yaml
- name: "Install DEB repo"
when:
- "ansible_pkg_mgr == 'apt'"
block:
- name: "Import Grafana APT GPG key"
ansible.builtin.get_url:
url: "https://apt.grafana.com/gpg.key"
dest: /etc/apt/keyrings/grafana.gpg
mode: "0644"

- name: "Add Grafana APT repository"
ansible.builtin.apt_repository:
repo: "deb [signed-by=/usr/share/keyrings/grafana.key] https://apt.grafana.com/ stable main"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
repo: "deb [signed-by=/usr/share/keyrings/grafana.key] https://apt.grafana.com/ stable main"
repo: "deb [signed-by=/etc/apt/keyrings/grafana.gpg] https://apt.grafana.com stable main"

Again to align with existing Debian/Ubuntu install instructions

state: present
update_cache: true
- name: "Install yum repo"
when:
- "ansible_pkg_mgr in ['yum', 'dnf']"
block:
- name: "Add Grafana YUM/DNF repository"
ansible.builtin.yum_repository:
name: grafana
description: grafana
baseurl: "https://packages.grafana.com/oss/rpm"
enabled: true
gpgkey: "https://packages.grafana.com/gpg.key"
Comment on lines +52 to +54
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
baseurl: "https://packages.grafana.com/oss/rpm"
enabled: true
gpgkey: "https://packages.grafana.com/gpg.key"
baseurl: "https://rpm.grafana.com/oss/rpm"
enabled: true
gpgkey: "https://rpm.grafana.com/gpg.key"

The info documented here: https://packages.grafana.com/ shows baseurl=https://rpm.grafana.com Does Ansible work with the deeper dir structure or does it need/work with the root URL?

Same path documented for gpgkey Just changing for consistency in all sources... https://packages.grafana.com/ and https://rpm.grafana.com/ and https://grafana.com/docs/agent/latest/flow/setup/install/linux/

repo_gpgcheck: true
gpgcheck: true
```
1. Add the following tasks to install and enable the `grafana-agent-flow` service:
```yaml
- name: Install grafana-agent-flow
ansible.builtin.package:
name: grafana-agent-flow
state: present

- name: Enable grafana-agent-flow service
ansible.builtin.service:
name: grafana-agent-flow
enabled: yes
state: started
```

## Configuration

The `grafana-agent-flow` package installs a default configuration file that doesn't send telemetry anywhere.

The default configuration file location is `/etc/grafana-agent-flow.river`. You can replace this file with your own configuration, or create a new configuration file for the service to use.

## Next steps

- [Configure {{< param "PRODUCT_NAME" >}}][Configure]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.


{{% docs/reference %}}

[Configure]: "/docs/agent/ -> /docs/agent/<AGENT_VERSION>/flow/tasks/configure/configure-linux.md"
[Configure]: "/docs/grafana-cloud/ -> /docs/grafana-cloud/send-data/agent/flow/tasks/configure/configure-linux.md"
{{% /docs/reference %}}
Loading