Skip to content

Commit 134b627

Browse files
committed
WIP: refactor repos definitions
1 parent b7bd7a9 commit 134b627

File tree

4 files changed

+106
-94
lines changed

4 files changed

+106
-94
lines changed

ansible/filter_plugins/utils.py

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -61,11 +61,6 @@ def to_ood_regex(items):
6161
r = ['(%s)' % v for v in r]
6262
return '|'.join(r)
6363

64-
def appliances_repo_to_subpath(repo_entry):
65-
""" Take an element from appliances_pulp_repos and convert it to a pulp path. This assumes that the remote and local pulp structures are the same
66-
"""
67-
return repo_entry['path'] + '/' + repo_entry['timestamp']
68-
6964
class FilterModule(object):
7065
''' Ansible core jinja2 filters '''
7166

@@ -81,5 +76,4 @@ def filters(self):
8176
'exists': exists,
8277
'warn': self.warn,
8378
'to_ood_regex': to_ood_regex,
84-
'appliances_repo_to_subpath': appliances_repo_to_subpath
8579
}

ansible/roles/dnf_repos/defaults/main.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
dnf_repos_default: {} # see environments/common/inventory/group_vars/all/timestamps.yml
2+
dnf_repos_extra: {}
13
dnf_repos_pulp_content_url: "{{ appliances_pulp_url }}/pulp/content"
24
dnf_repos_username: "{{ omit }}"
35
dnf_repos_password: "{{ omit }}"

ansible/roles/dnf_repos/tasks/set_repos.yml

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,23 @@
22

33
- name: Replace system repos with Pulp repos
44
ansible.builtin.yum_repository:
5-
file: "{{ item.file }}"
6-
name: "{{ item.name }}"
7-
baseurl: "{{ item.base_url }}"
8-
description: "{{ item.name }}"
5+
file: "{{ repo_values.repo_file }}"
6+
name: "{{ repo_name }}"
7+
baseurl: "{{ repo_content_url }}/{{ repo_values.pulp_path }}/{{ repo_values.pulp_timestamp }}"
8+
description: "{{ repo_name }}"
99
username: "{{ dnf_repos_username }}"
1010
password: "{{ dnf_repos_password }}"
1111
gpgcheck: false
12-
loop: "{{ dnf_repos_repolist }}"
12+
loop: "{{ dnf_repos_default | combine(dnf_repos_extra) | dict2items }}"
13+
loop_control:
14+
label: "{{ repo_name }}[{{ repo_os }}]: {{ repo_values }}"
15+
vars:
16+
repo_name: "{{ item.key }}"
17+
repo_os: "{{ ansible_distribution_version if ansible_distribution_version in item.value else ansible_distribution_major_version }}"
18+
repo_values: "{{ item.value[repo_os] }}"
19+
repo_content_url: "{{ repo_values.pulp_content_url | default(dnf_repos_pulp_content_url) }}"
20+
21+
- meta: end_here
1322

