From 1374756dd061d4978168b7bd07bef98f0ad62482 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Sachse?= <joerg.sachse@slub-dresden.de> Date: Wed, 21 Feb 2024 14:24:04 +0100 Subject: [PATCH] style: use deb822 format and remove deprecated apt_key (resolves #2233 / ND-2723) --- .gitlab-ci.yml | 4 +++ molecule/resources/playbooks/prepare.yml | 34 +++++++++++++++--------- molecule/virtualbox/molecule.yml | 2 +- 3 files changed, 26 insertions(+), 14 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index cc2d38a..3ffe55f 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -16,6 +16,10 @@ default: - source /opt/molecule/bin/activate - molecule destroy --scenario-name default +variables: + ANSIBLE_FORCE_COLOR: 'true' + PY_COLORS: '1' + test-job: stage: test tags: diff --git a/molecule/resources/playbooks/prepare.yml b/molecule/resources/playbooks/prepare.yml index d3dbe45..43c1ff2 100644 --- a/molecule/resources/playbooks/prepare.yml +++ b/molecule/resources/playbooks/prepare.yml @@ -3,6 +3,7 @@ hosts: "*" pre_tasks: - name: configure additional package repositories for Debian + when: ansible_os_family == "Debian" block: - name: install GPG ansible.builtin.apt: @@ -10,21 +11,21 @@ state: latest update_cache: true become: true - - name: add GPG key for SLUB Debian repository - ansible.builtin.apt_key: - url: "https://sdvdebianrepo.slub-dresden.de/deb-repository/pub.gpg.key" - state: present - become: true - - name: add repo URL to sources.list - ansible.builtin.apt_repository: - repo: "deb https://sdvdebianrepo.slub-dresden.de/deb-repository bullseye main" - state: present - update_cache: true - mode: "0644" + - name: add custom repo for SLUB's custom Debian repo + ansible.builtin.deb822_repository: + architectures: "amd64" + components: "main" + enabled: true + name: "slub" + pdiffs: true + signed_by: "https://sdvdebianrepo.slub-dresden.de/deb-repository/pub.gpg.key" + suites: "{{ ansible_lsb.codename }}" + uris: "https://sdvdebianrepo.slub-dresden.de/deb-repository" + notify: update package cache become: true - when: ansible_os_family == "Debian" - name: configure additional package repositories for RedHat + when: ansible_os_family == "RedHat" block: - name: add custom repositories ansible.builtin.yum_repository: @@ -42,8 +43,15 @@ description: SLUB YUM repo baseurl: "http://sdvrhelrepo.slub-dresden.de/" gpgcheck: "false" + notify: update package cache - name: remove legacy repo configuration to avoid double configuration for SLUB repo ansible.builtin.file: path: "/etc/yum.repos.d/SLUB.repo" state: absent - when: ansible_os_family == "RedHat" + notify: update package cache + + handlers: + - name: update package cache + ansible.builtin.package: + update_cache: true + become: true diff --git a/molecule/virtualbox/molecule.yml b/molecule/virtualbox/molecule.yml index d577cdf..74f3dd9 100644 --- a/molecule/virtualbox/molecule.yml +++ b/molecule/virtualbox/molecule.yml @@ -13,7 +13,7 @@ platforms: # https://github.com/ansible-community/molecule-vagrant#documentation # for more platform parameters. - name: mol-samity - box: debian/bullseye64 + box: debian/bookworm64 memory: 1024 # List of raw Vagrant `config` options. # provider_raw_config_args: -- GitLab