Skip to content

Commit 2b375c6

Browse files
authored
Merge pull request #26 from openhpc/2025-07-17-jenkins
refactor(ansible): rename jenkins sms role to generic sms role
2 parents addbddb + 032dae9 commit 2b375c6

File tree

4 files changed

+130
-123
lines changed

4 files changed

+130
-123
lines changed

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ shfmt-lint:
2222
ansible-lint:
2323
@echo "Running 'ansible-lint' on selected yaml files"
2424
ansible-lint --offline ansible/roles/test/ohpc-huawei-*yml \
25-
ansible/roles/test/ohpc-lenovo-repo.yml \
25+
ansible/roles/test/ohpc-lenovo-*yml \
2626
ansible/roles/common/automatic-updates.yml \
2727
ansible/roles/common/handlers.yml \
2828
ansible/roles/repos/repos-aarch64.yml \

ansible/inventory/test

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,6 @@ ohpc-huawei-repo
1010
[ohpc_lenovo_repo]
1111
ohpc-lenovo-repo
1212

13-
[openhpc_lenovo_jenkins_sms]
14-
openhpc-lenovo-jenkins-sms
13+
[ohpc_lenovo_sms]
14+
ohpc-lenovo-sms
1515

Lines changed: 118 additions & 111 deletions
Original file line numberDiff line numberDiff line change
@@ -1,125 +1,132 @@
1-
- name: openhpc-lenovo-jenkins-sms
2-
hosts: openhpc_lenovo_jenkins_sms
3-
gather_facts: True
1+
- name: Configure ohpc-lenovo-sms
2+
hosts: ohpc_lenovo_sms
3+
gather_facts: true
4+
handlers:
5+
- name: Include handlers
6+
ansible.builtin.import_tasks: ../common/handlers.yml
7+
48
tasks:
5-
- name: configure proxy
6-
copy:
7-
dest: /etc/profile.d/proxy.sh
8-
content: |
9-
export https_proxy=http://10.241.58.130:3128
10-
export http_proxy=http://10.241.58.130:3128
9+
- name: Include history.yml
10+
ansible.builtin.include_tasks: ../common/history.yml
1111

12-
- name: fix dnf.conf
13-
ansible.builtin.lineinfile:
14-
path: /etc/dnf/dnf.conf
15-
line: "{{ item }}"
16-
with_items:
17-
- user_agent="curl"
18-
when: (distro.startswith("rocky")) or (distro == "almalinux9") or (distro.startswith("openEuler"))
12+
- name: Configure proxy
13+
ansible.builtin.copy:
14+
dest: /etc/profile.d/proxy.sh
15+
owner: root
16+
group: root
17+
mode: "0644"
18+
content: |
19+
export https_proxy=http://10.241.58.130:3128
20+
export http_proxy=http://10.241.58.130:3128
1921
20-
- name: Replace mirror URL for openeuler
21-
ansible.builtin.replace:
22-
path: /etc/yum.repos.d/openEuler.repo
23-
regexp: 'repo.openeuler.org'
24-
replace: 'repo.huaweicloud.com/openeuler'
25-
when: distro == "openEuler_22.03"
22+
- name: Fix dnf.conf
23+
ansible.builtin.lineinfile:
24+
path: /etc/dnf/dnf.conf
25+
line: "{{ item }}"
26+
with_items:
27+
- user_agent="curl"
28+
when: (distro.startswith("rocky")) or (distro == "almalinux9") or (distro.startswith("openEuler"))
2629

27-
- name: install obs repository configuration
28-
template:
29-
src: "{{ item }}"
30-
dest: /etc/yum.repos.d/
31-
owner: root
32-
group: root
33-
mode: 0644
34-
with_items:
35-
- OpenHPC-obs-factory.repo
36-
when: distro == "openEuler_22.03"
30+
- name: Replace mirror URL for openeuler
31+
ansible.builtin.replace:
32+
path: /etc/yum.repos.d/openEuler.repo
33+
regexp: 'repo.openeuler.org'
34+
replace: 'repo.huaweicloud.com/openeuler'
35+
when: distro == "openEuler_22.03"
3736

38-
- name: install obs repository configuration
39-
copy:
40-
src: "{{ item }}"
41-
dest: /etc/yum.repos.d/
42-
owner: root
43-
group: root
44-
mode: 0644
45-
with_items:
46-
- mgrigorov-OpenHPC-openeuler-22.03_LTS_SP3.repo
47-
when: distro == "openEuler_22.03"
37+
- name: Install obs repository configuration
38+
ansible.builtin.template:
39+
src: "{{ item }}"
40+
dest: /etc/yum.repos.d/
41+
owner: root
42+
group: root
43+
mode: "0644"
44+
with_items:
45+
- OpenHPC-obs-factory.repo
46+
when: distro == "openEuler_22.03"
4847

49-
- name: install obs repository configuration
50-
template:
51-
src: "{{ item }}"
52-
dest: /etc/yum.repos.d/
53-
owner: root
54-
group: root
55-
mode: 0644
56-
with_items:
57-
- OpenHPC-obs-factory.repo
58-
when: (distro.startswith("rocky")) or (distro == "almalinux9")
48+
- name: Install obs repository configuration
49+
ansible.builtin.copy:
50+
src: "{{ item }}"
51+
dest: /etc/yum.repos.d/
52+
owner: root
53+
group: root
54+
mode: "0644"
55+
with_items:
56+
- mgrigorov-OpenHPC-openeuler-22.03_LTS_SP3.repo
57+
when: distro == "openEuler_22.03"
5958

