Skip to content

Commit

Permalink
Support repos with GPG
Browse files Browse the repository at this point in the history
  • Loading branch information
sdickenson committed Oct 14, 2023
1 parent 4db4bbe commit 56fa905
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 4 deletions.
3 changes: 3 additions & 0 deletions defaults/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ repos_enable_epel: true
# - name: mysql-5.6-community
# gpg_key_url: http://repo.mysql.com/RPM-GPG-KEY-mysql
# base_url: http://repo.mysql.com/yum/mysql-5.6-community/el/7/x86_64/
# - name: my-custom-repo
# gpg_check: 0
# base_url: https://repo.server.lan/yum/
repos_custom_repos: []

# Install custom repos from an RPM package hosted on the internet. A list of urls
Expand Down
7 changes: 4 additions & 3 deletions tasks/customrepos.yaml
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
---
- name: install pulp rpm gpg keys
- name: install custom rpm gpg keys
rpm_key:
state: present
key: "{{ item.gpg_key_url }}"
key: item.gpg_key_url
when: item.gpg_key_url | default(false)
with_items: "{{ repos_custom_repos }}"

- name: copy pulp repo file
- name: copy custom repo file
template: src=etc.yum.repos.d.custom.repo.j2 dest={{ repos_location }}/custom.repo owner=root group=root mode=0644

- name: Install repos from rpm
Expand Down
4 changes: 3 additions & 1 deletion templates/etc.yum.repos.d.custom.repo.j2
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@
[{{ repo.name }}]
name = {{ repo.name }}
enabled = 1
gpgcheck = 1
gpgcheck = {{ repo.gpg_check | default('1') }}
{% if repo.gpg_key_url | default(false) %}
gpgkey = {{ repo.gpg_key_url }}
{% endif %}
baseurl = {{ repo.base_url }}
{% endfor %}

0 comments on commit 56fa905

Please sign in to comment.