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
This commit is contained in:
Oliver Smith 2022-10-12 14:27:53 +02:00
parent ed03bc78ed
commit f9c9069151
1 changed files with 7 additions and 2 deletions

View File

@ -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