60-
- name: install obs repository configuration
61-
template:
62-
src: "{{ item }}"
63-
dest: /etc/zypp/repos.d/
64-
owner: root
65-
group: root
66-
mode: 0644
67-
with_items:
68-
- OpenHPC-obs-factory.repo
69-
when: distro.startswith("leap15")
59+
- name: Install obs repository configuration
60+
ansible.builtin.template:
61+
src: "{{ item }}"
62+
dest: /etc/yum.repos.d/
63+
owner: root
64+
group: root
65+
mode: "0644"
66+
with_items:
67+
- OpenHPC-obs-factory.repo
68+
when: (distro.startswith("rocky")) or (distro == "almalinux9")
7069

71-
- name: install packages
72-
package:
73-
state: present
74-
name:
75-
- epel-release
76-
- tzdata-java
77-
when: (distro.startswith("rocky")) or (distro == "almalinux9")
70+
- name: Install obs repository configuration
71+
ansible.builtin.template:
72+
src: "{{ item }}"
73+
dest: /etc/zypp/repos.d/
74+
owner: root
75+
group: root
76+
mode: "0644"
77+
with_items:
78+
- OpenHPC-obs-factory.repo
79+
when: distro.startswith("leap15")
7880

79-
- name: install packages
80-
package:
81-
state: present
82-
name:
83-
- git
84-
- ipmitool
85-
- rsync
86-
- chrony
87-
- bats
88-
when: distro != "leap15.3"
81+
- name: Install packages
82+
ansible.builtin.package:
83+
state: present
84+
name:
85+
- epel-release
86+
- tzdata-java
87+
when: (distro.startswith("rocky")) or (distro == "almalinux9")
8988

90-
- import_tasks: ohpc-lenovo-common.yml
89+
- name: Install packages
90+
ansible.builtin.package:
91+
state: present
92+
name:
93+
- git
94+
- ipmitool
95+
- rsync
96+
- chrony
97+
- bats
98+
when: distro != "leap15.3"
9199

92-
- name: create directories
93-
file: dest="{{item}}" state=directory
94-
with_items:
95-
- /root/ci
100+
- name: Import ohpc-lenovo-common.yml
101+
ansible.builtin.import_tasks: ohpc-lenovo-common.yml
96102

97-
- name: copy helper scripts
98-
copy:
99-
src: "{{ item }}"
100-
dest: /root/ci/
101-
owner: root
102-
group: root
103-
with_items:
104-
- install.sh
105-
- support_functions.sh
106-
- computes_installed.py
107-
- sms_installed.bats
108-
- gen_inputs.pl
103+
- name: Create directories
104+
ansible.builtin.file:
105+
dest: "{{ item }}"
106+
state: directory
107+
mode: "0755"
108+
with_items:
109+
- /root/ci
109110

110-
- name: copy helper scripts
111-
template:
112-
src: "{{ item }}"
113-
dest: /root/ci/
114-
owner: root
115-
group: root
116-
with_items:
117-
- lenovo.mapping
111+
- name: Copy helper scripts
112+
ansible.builtin.copy:
113+
src: "{{ item }}"
114+
dest: /root/ci/
115+
owner: root
116+
group: root
117+
mode: "0644"
118+
with_items:
119+
- install.sh
120+
- support_functions.sh
121+
- computes_installed.py
122+
- sms_installed.bats
123+
- gen_inputs.pl
124+
- lenovo.mapping
118125

119-
- name: make install script executable
120-
ansible.builtin.file:
121-
path: "/root/ci/{{ item }}"
122-
mode: '0755'
123-
with_items:
124-
- install.sh
125-
- sms_installed.bats
126+
- name: Make install script executable
127+
ansible.builtin.file:
128+
path: "/root/ci/{{ item }}"
129+
mode: '0755'
130+
with_items:
131+
- install.sh
132+
- sms_installed.bats

ansible/roles/test/templates/lenovo.mapping

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -37,27 +37,27 @@ eth_provision=eth2
3737
eth_provision=eth2
3838
{% endif %}
3939

40-
openhpc-lenovo-jenkins-sms_ip=10.241.58.134
40+
ohpc-lenovo-sms_ip=10.241.58.134
4141

4242
bmc_username=root
4343

4444
# Compute node IPs
4545

46-
openhpc-lenovo-jenkins-c1_ip=10.241.58.132
47-
openhpc-lenovo-jenkins-c2_ip=10.241.58.133
46+
ohpc-lenovo-c1_ip=10.241.58.132
47+
ohpc-lenovo-c2_ip=10.241.58.133
4848

4949
# Compute node BMCs
5050

51-
openhpc-lenovo-jenkins-c1_bmc=10.241.58.139
52-
openhpc-lenovo-jenkins-c2_bmc=10.241.58.138
51+
ohpc-lenovo-c1_bmc=10.241.58.139
52+
ohpc-lenovo-c2_bmc=10.241.58.138
5353

5454
# Compute node MACs
5555

56-
openhpc-lenovo-jenkins-c1_mac=f4:c7:aa:44:41:4a
57-
openhpc-lenovo-jenkins-c2_mac=f4:c7:aa:44:40:f0
56+
ohpc-lenovo-c1_mac=f4:c7:aa:44:41:4a
57+
ohpc-lenovo-c2_mac=f4:c7:aa:44:40:f0
5858

5959

6060
# Compute node IPoIB (not used)
6161

62-
openhpc-lenovo-jenkins-c1_ipoib=172.17.1.1
63-
openhpc-lenovo-jenkins-c2_ipoib=172.17.1.2
62+
ohpc-lenovo-c1_ipoib=172.17.1.1
63+
ohpc-lenovo-c2_ipoib=172.17.1.2

0 commit comments

Comments
 (0)