From acc08a795fd8e56ee3777e2e27fc2bca7c227137 Mon Sep 17 00:00:00 2001 From: Tobias Huste Date: Fri, 1 Mar 2024 20:54:34 +0100 Subject: [PATCH] Register debian repository using deb822_repository --- README.md | 16 ---------------- defaults/main.yml | 6 ------ molecule/default/prepare.yml | 1 + tasks/install.debianlike.yml | 29 ++++++++++------------------- 4 files changed, 11 insertions(+), 41 deletions(-) diff --git a/README.md b/README.md index 29d282f..4ac5f56 100644 --- a/README.md +++ b/README.md @@ -35,28 +35,12 @@ gitlab_runner_pkg_version: "16.9.0-1" The version to be used to determine the GitLab-Runner [package](https://packages.gitlab.com/runner/gitlab-runner) (optional). -```yaml -gitlab_runner_apt_repo: "deb https://packages.gitlab.com/runner/gitlab-runner/{{ ansible_distribution | lower }}/ {{ ansible_distribution_release }} main" -``` -The repository URL where to install the packages from. - ```yaml gitlab_runner_deb_file: "" ``` If this is specified the package will be installed from a `.deb`-file. If `://` is in the path, Ansible will attempt to download deb before installing. -```yaml -gitlab_gpg_key_id: "F6403F6544A38863DAA0B6E03F01618A51312F3F" -``` -Identifier of GPG key that was used to sign the packages. - - -```yaml -gitlab_gpg_old_key_ids: [] -``` -A list to specify expired GPG keys that should be absent. - ```yaml gitlab_runner_concurrent: 1 ``` diff --git a/defaults/main.yml b/defaults/main.yml index 2e369dc..6d68069 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -8,14 +8,8 @@ gitlab_runner_version: "" gitlab_runner_pkg_version: "{{ gitlab_runner_version + '-1' if gitlab_runner_version | length > 0 and gitlab_runner_version is version('16.9.0', 'ge') else gitlab_runner_version }}" -gitlab_runner_apt_repo: "deb https://packages.gitlab.com/runner/gitlab-runner/{{ ansible_distribution | lower }}/ {{ ansible_distribution_release }} main" - gitlab_runner_deb_file: "" -gitlab_gpg_key_id: "F6403F6544A38863DAA0B6E03F01618A51312F3F" - -gitlab_gpg_old_key_ids: [] - gitlab_runner_docker_machine_binary_url: "https://gitlab.com/gitlab-org/ci-cd/docker-machine/-/releases/v0.16.2-gitlab.25/downloads/docker-machine-Linux-{{ ansible_architecture }}" gitlab_runner_docker_machine_binary_checksum: "sha256:04cc18c8f6ee0d71614064fa81116f20f3a37af53eeebf19bfb832ab9c46d3a0" diff --git a/molecule/default/prepare.yml b/molecule/default/prepare.yml index 0a3ee49..be1e522 100644 --- a/molecule/default/prepare.yml +++ b/molecule/default/prepare.yml @@ -17,6 +17,7 @@ - iproute2 # for gathering network facts - ca-certificates # for Gitlab-Runner download - gpg + - python3-debian state: present update_cache: yes - name: Set up iptables diff --git a/tasks/install.debianlike.yml b/tasks/install.debianlike.yml index 6efb45f..0f27ee0 100644 --- a/tasks/install.debianlike.yml +++ b/tasks/install.debianlike.yml @@ -18,25 +18,16 @@ when: gitlab_runner_deb_file | length == 0 block: - - name: Remove old runner/gitlab-runner GPG key - ansible.builtin.apt_key: - id: "{{ item }}" - state: absent - loop: "{{ gitlab_gpg_old_key_ids }}" - - - name: Add runner/gitlab-runner GPG key - ansible.builtin.apt_key: - url: https://packages.gitlab.com/runner/gitlab-runner/gpgkey - id: "{{ gitlab_gpg_key_id }}" - state: present - - - name: Add packages repository packages.gitlab.com/runner/gitlab-runner - ansible.builtin.apt_repository: - repo: "{{ gitlab_runner_apt_repo }}" - state: present - mode: '0644' - filename: gitlab-runner - update_cache: yes + - name: "Add packages repository packages.gitlab.com/runner/gitlab-runner" + ansible.builtin.deb822_repository: + name: "gitlab-runner" + types: "deb" + uris: "https://packages.gitlab.com/runner/gitlab-runner/{{ ansible_distribution | lower }}/" + suites: "{{ ansible_distribution_release }}" + components: "main" + signed_by: "https://packages.gitlab.com/runner/gitlab-runner/gpgkey" + state: "present" + enabled: true - name: "Use APT pinning for Debian os" ansible.builtin.template: