Skip to content

Commit 9a3b4da

Browse files
committed
Merge remote-tracking branch 'origin/main' into ci/enable-linting
2 parents 5a55e6c + 6e05021 commit 9a3b4da

File tree

38 files changed

+944
-487
lines changed

38 files changed

+944
-487
lines changed

ansible/adhoc/deploy-pulp.yml

Lines changed: 10 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,18 @@
11
---
2-
# Usage: ansible-playbook ansible/adhoc/deploy-pulp.yml -e "pulp_server=<pulp server hostname>"
3-
4-
- name: Add temporary pulp server host
5-
hosts: localhost
6-
tasks:
7-
- ansible.builtin.add_host:
8-
name: "{{ pulp_server }}"
9-
group: "_pulp_host"
10-
11-
- name: Install pulp on server and add to config
12-
become: true
13-
hosts: _pulp_host
2+
- name: Install pulp on server
3+
become: yes
4+
hosts: pulp_server
145
tasks:
156
- name: Install pulp
167
ansible.builtin.include_role:
178
name: pulp_site
189
tasks_from: install.yml
1910
public: true
2011

21-
- name: Print Pulp endpoint
22-
become: false
23-
ansible.builtin.debug:
24-
msg: |
25-
Server configured, override 'appliances_pulp_url' with
26-
appliances_pulp_url: "http://{{ pulp_server }}:{{ pulp_site_port }}"
27-
in your environments
12+
- name: Print Pulp endpoint
13+
become: no
14+
debug:
15+
msg: |
16+
Server configured, override 'appliances_pulp_url' with
17+
appliances_pulp_url: "http://{{ hostvars[groups['pulp_server'] | first].ansible_host }}:{{ pulp_site_port }}"
18+
(or the correct IP if multi-homed) in your environments

ansible/adhoc/sync-pulp.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,5 @@
77
vars:
88
pulp_site_target_arch: "x86_64"
99
pulp_site_target_distribution: "rocky"
10-
pulp_site_target_distribution_version: "9.5"
11-
pulp_site_target_distribution_version_major: "9"
10+
# default distribution to *latest* specified for baseos repo:
11+
pulp_site_target_distribution_version: "{{ dnf_repos_repos['baseos'].keys() | map('float') | sort | last }}"

ansible/ci/update_timestamps.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,15 @@
33
tasks:
44
- name: Get latest timestamps from sources # noqa: syntax-check[unknown-module] # ansible/library/latest_timestamps.py
55
latest_timestamps:
6-
repos_dict: "{{ appliances_pulp_repos }}"
6+
repos_dict: "{{ dnf_repos_default }}"
77
content_url: "https://ark.stackhpc.com/pulp/content"
88
register: _result
99

1010
- name: Overwrite repo timestamps with latest
1111
ansible.builtin.copy:
12-
dest: "{{ appliances_repository_root }}/environments/common/inventory/group_vars/all/timestamps.yml"
12+
dest: "{{ appliances_repository_root }}/environments/common/inventory/group_vars/all/dnf_repo_timestamps.yml"
1313
content: "{{ repo_template | to_nice_yaml(indent=2) }}"
1414
backup: true
1515
vars:
1616
repo_template:
17-
appliances_pulp_repos: "{{ _result.timestamps }}"
17+
dnf_repos_default: "{{ _result.timestamps }}"

ansible/fatimage.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
when: hook_path | exists
2020

2121
- name: Sync pulp repos with upstream
22-
hosts: pulp
22+
hosts: pulp_site
2323
tasks:
2424
- ansible.builtin.include_role:
2525
name: pulp_site

ansible/filter_plugins/utils.py

Lines changed: 11 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -56,21 +56,13 @@ def to_ood_regex(items):
5656

5757
# There's a python bug which means re.sub() can't use '\d' in the replacement so
5858
# have to do replacement in two stages:
59-
r = [re.sub(r"\d+", "XBACKSLASHX", v) for v in items]
60-
r = [v.replace("XBACKSLASHX", "\\d+") for v in set(r)]
61-
r = ["(%s)" % v for v in r] # pylint: disable=consider-using-f-string
62-
return "|".join(r)
59+
r = [re.sub(r"\d+", 'XBACKSLASHX', v) for v in items]
60+
r = [v.replace('XBACKSLASHX', '\d+') for v in set(r)]
61+
r = ['(%s)' % v for v in r]
62+
return '|'.join(r)
6363

