Skip to content

Commit 440f99a

Browse files
authored
Merge pull request #151 from stackhpc/update/custom-repo-urls
Ensure repo files using yum_repository
2 parents 36bee31 + 7604aa4 commit 440f99a

File tree

6 files changed

+102
-37
lines changed

6 files changed

+102
-37
lines changed

README.md

Lines changed: 23 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -10,16 +10,27 @@ The minimal image for nodes is a CentOS 7 or RockyLinux 8 GenericCloud image. Th
1010

1111
## Role Variables
1212

13-
`openhpc_release_repo`: Optional. Path to the `ohpc-release` repo to use. Defaults provide v1.3 for Centos 7 and v2 for Centos 8. Or, include this
14-
package in the image.
15-
16-
`openhpc_slurm_service_enabled`: boolean, whether to enable the appropriate slurm service (slurmd/slurmctld)
13+
`openhpc_version`: Optional. OpenHPC version to install. Defaults provide `1.3` for Centos 7 and `2` for RockyLinux/CentOS 8.
14+
15+
`openhpc_extra_repos`: Optional list. Extra Yum repository definitions to configure, following the format of the Ansible
16+
[yum_repository](https://docs.ansible.com/ansible/2.9/modules/yum_repository_module.html) module. Respected keys for
17+
each list element:
18+
* `name`: Required
19+
* `description`: Optional
20+
* `file`: Required
21+
* `baseurl`: Optional
22+
* `metalink`: Optional
23+
* `mirrorlist`: Optional
24+
* `gpgcheck`: Optional
25+
* `gpgkey`: Optional
26+
27+
`openhpc_slurm_service_enabled`: boolean, whether to enable the appropriate slurm service (slurmd/slurmctld).
1728

1829
`openhpc_slurm_service_started`: Optional boolean. Whether to start slurm services. If set to false, all services will be stopped. Defaults to `openhpc_slurm_service_enabled`.
1930

20-
`openhpc_slurm_control_host`: ansible host name of the controller e.g `"{{ groups['cluster_control'] | first }}"`
31+
`openhpc_slurm_control_host`: ansible host name of the controller e.g `"{{ groups['cluster_control'] | first }}"`.
2132

22-
`openhpc_packages`: additional OpenHPC packages to install
33+
`openhpc_packages`: additional OpenHPC packages to install.
2334

2435
`openhpc_enable`:
2536
* `control`: whether to enable control host
@@ -62,7 +73,7 @@ For each group (if used) or partition any nodes in an ansible inventory group `<
6273

6374
`openhpc_job_maxtime`: Maximum job time limit, default `'60-0'` (60 days). See [slurm.conf](https://slurm.schedmd.com/slurm.conf.html) parameter `MaxTime` for format. The default is 60 days. The value should be quoted to avoid Ansible conversions.
6475

65-
`openhpc_cluster_name`: name of the cluster
76+
`openhpc_cluster_name`: name of the cluster.
6677

6778
`openhpc_config`: Optional. Mapping of additional parameters and values for `slurm.conf`. Note these will override any included in `templates/slurm.conf.j2`.
6879

@@ -99,9 +110,9 @@ accounting data such as start and end times. By default no job accounting is con
99110
`jobcomp/filetxt`, `jobcomp/none`, `jobcomp/elasticsearch`.
100111

101112
`openhpc_slurm_job_acct_gather_type`: Mechanism for collecting job accounting data. Can be one
102-
of `jobacct_gather/linux`, `jobacct_gather/cgroup` and `jobacct_gather/none`
113+
of `jobacct_gather/linux`, `jobacct_gather/cgroup` and `jobacct_gather/none`.
103114

104-
`openhpc_slurm_job_acct_gather_frequency`: Sampling period for job accounting (seconds)
115+
`openhpc_slurm_job_acct_gather_frequency`: Sampling period for job accounting (seconds).
105116

106117
`openhpc_slurm_job_comp_loc`: Location to store the job accounting records. Depends on value of
107118
`openhpc_slurm_job_comp_type`, e.g for `jobcomp/filetxt` represents a path on disk.
@@ -111,15 +122,15 @@ accounting data such as start and end times. By default no job accounting is con
111122
The following options affect `slurmdbd.conf`. Please see the slurm [documentation](https://slurm.schedmd.com/slurmdbd.conf.html) for more details.
112123
You will need to configure these variables if you have set `openhpc_enable.database` to `true`.
113124

114-
`openhpc_slurmdbd_port`: Port for slurmdb to listen on, defaults to `6819`
125+
`openhpc_slurmdbd_port`: Port for slurmdb to listen on, defaults to `6819`.
115126

116127
`openhpc_slurmdbd_mysql_host`: Hostname or IP Where mariadb is running, defaults to `openhpc_slurm_control_host`.
117128

118-
`openhpc_slurmdbd_mysql_database`: Database to use for accounting, defaults to `slurm_acct_db`
129+
`openhpc_slurmdbd_mysql_database`: Database to use for accounting, defaults to `slurm_acct_db`.
119130

120131
`openhpc_slurmdbd_mysql_password`: Password for authenticating with the database. You must set this variable.
121132

122-
`openhpc_slurmdbd_mysql_username`: Username for authenticating with the database, defaults to `slurm`
133+
`openhpc_slurmdbd_mysql_username`: Username for authenticating with the database, defaults to `slurm`.
123134

124135
## Example Inventory
125136

defaults/main.yml

Lines changed: 52 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
---
2+
openhpc_version: "{{ '1.3' if ansible_distribution_major_version == '7' else '2' }}"
23
openhpc_slurm_service_enabled: true
34
openhpc_slurm_service_started: "{{ openhpc_slurm_service_enabled }}"
45
openhpc_slurm_service:
@@ -48,9 +49,57 @@ openhpc_enable:
4849
ohpc_slurm_services:
4950
control: slurmctld
5051
batch: slurmd
51-
ohpc_release_repos:
52-
"7": "https://github.com/openhpc/ohpc/releases/download/v1.3.GA/ohpc-release-1.3-1.el7.x86_64.rpm" # ohpc v1.3 for Centos 7
53-
"8": "http://repos.openhpc.community/OpenHPC/2/EL_8/x86_64/ohpc-release-2-1.el8.x86_64.rpm" # ohpc v2 for Rocky 8
52+
53+
# Repository configuration
54+
openhpc_extra_repos: []
55+
56+
ohpc_openhpc_repos:
57+
"7":
58+
- name: OpenHPC
59+
file: OpenHPC.repo
60+
description: "OpenHPC-1.3 - Base"
61+
baseurl: "http://build.openhpc.community/OpenHPC:/1.3/CentOS_7"
62+
gpgcheck: true
63+
gpgkey: https://raw.githubusercontent.com/openhpc/ohpc/v1.3.5.GA/components/admin/ohpc-release/SOURCES/RPM-GPG-KEY-OpenHPC-1
64+
- name: OpenHPC-updates
65+
file: OpenHPC.repo
66+
description: "OpenHPC-1.3 - Updates"
67+
baseurl: "http://build.openhpc.community/OpenHPC:/1.3/updates/CentOS_7"
68+
gpgcheck: true
69+
gpgkey: https://raw.githubusercontent.com/openhpc/ohpc/v1.3.5.GA/components/admin/ohpc-release/SOURCES/RPM-GPG-KEY-OpenHPC-1
70+
"8":
71+
- name: OpenHPC
72+
file: OpenHPC.repo
73+
description: OpenHPC-2 - Base
74+
baseurl: "http://repos.openhpc.community/OpenHPC/2/CentOS_8"
75+
gpgcheck: true
76+
gpgkey: https://raw.githubusercontent.com/openhpc/ohpc/v2.6.1.GA/components/admin/ohpc-release/SOURCES/RPM-GPG-KEY-OpenHPC-2
77+
- name: OpenHPC-updates
78+
file: OpenHPC.repo
79+
description: OpenHPC-2 - Updates
80+
baseurl: "http://repos.openhpc.community/OpenHPC/2/updates/CentOS_8"
81+
gpgcheck: true
82+
gpgkey: https://raw.githubusercontent.com/openhpc/ohpc/v2.6.1.GA/components/admin/ohpc-release/SOURCES/RPM-GPG-KEY-OpenHPC-2
83+
84+
ohpc_default_extra_repos:
85+
"7":
86+
- name: epel
87+
file: epel.repo
88+
description: "Extra Packages for Enterprise Linux 7 - $basearch"
89+
metalink: "https://mirrors.fedoraproject.org/metalink?repo=epel-7&arch=$basearch&infra=$infra&content=$contentdir"
90+
gpgcheck: true
91+
gpgkey: "https://dl.fedoraproject.org/pub/epel/RPM-GPG-KEY-EPEL-7"
92+
"8":
93+
- name: epel
94+
file: epel.repo
95+
description: "Extra Packages for Enterprise Linux 8 - $basearch"
96+
metalink: "https://mirrors.fedoraproject.org/metalink?repo=epel-8&arch=$basearch&infra=$infra&content=$contentdir"
97+
gpgcheck: true
98+
gpgkey: "https://dl.fedoraproject.org/pub/epel/RPM-GPG-KEY-EPEL-8"
99+
100+
# Concatenate all repo definitions here
101+
ohpc_repos: "{{ ohpc_openhpc_repos[ansible_distribution_major_version] + ohpc_default_extra_repos[ansible_distribution_major_version] + openhpc_extra_repos }}"
102+
54103
openhpc_munge_key:
55104
openhpc_login_only_nodes: ''
56105
openhpc_module_system_install: true

tasks/drain.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
- name: Drain compute node
1515
command: "scontrol update nodename={{ inventory_hostname }} state=DRAIN reason='maintenance'"
1616
when: inventory_hostname not in drained_nodes_results.stdout_lines
17+
changed_when: true
1718

1819
- name: Check node has drained
1920
command: "sinfo --noheader --Node --format='%N' --states=DRAINED"

tasks/install.yml

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,22 @@
11
---
22

3-
- name: Gather package facts
4-
package_facts:
5-
manager: rpm
6-
7-
- name: Install ohpc-release package
8-
yum:
9-
name: "{{ openhpc_release_repo | default(ohpc_release_repos[ansible_distribution_major_version]) }}"
10-
state: present
11-
disable_gpg_check: True
12-
when: "'ohpc-release' not in ansible_facts.packages"
13-
14-
- name: Update package facts
15-
package_facts:
16-
manager: rpm
3+
- name: Ensure OpenHPC repos
4+
ansible.builtin.yum_repository:
5+
name: "{{ item.name }}"
6+
description: "{{ item.description | default(omit) }}"
7+
file: "{{ item.file }}"
8+
baseurl: "{{ item.baseurl | default(omit) }}"
9+
metalink: "{{ item.metalink | default(omit) }}"
10+
mirrorlist: "{{ item.mirrorlist | default(omit) }}"
11+
gpgcheck: "{{ item.gpgcheck | default(omit) }}"
12+
gpgkey: "{{ item.gpgkey | default(omit) }}"
13+
loop: "{{ ohpc_repos }}"
14+
loop_control:
15+
label: "{{ item.name }}"
1716

1817
- name: Include variables for OpenHPC version
1918
include_vars:
20-
file: "ohpc-{{ ansible_facts.packages['ohpc-release'][0]['version'] }}"
19+
file: "ohpc-{{ openhpc_version }}"
2120

2221
- name: Find PowerTools repo
2322
find:

tasks/main.yml

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,22 +20,26 @@
2020

2121
- name: Configure
2222
block:
23-
- include: runtime.yml
23+
- include_tasks: runtime.yml
2424
when: openhpc_enable.runtime | default(false) | bool
2525
tags: configure
2626

27-
- include: post-configure.yml
27+
- name: Run post-configure tasks
28+
include_tasks: post-configure.yml
2829
when:
2930
- openhpc_enable.runtime | default(false) | bool
3031
# Requires operational slurm cluster
3132
- openhpc_slurm_service_started | bool
3233
tags: post-configure
3334

34-
- include: drain.yml
35-
when: openhpc_enable.drain | default(false) | bool
36-
delegate_to: "{{ openhpc_slurm_control_host }}"
35+
- name: Run drain or resume tasks
36+
block:
37+
- name: Run drain tasks
38+
include_tasks: drain.yml
39+
when: openhpc_enable.drain | default(false) | bool
3740

38-
- include: resume.yml
39-
when: openhpc_enable.resume | default(false) | bool
41+
- name: Run resume tasks
42+
include_tasks: resume.yml
43+
when: openhpc_enable.resume | default(false) | bool
4044
delegate_to: "{{ openhpc_slurm_control_host }}"
4145
...

tasks/resume.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
- name: Resume compute node
1515
command: "scontrol update nodename={{ inventory_hostname }} state=RESUME"
1616
when: inventory_hostname not in resumed_nodes_results.stdout_lines
17+
changed_when: true
1718

1819
- name: Check node has resumed
1920
command: "sinfo --noheader --Node --format='%N' --states=ALLOC,IDLE"

0 commit comments

Comments
 (0)