From f9c90691510b45ed030cbd09b9379df81f0ffedc Mon Sep 17 00:00:00 2001 From: Oliver Smith Date: Wed, 12 Oct 2022 14:27:53 +0200 Subject: [PATCH] ansible/ttcn3-slave: fix adding apt key Downloading the apt key from obs.osmocom.org returns a 404 error unless an Accept HTTP header is sent. (Yes, really.) Also using apt-key is deprecated, so change it to download the key with get_url as shown in the ansible docs example. Fix for: Failed to download key at https://obs.osmocom.org/projects/osmocom/public_key: HTTP Error 404: Not Found Related: https://github.com/ansible/ansible/issues/50436#issuecomment-451205256 Related: https://docs.ansible.com/ansible/latest/collections/ansible/builtin/apt_key_module.html#examples Change-Id: Idb23231d629ba8a75510deace0d1f130e889d535 --- .../roles/osmocom-jenkins-slave/tasks/ttcn3-slave.yml | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/ansible/roles/osmocom-jenkins-slave/tasks/ttcn3-slave.yml b/ansible/roles/osmocom-jenkins-slave/tasks/ttcn3-slave.yml index 1e61fe5c..67717fc5 100644 --- a/ansible/roles/osmocom-jenkins-slave/tasks/ttcn3-slave.yml +++ b/ansible/roles/osmocom-jenkins-slave/tasks/ttcn3-slave.yml @@ -15,12 +15,17 @@ dest: "/home/{{ jenkins_user }}/jenkins/docker-playground" - name: add apt.key - apt_key: + get_url: url: https://obs.osmocom.org/projects/osmocom/public_key + dest: /etc/apt/trusted.gpg.d/obs.osmocom.org.asc + # OBS webserver needs this header, returns 404 otherwise + # https://github.com/ansible/ansible/issues/50436#issuecomment-451205256 + headers: + Accept: '*/*' - name: add apt repository apt_repository: - repo: "deb https://downloads.osmocom.org/packages/osmocom:/latest/{{ obs_distro }}/ ./" + repo: "deb [signed-by=/etc/apt/trusted.gpg.d/obs.osmocom.org.asc] https://downloads.osmocom.org/packages/osmocom:/latest/{{ obs_distro }}/ ./" filename: obs_osmocom update_cache: yes