64-
65-
def appliances_repo_to_subpath(repo_entry):
66-
"""Take an element from appliances_pulp_repos and convert it to a pulp path.
67-
This assumes that the remote and local pulp structures are the same
68-
"""
69-
return repo_entry["path"] + "/" + repo_entry["timestamp"]
70-
71-
72-
class FilterModule(object): # pylint: disable=useless-object-inheritance
73-
"""Ansible core jinja2 filters"""
64+
class FilterModule(object):
65+
''' Ansible core jinja2 filters '''
7466

7567
# pylint: disable=missing-function-docstring
7668
def warn(self, message, **kwargs): # pylint: disable=unused-argument
@@ -80,10 +72,9 @@ def warn(self, message, **kwargs): # pylint: disable=unused-argument
8072
def filters(self): # pylint: disable=missing-function-docstring
8173
return {
8274
# jinja2 overrides
83-
"readfile": readfile,
84-
"prometheus_node_exporter_targets": prometheus_node_exporter_targets,
85-
"exists": exists,
86-
"warn": self.warn,
87-
"to_ood_regex": to_ood_regex,
88-
"appliances_repo_to_subpath": appliances_repo_to_subpath,
75+
'readfile': readfile,
76+
'prometheus_node_exporter_targets': prometheus_node_exporter_targets,
77+
'exists': exists,
78+
'warn': self.warn,
79+
'to_ood_regex': to_ood_regex,
8980
}

ansible/library/latest_timestamps.py

Lines changed: 7 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -63,24 +63,13 @@ def run_module(): # pylint: disable=missing-function-docstring
6363
for version in timestamps[repo]:
6464

6565
html_txt = requests.get(
66-
url=module.params["content_url"]
67-
+ "/"
68-
+ timestamps[repo][version]["path"]
69-
).text
70-
timestamp_link_list = (
71-
BeautifulSoup(html_txt, features="html.parser")
72-
.body.find("pre")
73-
.find_all()
74-
) # getting raw list of timestamps from html
75-
timestamp_link_list = map(
76-
lambda x: x.string, timestamp_link_list
77-
) # stripping xml tags
78-
latest_timestamp = list(timestamp_link_list)[-1][
79-
:-1
80-
] # last timestamp in list with trailing / removed
81-
timestamps[repo][version]["timestamp"] = latest_timestamp
82-
83-
result["timestamps"] = dict(sorted(timestamps.items()))
66+
url= module.params['content_url'] + '/' + timestamps[repo][version]['pulp_path']
67+
).text
68+
timestamp_link_list = BeautifulSoup(html_txt,features="html.parser").body.find('pre').find_all() # getting raw list of timestamps from html
69+
timestamp_link_list = map(lambda x: x.string,timestamp_link_list) # stripping xml tags
70+
latest_timestamp = list(timestamp_link_list)[-1][:-1] # last timestamp in list with trailing / removed
71+
timestamps[repo][version]['pulp_timestamp'] = latest_timestamp
72+
result['timestamps'] = dict(sorted(timestamps.items()))
8473

8574
module.exit_json(**result)
8675

ansible/roles/cuda/defaults/main.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
---
22
# yamllint disable-line rule:line-length
33
cuda_repo_url: "https://developer.download.nvidia.com/compute/cuda/repos/rhel{{ ansible_distribution_major_version }}/{{ ansible_architecture }}/cuda-rhel{{ ansible_distribution_major_version }}.repo"
4-
cuda_nvidia_driver_stream: "575-open"
5-
cuda_nvidia_driver_pkg: "nvidia-open-3:575.57.08-1.el{{ ansible_distribution_major_version }}"
6-
cuda_package_version: "12.9.1-1"
4+
cuda_nvidia_driver_stream: '580-open'
5+
cuda_nvidia_driver_pkg: "nvidia-open-3:580.65.06-1.el{{ ansible_distribution_major_version }}"
6+
cuda_package_version: '13.0.0-1'
77
cuda_version_short: "{{ (cuda_package_version | split('.'))[0:2] | join('.') }}" # major.minor
88
cuda_packages:
99
- "cuda-toolkit-{{ cuda_package_version }}"

