zuul-jobs/roles/ensure-package-repositories/tasks/RedHat.yaml
Sorin Sbarnea 9f222677e2 ensure-docker: workaround for centos-8 conflicts
- assured configured repository is based on original repository definition
- workaround for bypassing rpm installation conflicts
  on CentOS/RHEL-8.
- we no longer need special dnf command for installation.

Change-Id: I0b2ccd788f8010b864c45140189dcb215e7c82fb
2020-05-19 19:16:20 +01:00

43 lines
1.2 KiB
YAML

- name: Create GPG key temp directory
tempfile:
prefix: "GPG_keys"
state: directory
register: gpg_key_tempdir
- name: Upload GPG keys
copy:
content: "{{ zj_item['data'] }}"
dest: "{{ gpg_key_tempdir.path }}/key-{{ zj_idx }}.gpg"
loop: "{{ repositories_keys }}"
loop_control:
loop_var: zj_item
index_var: zj_idx
when: "'data' in zj_item"
- name: Import GPG keys
become: true
rpm_key:
key: "{{ ('url' in zj_item) | ternary(zj_item['url'], ('data' in zj_item) | ternary(gpg_key_tempdir.path + '/key-' ~ zj_idx ~ '.gpg', zj_item['key'])) }}"
state: present
loop: "{{ repositories_keys }}"
loop_control:
loop_var: zj_item
index_var: zj_idx
- name: Remove GPG temp directory
file:
state: absent
path: '{{ gpg_key_tempdir.path }}'
- name: Add repositories
yum_repository:
name: "{{ zj_item['name'] }}"
file: "{{ zj_item['file'] | default(zj_item['name']) }}"
description: "{{ zj_item['description'] | default(omit) }}"
baseurl: "{{ zj_item['baseurl'] | default(omit) }}"
gpgcheck: "{{ zj_item['gpgcheck'] | default(omit) }}"
gpgkey: "{{ zj_item['gpgkey'] | default(omit) }}"
loop: "{{ repositories_list }}"
loop_control:
loop_var: zj_item