2020-08-31 16:47:38 +02:00
|
|
|
# Set up a repo of unsigned rpms
|
|
|
|
- block:
|
2021-02-11 06:32:59 +01:00
|
|
|
- set_fact:
|
|
|
|
pkg_name: langtable
|
|
|
|
pkg_repo_dir: "{{ remote_tmp_dir }}/unsigned"
|
|
|
|
|
2020-08-31 16:47:38 +02:00
|
|
|
- name: Ensure our test package isn't already installed
|
|
|
|
dnf:
|
|
|
|
name:
|
2021-02-11 06:32:59 +01:00
|
|
|
- '{{ pkg_name }}'
|
2020-08-31 16:47:38 +02:00
|
|
|
state: absent
|
|
|
|
|
|
|
|
- name: Install rpm-sign
|
|
|
|
dnf:
|
|
|
|
name:
|
|
|
|
- rpm-sign
|
|
|
|
state: present
|
|
|
|
|
|
|
|
- name: Create directory to use as local repo
|
|
|
|
file:
|
2021-02-11 06:32:59 +01:00
|
|
|
path: "{{ pkg_repo_dir }}"
|
2020-08-31 16:47:38 +02:00
|
|
|
state: directory
|
|
|
|
|
2021-02-11 06:32:59 +01:00
|
|
|
- name: Download the test package
|
|
|
|
dnf:
|
|
|
|
name: '{{ pkg_name }}'
|
|
|
|
state: latest
|
|
|
|
download_only: true
|
|
|
|
download_dir: "{{ pkg_repo_dir }}"
|
2020-08-31 16:47:38 +02:00
|
|
|
|
|
|
|
- name: Unsign the RPM
|
2021-02-11 06:32:59 +01:00
|
|
|
shell: rpmsign --delsign {{ remote_tmp_dir }}/unsigned/{{ pkg_name }}*
|
2020-08-31 16:47:38 +02:00
|
|
|
|
|
|
|
- name: createrepo
|
|
|
|
command: createrepo .
|
|
|
|
args:
|
2021-02-11 06:32:59 +01:00
|
|
|
chdir: "{{ pkg_repo_dir }}"
|
2020-08-31 16:47:38 +02:00
|
|
|
|
|
|
|
- name: Add the repo
|
|
|
|
yum_repository:
|
|
|
|
name: unsigned
|
|
|
|
description: unsigned rpms
|
2021-02-11 06:32:59 +01:00
|
|
|
baseurl: "file://{{ pkg_repo_dir }}"
|
2020-08-31 16:47:38 +02:00
|
|
|
# we want to ensure that signing is verified
|
|
|
|
gpgcheck: true
|
|
|
|
|
2021-02-11 06:32:59 +01:00
|
|
|
- name: Install test package
|
2020-08-31 16:47:38 +02:00
|
|
|
dnf:
|
|
|
|
name:
|
2021-02-11 06:32:59 +01:00
|
|
|
- "{{ pkg_name }}"
|
2020-08-31 16:47:38 +02:00
|
|
|
disablerepo: '*'
|
|
|
|
enablerepo: unsigned
|
|
|
|
register: res
|
|
|
|
ignore_errors: yes
|
|
|
|
|
|
|
|
- assert:
|
|
|
|
that:
|
|
|
|
- res is failed
|
|
|
|
- "'Failed to validate GPG signature' in res.msg"
|
|
|
|
|
|
|
|
always:
|
2021-02-11 06:32:59 +01:00
|
|
|
- name: Remove rpm-sign (and test package if it got installed)
|
2020-08-31 16:47:38 +02:00
|
|
|
dnf:
|
|
|
|
name:
|
|
|
|
- rpm-sign
|
2021-02-11 06:32:59 +01:00
|
|
|
- "{{ pkg_name }}"
|
2020-08-31 16:47:38 +02:00
|
|
|
state: absent
|
|
|
|
|
|
|
|
- name: Remove test repo
|
|
|
|
yum_repository:
|
|
|
|
name: unsigned
|
|
|
|
state: absent
|
|
|
|
|
|
|
|
- name: Remove repo dir
|
|
|
|
file:
|
2021-02-11 06:32:59 +01:00
|
|
|
path: "{{ pkg_repo_dir }}"
|
2020-08-31 16:47:38 +02:00
|
|
|
state: absent
|