ansible/roles/dnf_repos/README.md

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
dnf_repos
2+
=========
3+
4+
Modifies repo definitions for repofiles in `/etc/yum.repos.d` to point to snapshots in StackHPC's Ark Pulp server or mirrors of them
5+
on a local Pulp server.
6+
7+
Requirements
8+
------------
9+
10+
Requires Ark credentials if using StackHPC's upstream Ark server.
11+
12+
Role Variables
13+
--------------
14+
15+
Variables in this role are also required by `pulp_site` so set in
16+
`environments/common/inventory/groups_vars/all/dnf_repos.yml`. See that file for detailed default values.
17+
18+
- `dnf_repos_repos`: Dict of dicts containing information to construct URLs for Ark snapshots from the target Pulp server for each Rocky version. For example:
19+
```
20+
dnf_repos_repos:
21+
appstream: # ansible.builtin.yum_repository:name
22+
'8.10': # ansible_distribution_version or ansible_distribution_major_version
23+
repo_file: Rocky-AppStream # yum_repository: file
24+
# repo_name: # optional, override yum_repository:name
25+
pulp_path: rocky/8.10/AppStream/x86_64/os # The subpath of the the upstream Ark server's content endpoint URL for the repo's snapshots, see https://ark.stackhpc.com/pulp/content/
26+
pulp_timestamp: 20250614T013846
27+
# pulp_content_url: # optional, dnf_repos_pulp_content_url
28+
'9.6':
29+
...
30+
```
31+
- `dnf_repos_default`: Appliance default repos to use Ark snapshots for. Following same format as `dnf_repos_repos`.
32+
See for appliance default repo list `environments/common/inventory/group_vars/all/dnf_repo_timestamps.yml`.
33+
- `dnf_repos_extra`: Additional repos to use Ark snapshots for. Follows same format as
34+
`dnf_repos_repos`. Defaults to `{}`
35+
- `dnf_repos_pulp_content_url`: Optional str. Content URL of Pulp server to use Ark snapshots from.
36+
Defaults to `{{ appliances_pulp_url }}/pulp/content`
37+
- `dnf_repos_username`: Optional str. Username for Ark. Should be set if using upstream StackHPC Ark
38+
Pulp server, but omitted if using local Pulp server (see `ansible/roles/pulp_site`)
39+
- `dnf_repos_password`: Optional str. Password for Ark. Should be set if using upstream StackHPC Ark
40+
Pulp server, but omitted if using local Pulp server (see `ansible/roles/pulp_site`)
Lines changed: 1 addition & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -1,55 +1,5 @@
11
---
2+
dnf_repos_repos: {} # see environments/common/inventory/group_vars/all/{dnf_repos,timestamps}.yml
23
dnf_repos_pulp_content_url: "{{ appliances_pulp_url }}/pulp/content"
34
dnf_repos_username: "{{ omit }}"
45
dnf_repos_password: "{{ omit }}"
5-
6-
dnf_repos_filenames:
7-
"8":
8-
baseos: "Rocky-BaseOS"
9-
appstream: "Rocky-AppStream"
10-
crb: "Rocky-PowerTools"
11-
extras: "Rocky-Extras"
12-
grafana: "grafana"
13-
"9":
14-
baseos: "rocky"
15-
appstream: "rocky"
16-
crb: "rocky"
17-
extras: "rocky-extras"
18-
grafana: "grafana"
19-
20-
dnf_repos_version_filenames: "{{ dnf_repos_filenames[ansible_distribution_major_version] }}"
21-
22-
# epel installed separately
23-
dnf_repos_default_repolist:
24-
- file: "{{ dnf_repos_version_filenames.baseos }}"
25-
name: baseos
26-
base_url: "{{ dnf_repos_pulp_content_url }}/{{ appliances_pulp_repos.baseos[ansible_distribution_version] | appliances_repo_to_subpath }}"
27-
- file: "{{ dnf_repos_version_filenames.appstream }}"
28-
name: appstream
29-
base_url: "{{ dnf_repos_pulp_content_url }}/{{ appliances_pulp_repos.appstream[ansible_distribution_version] | appliances_repo_to_subpath }}"
30-
- file: "{{ dnf_repos_version_filenames.crb }}"
31-
name: "{{ 'powertools' if ansible_distribution_major_version == '8' else 'crb' }}"
32-
base_url: "{{ dnf_repos_pulp_content_url }}/{{ appliances_pulp_repos.crb[ansible_distribution_version] | appliances_repo_to_subpath }}"
33-
- file: "{{ dnf_repos_version_filenames.extras }}"
34-
name: extras
35-
base_url: "{{ dnf_repos_pulp_content_url }}/{{ appliances_pulp_repos.extras[ansible_distribution_version] | appliances_repo_to_subpath }}"
36-
- file: ceph
37-
name: Ceph
38-
base_url: "{{ dnf_repos_pulp_content_url }}/{{ appliances_pulp_repos.ceph[ansible_distribution_major_version] | appliances_repo_to_subpath }}"
39-
- file: "{{ dnf_repos_version_filenames.grafana }}"
40-
name: grafana
41-
base_url: "{{ dnf_repos_pulp_content_url }}/{{ appliances_pulp_repos.grafana[ansible_distribution_major_version] | appliances_repo_to_subpath }}"
42-
43-
dnf_repos_openhpc_repolist:
44-
- name: OpenHPC
45-
file: OpenHPC
46-
base_url: "{{ dnf_repos_pulp_content_url }}/{{ appliances_pulp_repos.openhpc_base[ansible_distribution_major_version] | appliances_repo_to_subpath }}"
47-
- name: OpenHPC-updates
48-
file: OpenHPC
49-
base_url: "{{ dnf_repos_pulp_content_url }}/{{ appliances_pulp_repos.openhpc_updates[ansible_distribution_major_version] | appliances_repo_to_subpath }}"
50-
51-
dnf_repos_extra_repolist: []
52-
dnf_repos_repolist: "{{ dnf_repos_default_repolist + (dnf_repos_openhpc_repolist if (openhpc_install_type | default('ohpc')) == 'ohpc' else []) + dnf_repos_extra_repolist }}" # noqa: yaml[line-length]
53-
54-
dnf_repos_epel_baseurl: "{{ dnf_repos_pulp_content_url }}/{{ appliances_pulp_repos.epel[ansible_distribution_major_version] | appliances_repo_to_subpath }}"
55-
dnf_repos_epel_description: "epel"

