From 854934909c4344c3bced12247a924535d63f4ffb Mon Sep 17 00:00:00 2001 From: Craig Peterson <192540+captncraig@users.noreply.github.com> Date: Thu, 8 Feb 2024 09:45:17 -0500 Subject: [PATCH] Docs: Task doc for installing with ansible. (#6331) * working? ansible playbook * Add task docs for ansible * indent * Update docs/sources/flow/get-started/install/ansible.md Co-authored-by: Clayton Cornell <131809008+clayton-cornell@users.noreply.github.com> * Update docs/sources/flow/get-started/install/ansible.md Co-authored-by: Clayton Cornell <131809008+clayton-cornell@users.noreply.github.com> * Update docs/sources/flow/get-started/install/ansible.md Co-authored-by: Clayton Cornell <131809008+clayton-cornell@users.noreply.github.com> * Update docs/sources/flow/get-started/install/ansible.md Co-authored-by: Clayton Cornell <131809008+clayton-cornell@users.noreply.github.com> * Update docs/sources/flow/get-started/install/ansible.md Co-authored-by: Clayton Cornell <131809008+clayton-cornell@users.noreply.github.com> * Update docs/sources/flow/get-started/install/ansible.md Co-authored-by: Clayton Cornell <131809008+clayton-cornell@users.noreply.github.com> * Update docs/sources/flow/get-started/install/ansible.md Co-authored-by: Clayton Cornell <131809008+clayton-cornell@users.noreply.github.com> * Update docs/sources/flow/get-started/install/ansible.md Co-authored-by: Clayton Cornell <131809008+clayton-cornell@users.noreply.github.com> * Update docs/sources/flow/get-started/install/ansible.md Co-authored-by: Clayton Cornell <131809008+clayton-cornell@users.noreply.github.com> * Update docs/sources/flow/get-started/install/ansible.md Co-authored-by: Clayton Cornell <131809008+clayton-cornell@users.noreply.github.com> * merge in gcloud docs * Update docs/sources/flow/get-started/install/ansible.md Co-authored-by: Piotr <17101802+thampiotr@users.noreply.github.com> --------- Co-authored-by: Clayton Cornell <131809008+clayton-cornell@users.noreply.github.com> Co-authored-by: Piotr <17101802+thampiotr@users.noreply.github.com> --- .../flow/get-started/install/ansible.md | 81 +++++++++++++++++++ 1 file changed, 81 insertions(+) create mode 100644 docs/sources/flow/get-started/install/ansible.md diff --git a/docs/sources/flow/get-started/install/ansible.md b/docs/sources/flow/get-started/install/ansible.md new file mode 100644 index 000000000000..e4ac6cdf195d --- /dev/null +++ b/docs/sources/flow/get-started/install/ansible.md @@ -0,0 +1,81 @@ +--- +aliases: +- /docs/grafana-cloud/agent/flow/get-started/install/ansible/ +- /docs/grafana-cloud/monitor-infrastructure/agent/flow/get-started/install/ansible/ +- /docs/grafana-cloud/monitor-infrastructure/integrations/agent/flow/get-started/install/ansible/ +- /docs/grafana-cloud/send-data/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" >}} on Linux hosts. + +## 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. + +## Steps + +To add {{% param "PRODUCT_NAME" %}} to a host: + +1. 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: "" + grafana_agent_flags_extra: + server.http.listen-addr: '0.0.0.0:12345' + ``` +1. Replace the following field values: + + - `` with the path to river configuration file on the Ansible Controller (Localhost). + +1. Run the Ansible playbook + In the Linux machine's terminal, run the following command from the directory where the Ansible playbook is located. + + ```shell + ansible-playbook grafana-agent.yml + ``` +## Validate + +1. Grafana Agent service on the target machine should be `active` and `running`. You should see a similar output: + +```shell +$ sudo systemctl status grafana-agent.service + 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 + +- [Configure {{< param "PRODUCT_NAME" >}}][Configure] + +{{% docs/reference %}} + +[Configure]: "/docs/agent/ -> /docs/agent//flow/tasks/configure/configure-linux.md" +[Configure]: "/docs/grafana-cloud/ -> /docs/grafana-cloud/send-data/agent/flow/tasks/configure/configure-linux.md" +{{% /docs/reference %}} \ No newline at end of file