Skip to content

Commit 17678ff

Browse files
committed
Ensure repo files using yum_repository
1 parent 36bee31 commit 17678ff

File tree

5 files changed

+79
-25
lines changed

5 files changed

+79
-25
lines changed

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[ansible_distribution_major_version] }}"
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)