1423
- name: Install epel-release
1524
# done so that roles installing epel via epel-release don't over-write our changes to the epel repo
Lines changed: 90 additions & 83 deletions
Original file line numberDiff line numberDiff line change
@@ -1,88 +1,95 @@
1-
appliances_pulp_repos:
2-
appstream:
3-
'8.10':
4-
path: rocky/8.10/AppStream/x86_64/os
5-
timestamp: 20250614T013846
1+
dnf_repos_default:
2+
appstream: # yum_repository:name
3+
'8.10': # ansible_distribution_version or ansible_distribution_major_version
4+
repo_file: Rocky-AppStream # yum_repository: file
5+
pulp_path: rocky/8.10/AppStream/x86_64/os
6+
pulp_timestamp: 20250614T013846
7+
# pulp_content_url: # optional
68
'9.4':
7-
path: rocky/9.4/AppStream/x86_64/os
8-
timestamp: 20241112T003151
9+
repo_file: rocky
10+
pulp_path: rocky/9.4/AppStream/x86_64/os
11+
pulp_timestamp: 20241112T003151
912
'9.5':
10-
path: rocky/9.5/AppStream/x86_64/os
11-
timestamp: 20250514T014704
13+
repo_file: rocky
14+
pulp_path: rocky/9.5/AppStream/x86_64/os
15+
pulp_timestamp: 20250514T014704
1216
'9.6':
13-
path: rocky/9.6/AppStream/x86_64/os
14-
timestamp: 20250726T040613
15-
baseos:
16-
'8.10':
17-
path: rocky/8.10/BaseOS/x86_64/os
18-
timestamp: 20250614T013846
19-
'9.4':
20-
path: rocky/9.4/BaseOS/x86_64/os
21-
timestamp: 20241115T011711
22-
'9.5':
23-
path: rocky/9.5/BaseOS/x86_64/os
24-
timestamp: 20250513T031844
25-
'9.6':
26-
path: rocky/9.6/BaseOS/x86_64/os
27-
timestamp: 20250726T052250
28-
ceph:
29-
'8':
30-
path: centos/8-stream/storage/x86_64/ceph-quincy
31-
timestamp: 20231104T015751
32-
'9':
33-
path: centos/9-stream/storage/x86_64/ceph-reef
34-
timestamp: 20250617T023108
35-
crb:
36-
'8.10':
37-
path: rocky/8.10/PowerTools/x86_64/os
38-
timestamp: 20250614T013846
39-
'9.4':
40-
path: rocky/9.4/CRB/x86_64/os
41-
timestamp: 20241115T003133
42-
'9.5':
43-
path: rocky/9.5/CRB/x86_64/os
44-
timestamp: 20250514T014704
45-
'9.6':
46-
path: rocky/9.6/CRB/x86_64/os
47-
timestamp: 20250726T040613
48-
epel:
49-
'8':
50-
path: epel/8/Everything/x86_64
51-
timestamp: 20250615T234151
52-
'9':
53-
path: epel/9/Everything/x86_64
54-
timestamp: 20250729T235750
55-
extras:
56-
'8.10':
57-
path: rocky/8.10/extras/x86_64/os
58-
timestamp: 20250510T032327
59-
'9.4':
60-
path: rocky/9.4/extras/x86_64/os
61-
timestamp: 20241118T002802
62-
'9.5':
63-
path: rocky/9.5/extras/x86_64/os
64-
timestamp: 20250506T032818
65-
'9.6':
66-
path: rocky/9.6/extras/x86_64/os
67-
timestamp: 20250726T040613
68-
grafana:
69-
'8':
70-
path: grafana/oss/rpm
71-
timestamp: 20250615T005738
72-
'9':
73-
path: grafana/oss/rpm
74-
timestamp: 20250730T011314
75-
openhpc_base:
76-
'8':
77-
path: OpenHPC/2/EL_8
78-
timestamp: 20241218T154614
79-
'9':
80-
path: OpenHPC/3/EL_9
81-
timestamp: 20241218T154614
82-
openhpc_updates:
17+
repo_file: rocky
18+
pulp_path: rocky/9.6/AppStream/x86_64/os
19+
pulp_timestamp: 20250726T040613
20+
# baseos:
21+
# '8.10':
22+
# path: rocky/8.10/BaseOS/x86_64/os
23+
# timestamp: 20250614T013846
24+
# '9.4':
25+
# path: rocky/9.4/BaseOS/x86_64/os
26+
# timestamp: 20241115T011711
27+
# '9.5':
28+
# path: rocky/9.5/BaseOS/x86_64/os
29+
# timestamp: 20250513T031844
30+
# '9.6':
31+
# path: rocky/9.6/BaseOS/x86_64/os
32+
# timestamp: 20250726T052250
33+
Ceph:
8334
'8':
84-
path: OpenHPC/2/updates/EL_8
85-
timestamp: 20250512T003315
35+
repo_file: ceph
36+
pulp_path: centos/8-stream/storage/x86_64/ceph-quincy
37+
pulp_timestamp: 20231104T015751
8638
'9':
87-
path: OpenHPC/3/updates/EL_9
88-
timestamp: 20250510T003301
39+
repo_file: ceph
40+
pulp_path: centos/9-stream/storage/x86_64/ceph-reef
41+
pulp_timestamp: 20250617T023108
42+
# crb:
43+
# '8.10':
44+
# path: rocky/8.10/PowerTools/x86_64/os
45+
# timestamp: 20250614T013846
46+
# '9.4':
47+
# path: rocky/9.4/CRB/x86_64/os
48+
# timestamp: 20241115T003133
49+
# '9.5':
50+
# path: rocky/9.5/CRB/x86_64/os
51+
# timestamp: 20250514T014704
52+
# '9.6':
53+
# path: rocky/9.6/CRB/x86_64/os
54+
# timestamp: 20250726T040613
55+
# epel:
56+
# '8':
57+
# path: epel/8/Everything/x86_64
58+
# timestamp: 20250615T234151
59+
# '9':
60+
# path: epel/9/Everything/x86_64
61+
# timestamp: 20250729T235750
62+
# extras:
63+
# '8.10':
64+
# path: rocky/8.10/extras/x86_64/os
65+
# timestamp: 20250510T032327
66+
# '9.4':
67+
# path: rocky/9.4/extras/x86_64/os
68+
# timestamp: 20241118T002802
69+
# '9.5':
70+
# path: rocky/9.5/extras/x86_64/os
71+
# timestamp: 20250506T032818
72+
# '9.6':
73+
# path: rocky/9.6/extras/x86_64/os
74+
# timestamp: 20250726T040613
75+
# grafana:
76+
# '8':
77+
# path: grafana/oss/rpm
78+
# timestamp: 20250615T005738
79+
# '9':
80+
# path: grafana/oss/rpm
81+
# timestamp: 20250730T011314
82+
# openhpc_base:
83+
# '8':
84+
# path: OpenHPC/2/EL_8
85+
# timestamp: 20241218T154614
86+
# '9':
87+
# path: OpenHPC/3/EL_9
88+
# timestamp: 20241218T154614
89+
# openhpc_updates:
90+
# '8':
91+
# path: OpenHPC/2/updates/EL_8
92+
# timestamp: 20250512T003315
93+
# '9':
94+
# path: OpenHPC/3/updates/EL_9
95+
# timestamp: 20250510T003301

0 commit comments

Comments
 (0)