
This role allows users to supply a common variable and it will contain all the logic to configure the correct repository based on their operating system. Co-Authored-By: Andreas Jaeger <aj@suse.com> Change-Id: I4a3ab5f099c2e4671b78c751d8f0e8ccf2304afa
37 lines
1.1 KiB
YAML
37 lines
1.1 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: Add repositories
|
|
yum_repository:
|
|
name: "{{ 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
|