From 4a7d0586ba1fd647221481e958a8bc80159ed727 Mon Sep 17 00:00:00 2001 From: jcreixell Date: Fri, 19 Jan 2024 09:44:37 +0100 Subject: [PATCH 1/6] Add task doc for chef - Adds basic instructions to install Grafana Agent using Chef. - Fixes https://github.com/grafana/agent/issues/5961 --- docs/sources/flow/get-started/install/chef.md | 96 +++++++++++++++++++ 1 file changed, 96 insertions(+) create mode 100644 docs/sources/flow/get-started/install/chef.md diff --git a/docs/sources/flow/get-started/install/chef.md b/docs/sources/flow/get-started/install/chef.md new file mode 100644 index 000000000000..1fb532b791a6 --- /dev/null +++ b/docs/sources/flow/get-started/install/chef.md @@ -0,0 +1,96 @@ +--- +aliases: +- /docs/grafana-cloud/agent/flow/get-started/install/chef/ +canonical: https://grafana.com/docs/agent/latest/flow/get-started/install/chef/ +description: Learn how to install Grafana Agent Flow with Chef +menuTitle: Chef +title: Install Grafana Agent Flow with Chef +weight: 550 +--- + +# Install or uninstall {{% param "PRODUCT_NAME" %}} using Chef + +You can use Chef to install and manage {{< param "PRODUCT_NAME" >}}. + +## Before you begin + +- These steps assume you already have a working [Chef](https://www.chef.io/products/chef-infrastructure-management/) setup. +- You can add the resources below to any new or existing recipy you choose. +- These tasks install {{< param "PRODUCT_NAME" >}} from the package repositories. They expect to target Linux systems from the following families: + - Debian (including Ubuntu) + - RedHat Enterprise Linux + - Amazon Linux + - Fedora + +## Steps + +To add {{% param "PRODUCT_NAME" %}} to a host: + +1. Add the following resources to a recipe to add the Grafana package repositories to your system: + ```ruby + if platform_family?('debian', 'rhel', 'amazon', 'fedora') + if platform_family?('debian') + remote_file '/etc/apt/keyrings/grafana.gpg' do + source 'https://apt.grafana.com/gpg.key' + mode '0644' + action :create + end + + file '/etc/apt/sources.list.d/grafana.list' do + content "deb [signed-by=/etc/apt/keyrings/grafana.gpg] https://apt.grafana.com/ stable main" + mode '0644' + notifies :update, 'apt_update[update apt cache]', :immediately + end + + apt_update 'update apt cache' do + action :nothing + end + elsif platform_family?('rhel', 'amazon', 'fedora') + yum_repository 'grafana' do + description 'grafana' + baseurl 'https://rpm.grafana.com/oss/rpm' + gpgcheck true + gpgkey 'https://rpm.grafana.com/gpg.key' + enabled true + action :create + notifies :run, 'execute[add-rhel-key]', :immediately + end + + execute 'add-rhel-key' do + command "rpm --import https://rpm.grafana.com/gpg.key" + action :nothing + end + end + else + fail "The #{node['platform_family']} platform is not supported." + end + ``` +1. Add the following resources to install and enable the `grafana-agent-flow` service: + ```ruby + package 'grafana-agent-flow' do + action :install + flush_cache [ :before ] if platform_family?('amazon', 'rhel', 'fedora') + notifies :restart, 'service[grafana-agent-flow]', :delayed + end + + service 'grafana-agent-flow' do + service_name 'grafana-agent-flow' + action [:enable, :start] + end + ``` + +## 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] + +{{% 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 From 3b107997c1910f15f27d4adbf358edbebfad1355 Mon Sep 17 00:00:00 2001 From: Jorge Creixell Date: Mon, 22 Jan 2024 09:08:23 +0100 Subject: [PATCH 2/6] Update docs/sources/flow/get-started/install/chef.md Co-authored-by: Clayton Cornell <131809008+clayton-cornell@users.noreply.github.com> --- docs/sources/flow/get-started/install/chef.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/sources/flow/get-started/install/chef.md b/docs/sources/flow/get-started/install/chef.md index 1fb532b791a6..c22f833efbb2 100644 --- a/docs/sources/flow/get-started/install/chef.md +++ b/docs/sources/flow/get-started/install/chef.md @@ -15,7 +15,7 @@ You can use Chef to install and manage {{< param "PRODUCT_NAME" >}}. ## Before you begin - These steps assume you already have a working [Chef](https://www.chef.io/products/chef-infrastructure-management/) setup. -- You can add the resources below to any new or existing recipy you choose. +- You can add the following resources to any new or existing recipe you choose. - These tasks install {{< param "PRODUCT_NAME" >}} from the package repositories. They expect to target Linux systems from the following families: - Debian (including Ubuntu) - RedHat Enterprise Linux From 76509bd383ca679828923230cf2c50e05355d6e6 Mon Sep 17 00:00:00 2001 From: Jorge Creixell Date: Mon, 22 Jan 2024 09:08:42 +0100 Subject: [PATCH 3/6] Update docs/sources/flow/get-started/install/chef.md Co-authored-by: Clayton Cornell <131809008+clayton-cornell@users.noreply.github.com> --- docs/sources/flow/get-started/install/chef.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/sources/flow/get-started/install/chef.md b/docs/sources/flow/get-started/install/chef.md index c22f833efbb2..bfa283b08ca8 100644 --- a/docs/sources/flow/get-started/install/chef.md +++ b/docs/sources/flow/get-started/install/chef.md @@ -16,7 +16,7 @@ You can use Chef to install and manage {{< param "PRODUCT_NAME" >}}. - These steps assume you already have a working [Chef](https://www.chef.io/products/chef-infrastructure-management/) setup. - You can add the following resources to any new or existing recipe you choose. -- These tasks install {{< param "PRODUCT_NAME" >}} from the package repositories. They expect to target Linux systems from the following families: +- These tasks install {{< param "PRODUCT_NAME" >}} from the package repositories. The tasks target Linux systems from the following families: - Debian (including Ubuntu) - RedHat Enterprise Linux - Amazon Linux From a9fa08d39ba215f7a1207017faf9e11e62375cf2 Mon Sep 17 00:00:00 2001 From: Jorge Creixell Date: Mon, 22 Jan 2024 16:03:27 +0100 Subject: [PATCH 4/6] Update docs/sources/flow/get-started/install/chef.md Co-authored-by: Piotr <17101802+thampiotr@users.noreply.github.com> --- docs/sources/flow/get-started/install/chef.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/sources/flow/get-started/install/chef.md b/docs/sources/flow/get-started/install/chef.md index bfa283b08ca8..f079f3aff4b7 100644 --- a/docs/sources/flow/get-started/install/chef.md +++ b/docs/sources/flow/get-started/install/chef.md @@ -8,7 +8,7 @@ title: Install Grafana Agent Flow with Chef weight: 550 --- -# Install or uninstall {{% param "PRODUCT_NAME" %}} using Chef +# Install {{% param "PRODUCT_NAME" %}} with Chef You can use Chef to install and manage {{< param "PRODUCT_NAME" >}}. From 56a2887adcbf1612cd1a7e7c2f1e39706f3ac1bf Mon Sep 17 00:00:00 2001 From: jcreixell Date: Mon, 22 Jan 2024 16:17:13 +0100 Subject: [PATCH 5/6] Move link to the bottom and improve wording --- docs/sources/flow/get-started/install/chef.md | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/docs/sources/flow/get-started/install/chef.md b/docs/sources/flow/get-started/install/chef.md index f079f3aff4b7..495bf116019f 100644 --- a/docs/sources/flow/get-started/install/chef.md +++ b/docs/sources/flow/get-started/install/chef.md @@ -14,7 +14,7 @@ You can use Chef to install and manage {{< param "PRODUCT_NAME" >}}. ## Before you begin -- These steps assume you already have a working [Chef](https://www.chef.io/products/chef-infrastructure-management/) setup. +- These steps assume you already have a working [Chef][] setup. - You can add the following resources to any new or existing recipe you choose. - These tasks install {{< param "PRODUCT_NAME" >}} from the package repositories. The tasks target Linux systems from the following families: - Debian (including Ubuntu) @@ -26,7 +26,7 @@ You can use Chef to install and manage {{< param "PRODUCT_NAME" >}}. To add {{% param "PRODUCT_NAME" %}} to a host: -1. Add the following resources to a recipe to add the Grafana package repositories to your system: +1. Add the following resources to your [Chef][] recipe to add the Grafana package repositories to your system: ```ruby if platform_family?('debian', 'rhel', 'amazon', 'fedora') if platform_family?('debian') @@ -89,6 +89,8 @@ The default configuration file location is `/etc/grafana-agent-flow.river`. You - [Configure {{< param "PRODUCT_NAME" >}}][Configure] +[Chef]: https://www.chef.io/products/chef-infrastructure-management/ + {{% docs/reference %}} [Configure]: "/docs/agent/ -> /docs/agent//flow/tasks/configure/configure-linux.md" From 43346c27c3213a90d886c5ac2a59b0c8a0c18169 Mon Sep 17 00:00:00 2001 From: jcreixell Date: Mon, 22 Jan 2024 17:04:09 +0100 Subject: [PATCH 6/6] Trigger CI