ansible/roles/dnf_repos/tasks/disable_repos.yml

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,20 @@
11
---
22
- name: Remove password and disable Pulp repos
33
ansible.builtin.yum_repository:
4-
file: "{{ item.file }}"
5-
name: "{{ item.name }}"
6-
baseurl: "{{ item.base_url }}"
7-
description: "{{ item.name }}"
4+
file: "{{ repo_values.repo_file }}"
5+
name: "{{ repo_name }}"
6+
baseurl: "{{ repo_content_url }}/{{ repo_values.pulp_path }}/{{ repo_values.pulp_timestamp }}"
7+
description: "{{ repo_name }}"
88
enabled: false
9-
loop: "{{ dnf_repos_repolist }}"
10-
11-
- name: Remove password and disable EPEL repo
12-
ansible.builtin.yum_repository:
13-
name: epel
14-
file: epel
15-
description: "{{ dnf_repos_epel_description }}"
16-
baseurl: "{{ dnf_repos_epel_baseurl }}"
179
gpgcheck: false
18-
enabled: false
10+
loop: "{{ dnf_repos_repos | dict2items }}"
11+
loop_control:
12+
label: "{{ repo_name }}[{{ repo_os }}]: {{ repo_values }}"
13+
vars:
14+
repo_os: "{{ ansible_distribution_version if ansible_distribution_version in item.value else ansible_distribution_major_version }}"
15+
repo_values: "{{ item.value[repo_os] }}"
16+
repo_name: "{{ repo_values.repo_name | default(item.key) }}"
17+
repo_content_url: "{{ repo_values.pulp_content_url | default(dnf_repos_pulp_content_url) }}"
1918

2019
- name: Get all repo files
2120
ansible.builtin.find:

0 commit comments

Comments
 (0)