From 51aafc4b33596483810e7eb0ebfbb54611a514cf Mon Sep 17 00:00:00 2001 From: Alvaro Cabanas Date: Thu, 7 Mar 2024 19:52:16 +0100 Subject: [PATCH] Use config examples to set up the super-agent, allowing to have empty agents. (#1054) --- recipes/newrelic/infrastructure/super-agent/debian.yml | 8 ++------ recipes/newrelic/infrastructure/super-agent/rhel.yml | 10 +++------- recipes/newrelic/infrastructure/super-agent/suse.yml | 10 +++------- 3 files changed, 8 insertions(+), 20 deletions(-) diff --git a/recipes/newrelic/infrastructure/super-agent/debian.yml b/recipes/newrelic/infrastructure/super-agent/debian.yml index 07127ab0..f4a29ba5 100644 --- a/recipes/newrelic/infrastructure/super-agent/debian.yml +++ b/recipes/newrelic/infrastructure/super-agent/debian.yml @@ -341,15 +341,11 @@ install: config_supervisors: cmds: - - | - # Remove values_file keys from config.yaml - sed -i '/^\s*values_file:/d' /etc/newrelic-super-agent/config.yaml - sed -i '/^\s*#\s*values_file:/d' /etc/newrelic-super-agent/config.yaml - | if [ "{{.NR_CLI_INFRA_AGENT}}" = "false" ] && [ "{{.NR_CLI_NRDOT}}" = "false" ]; then - sed -i '/^\s*agents:/s/^/#/' /etc/newrelic-super-agent/config.yaml + cp /etc/newrelic-super-agent/examples/super-agent-config-no-agents.yaml /etc/newrelic-super-agent/config.yaml else - sed -i 's/s*#\s*agents:/agents:/g' /etc/newrelic-super-agent/config.yaml + cp /etc/newrelic-super-agent/examples/super-agent-config-all-agents.yaml /etc/newrelic-super-agent/config.yaml fi - | if [ "{{.NR_CLI_INFRA_AGENT}}" = "false" ]; then diff --git a/recipes/newrelic/infrastructure/super-agent/rhel.yml b/recipes/newrelic/infrastructure/super-agent/rhel.yml index dc62a4aa..64bf62f9 100644 --- a/recipes/newrelic/infrastructure/super-agent/rhel.yml +++ b/recipes/newrelic/infrastructure/super-agent/rhel.yml @@ -278,14 +278,10 @@ install: config_supervisors: cmds: - | - # Remove values_file keys from config.yaml - sed -i '/^\s*values_file:/d' /etc/newrelic-super-agent/config.yaml - sed -i '/^\s*#\s*values_file:/d' /etc/newrelic-super-agent/config.yaml - - | - if [ "{{.NR_CLI_INFRA_AGENT}}" = "false" ] && [ "{{.NR_CLI_NRDOT}}" = "false" ] ; then - sed -i '/^\s*agents:/s/^/#/' /etc/newrelic-super-agent/config.yaml + if [ "{{.NR_CLI_INFRA_AGENT}}" = "false" ] && [ "{{.NR_CLI_NRDOT}}" = "false" ]; then + cp /etc/newrelic-super-agent/examples/super-agent-config-no-agents.yaml /etc/newrelic-super-agent/config.yaml else - sed -i 's/s*#\s*agents:/agents:/g' /etc/newrelic-super-agent/config.yaml + cp /etc/newrelic-super-agent/examples/super-agent-config-all-agents.yaml /etc/newrelic-super-agent/config.yaml fi - | if [ "{{.NR_CLI_INFRA_AGENT}}" = "false" ] ; then diff --git a/recipes/newrelic/infrastructure/super-agent/suse.yml b/recipes/newrelic/infrastructure/super-agent/suse.yml index 49ad5257..fa770f4d 100644 --- a/recipes/newrelic/infrastructure/super-agent/suse.yml +++ b/recipes/newrelic/infrastructure/super-agent/suse.yml @@ -233,14 +233,10 @@ install: config_supervisors: cmds: - | - # Remove values_file keys from config.yaml - sed -i '/^\s*values_file:/d' /etc/newrelic-super-agent/config.yaml - sed -i '/^\s*#\s*values_file:/d' /etc/newrelic-super-agent/config.yaml - - | - if [ "{{.NR_CLI_INFRA_AGENT}}" = "false" ] && [ "{{.NR_CLI_NRDOT}}" = "false" ] ; then - sed -i '/^\s*agents:/s/^/#/' /etc/newrelic-super-agent/config.yaml + if [ "{{.NR_CLI_INFRA_AGENT}}" = "false" ] && [ "{{.NR_CLI_NRDOT}}" = "false" ]; then + cp /etc/newrelic-super-agent/examples/super-agent-config-no-agents.yaml /etc/newrelic-super-agent/config.yaml else - sed -i 's/s*#\s*agents:/agents:/g' /etc/newrelic-super-agent/config.yaml + cp /etc/newrelic-super-agent/examples/super-agent-config-all-agents.yaml /etc/newrelic-super-agent/config.yaml fi - | if [ "{{.NR_CLI_INFRA_AGENT}}" = "false" ] ; then