From 5a2fb39273d4ae89cf8c031c9bf90c5e3d292023 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Wed, 10 Apr 2024 13:54:57 -0400 Subject: [PATCH] Update the Ansible doc to use the alloy role instead of Agent (#164) (#167) (cherry picked from commit d2d98cc62996123e835364d9c7b2261404ba2991) Co-authored-by: Ishan Jain <51803183+ishanjainn@users.noreply.github.com> --- docs/sources/get-started/install/ansible.md | 31 +++++++++++++-------- 1 file changed, 19 insertions(+), 12 deletions(-) diff --git a/docs/sources/get-started/install/ansible.md b/docs/sources/get-started/install/ansible.md index 4da079679c..3f6f50ccf9 100644 --- a/docs/sources/get-started/install/ansible.md +++ b/docs/sources/get-started/install/ansible.md @@ -11,7 +11,7 @@ noindex: true # Install or uninstall {{% param "FULL_PRODUCT_NAME" %}} using Ansible -You can use Ansible to install and manage {{< param "PRODUCT_NAME" >}} on Linux hosts. +You can use [Grafana Ansible Collection](https://github.com/grafana/grafana-ansible-collection) to install and manage {{< param "PRODUCT_NAME" >}} on Linux hosts. ## Before you begin @@ -25,24 +25,31 @@ To add {{% param "PRODUCT_NAME" %}} to a host: 1. Create a file named `alloy.yml` and add the following: ```yaml - - name: Install Grafana Alloy + - name: Install Alloy hosts: all become: true + tasks: - - name: Install Grafana Alloy + - name: Install Alloy ansible.builtin.include_role: name: grafana.grafana.alloy vars: - # Destination file name - grafana_alloy_config_filename: config.alloy - # Local file to copy - grafana_alloy_provisioned_config_file: "" - grafana_alloy_flags_extra: - server.http.listen-addr: '0.0.0.0:12345' + config: | + prometheus.scrape "default" { + targets = [{"__address__" = "localhost:12345"}] + forward_to = [prometheus.remote_write.prom.receiver] + } + prometheus.remote_write "prom" { + endpoint { + url = "YOUR_PROMETHEUS_PUSH_ENDPOINT" + } + } ``` - Replace the following: - - _``_: The path to the {{< param "PRODUCT_NAME" >}} configuration file on the Ansible Controller (Localhost). + The above snippet has a sample configuration to collect and send Alloy metrics to Prometheus + + Replace the following: + - _`YOUR_PROMETHEUS_PUSH_ENDPOINT`_: With the Remote write endpoint of your Prometheus Instance. 1. Run the Ansible playbook. Open a terminal window and run the following command from the Ansible playbook directory. @@ -76,5 +83,5 @@ Main PID: 3176 (alloy-linux-amd) - [Configure {{< param "PRODUCT_NAME" >}}][Configure] -[Ansible]: https://www.ansible.com/ +[Grafana Ansible Collection]: https://github.com/grafana/grafana-ansible-collection [Configure]: ../../../tasks/configure/configure-linux/