diff --git a/recipes/newrelic/infrastructure/debian.yml b/recipes/newrelic/infrastructure/debian.yml index 2b54b8ff5..b47a0a514 100644 --- a/recipes/newrelic/infrastructure/debian.yml +++ b/recipes/newrelic/infrastructure/debian.yml @@ -228,7 +228,11 @@ install: add_gpg_key: cmds: - | - curl -s {{.NEW_RELIC_DOWNLOAD_URL}}infrastructure_agent/keys/newrelic_apt_key_current.gpg | apt-key add - + # Remove the key from the legacy keyring if it exists + sudo rm -f /etc/apt/trusted.gpg.d/newrelic-infra.gpg 2>/dev/null + sudo rm -f /etc/apt/trusted.gpg 2>/dev/null + # Add the key to the correct directory + curl -s {{.NEW_RELIC_DOWNLOAD_URL}}infrastructure_agent/keys/newrelic_apt_key_current.gpg | sudo gpg --dearmor --batch --yes -o /etc/apt/trusted.gpg.d/newrelic-infra.gpg silent: true add_nr_source: diff --git a/recipes/newrelic/infrastructure/ubuntu.yml b/recipes/newrelic/infrastructure/ubuntu.yml index f281f3ffb..4193b9c95 100644 --- a/recipes/newrelic/infrastructure/ubuntu.yml +++ b/recipes/newrelic/infrastructure/ubuntu.yml @@ -210,7 +210,11 @@ install: add_gpg_key: cmds: - | - curl -s {{.NEW_RELIC_DOWNLOAD_URL}}infrastructure_agent/keys/newrelic_apt_key_current.gpg | apt-key add - + # Remove the key from the legacy keyring if it exists + sudo rm -f /etc/apt/trusted.gpg.d/newrelic-infra.gpg 2>/dev/null + sudo rm -f /etc/apt/trusted.gpg 2>/dev/null + # Add the key to the correct directory + curl -s {{.NEW_RELIC_DOWNLOAD_URL}}infrastructure_agent/keys/newrelic_apt_key_current.gpg | sudo gpg --dearmor --batch --yes -o /etc/apt/trusted.gpg.d/newrelic-infra.gpg silent: true add_nr_source: diff --git a/test/definitions/ohi/linux/consul-debian.json b/test/definitions/ohi/linux/consul-debian.json index a92d72525..197b77222 100644 --- a/test/definitions/ohi/linux/consul-debian.json +++ b/test/definitions/ohi/linux/consul-debian.json @@ -18,7 +18,7 @@ "services": [{ "id": "haproxy1", "destinations": ["host1"], - "source_repository": "https://github.com/newrelic/open-install-library.git", + "source_repository": "-b fix/consul-debian https://github.com/newrelic/open-install-library.git", "deploy_script_path": "test/deploy/linux/consul/install/debian/roles", "port": 8500, "params":{ diff --git a/test/deploy/linux/consul/install/debian/roles/configure/tasks/main.yml b/test/deploy/linux/consul/install/debian/roles/configure/tasks/main.yml index 19c2c5338..34df4b9de 100644 --- a/test/deploy/linux/consul/install/debian/roles/configure/tasks/main.yml +++ b/test/deploy/linux/consul/install/debian/roles/configure/tasks/main.yml @@ -19,13 +19,26 @@ state: latest become: yes -- name: Add official HashiCorp GPG Key - shell: curl -fsSL https://apt.releases.hashicorp.com/gpg | sudo apt-key add - - become: true +- name: Download HashiCorp GPG key + shell: | + curl -fsSL https://apt.releases.hashicorp.com/gpg -o /tmp/hashicorp.asc + args: + creates: /tmp/hashicorp.asc + become: yes -- name: Add official HashiCorp Linux Repository - shell: apt-add-repository "deb [arch=amd64] https://apt.releases.hashicorp.com $(lsb_release -cs) main" - become: true +- name: Add HashiCorp GPG key to APT keyring + shell: | + gpg --dearmor -o /usr/share/keyrings/hashicorp-archive-keyring.gpg /tmp/hashicorp.asc + args: + creates: /usr/share/keyrings/hashicorp-archive-keyring.gpg + become: yes + +- name: Add HashiCorp APT repository + apt_repository: + repo: "deb [arch=amd64 signed-by=/usr/share/keyrings/hashicorp-archive-keyring.gpg] https://apt.releases.hashicorp.com bookworm main" + state: present + filename: hashicorp + become: yes - block: - name: Create consul config directory