浏览代码

Merge pull request #997 from abhishek-sa1/omnia_changes

Issue #959: slurm restd fix in leap
Sujit Jadhav 3 年之前
父节点
当前提交
412d118664
共有 3 个文件被更改,包括 147 次插入10 次删除
  1. 121 0
      roles/slurm_restd/tasks/configure_restd_leap.yml
  2. 10 9
      roles/slurm_restd/tasks/main.yml
  3. 16 1
      roles/slurm_restd/vars/main.yml

+ 121 - 0
roles/slurm_restd/tasks/configure_restd_leap.yml

@@ -0,0 +1,121 @@
+# Copyright 2022 Dell Inc. or its subsidiaries. All Rights Reserved.
+#
+#  Licensed under the Apache License, Version 2.0 (the "License");
+#  you may not use this file except in compliance with the License.
+#  You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+#  Unless required by applicable law or agreed to in writing, software
+#  distributed under the License is distributed on an "AS IS" BASIS,
+#  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+#  See the License for the specific language governing permissions and
+#  limitations under the License.
+---
+
+- name: Add leap src repo
+  zypper_repository:
+    name: "{{ src_repo_name }}"
+    repo: "{{ src_repo_path }}"
+    state: present
+    autorefresh: yes
+
+- name: Install tar packages
+  zypper:
+    name: "{{ item }}"
+    state: present
+  with_items:
+    - tar
+    - bzip2
+
+- name: Install source slurm
+  command: zypper --non-interactive si slurm
+  changed_when: true
+
+- name: Find tar.bz2 slurm file name
+  command: find "{{ slurm_src_package_path }}" -name "slurm*tar.bz2"
+  changed_when: false
+  register: slurm_tar_file
+
+- name: Set slurm tar file and folder path
+  set_fact:
+    slurm_tar_file: "{{ slurm_tar_file.stdout.split(slurm_src_package_path)[1] }}"
+    slurm_folder_path: "{{ slurm_tar_file.stdout.split(slurm_src_package_path)[1].split('.tar')[0] }}"
+
+- name: Copy slurm tar file to lib folder 
+  copy:
+    src: "{{ slurm_src_package_path }}{{ slurm_tar_file }}"
+    dest: "{{ slurm_lib_path }}{{ slurm_tar_file }}"
+    remote_src: true
+    mode: preserve
+
+- name: Untar the slurm tar file
+  command: tar --bzip -x -f "{{ slurm_lib_path }}{{ slurm_tar_file }}" "{{ slurm_folder_path }}/"
+  changed_when: true
+  args:
+    chdir: "{{ slurm_lib_path }}"
+    warn: false
+
+- name: Configure slurmrestd 
+  command: ./configure --prefix "{{ slurm_lib_path }}" --enable-slurmrestd --with-jwt=/usr/local
+  changed_when: true
+  args:
+    chdir: "{{ slurm_lib_path }}{{ slurm_folder_path }}"
+
+- name: Execute make
+  command: make
+  changed_when: true
+  register: make
+  until: make is not failed
+  retries: "{{ make_command_retries }}"
+  args:
+    chdir: "{{ slurm_lib_path }}{{ slurm_folder_path }}"
+
+- name: Execute make install
+  command: make install
+  changed_when: true
+  register: make_install
+  until: make_install is not failed
+  retries: "{{ make_command_retries }}"
+  args:
+    chdir: "{{ slurm_lib_path }}{{ slurm_folder_path }}"
+
+- name: Check lib64 auth_jwt file path
+  stat:
+    path: "{{ slurm_lib64_auth_jwt_src }}/{{ auth_jwt_file_name }}"
+  register: auth_jwt_lib64_path
+
+- name: Check lib auth_jwt file path
+  stat:
+    path: "{{ slurm_lib_auth_jwt_src }}/{{ auth_jwt_file_name }}"
+  register: auth_jwt_lib_path
+
+- name: Copy lib64 auth_jwt files
+  shell: "cp {{ slurm_lib64_auth_jwt_src }}/auth_jwt.* {{ slurm_lib64_auth_jwt_dest }}"
+  changed_when: true
+  when: auth_jwt_lib64_path.stat.exists
+
+- name: Copy lib auth_jwt files
+  shell: "cp {{ slurm_lib_auth_jwt_src }}/auth_jwt.* {{ slurm_lib64_auth_jwt_dest }}"
+  changed_when: true
+  when: auth_jwt_lib_path.stat.exists
+
+- name: Check lib64 auth_jwt file path
+  stat:
+    path: "{{ slurm_lib64_libjwt_src }}/{{ libjwt_file_name }}"
+  register: libjwt_lib64_path
+
+- name: Check lib auth_jwt file path
+  stat:
+    path: "{{ slurm_lib_libjwt_src }}/{{ libjwt_file_name }}"
+  register: libjwt_lib_path
+
+- name: Copy lib64 libjwt files
+  shell: "cp {{ slurm_lib64_libjwt_src }}/libjwt.* {{ slurm_lib64_libjwt_dest }}"
+  changed_when: true
+  when: libjwt_lib64_path.stat.exists
+
+- name: Copy lib libjwt files
+  shell: "cp {{ slurm_lib_libjwt_src }}/libjwt.* {{ slurm_lib64_libjwt_dest }}"
+  changed_when: true
+  when: libjwt_lib_path.stat.exists

+ 10 - 9
roles/slurm_restd/tasks/main.yml

@@ -13,14 +13,15 @@
 #  limitations under the License.
 ---
 
-- name: Execute slurm restd on rocky
-  block:
-    - name: Install jansson
-      include_tasks: install_jansson.yml
+- name: Install jansson
+  include_tasks: install_jansson.yml
 
-    - name: Install libjwt
-      include_tasks: install_libjwt.yml
+- name: Install libjwt
+  include_tasks: install_libjwt.yml
 
-    - name: Generate Token
-      include_tasks: generate_token.yml
-  when: os_supported_leap not in compute_os
+- name: Configure slurm restd in leap
+  include_tasks: configure_restd_leap.yml
+  when: os_supported_leap in compute_os
+
+- name: Generate Token
+  include_tasks: generate_token.yml

+ 16 - 1
roles/slurm_restd/vars/main.yml

@@ -43,10 +43,25 @@ os_supported_leap: "leap"
 libjwt_repo: https://github.com/benmcollins/libjwt.git
 libjwt_dir: /var/lib/libjwt
 
+# Usage: configure_restd_leap.yml
+src_repo_name: "src-repo"
+src_repo_path: "http://download.opensuse.org/source/distribution/leap/15.3/repo/oss/"
+slurm_src_package_path: /usr/src/packages/SOURCES/
+slurm_lib_path: /var/lib/
+slurm_lib64_auth_jwt_src: /var/lib/lib64/slurm
+slurm_lib_auth_jwt_src: /var/lib/lib/slurm
+slurm_lib64_auth_jwt_dest: /usr/lib64/slurm/
+slurm_lib64_libjwt_src: /usr/local/lib64
+slurm_lib_libjwt_src: /usr/local/lib
+slurm_lib64_libjwt_dest: /usr/lib64/
+auth_jwt_file_name: auth_jwt.so
+libjwt_file_name: libjwt.so
+make_command_retries: 3
+
 # Usage: generate_token.yml
 token_dir: /var/spool/slurm/jwt_hs256.key
 slurm_dir: /etc/slurm/
 slurm_conf_path: /etc/slurm/slurm.conf
 token_mode: '0600'
 systemd_path_dest: "/etc/systemd/system/"
-slurm_restd_port: "6820"
+slurm_restd_port: "6820"