Browse Source

Create configure_restd_leap.yml

Signed-off-by: abhishek-sa1 <abhishek.sa3@dell.com>
abhishek-sa1 3 years ago
parent
commit
6b36f4b68b
1 changed files with 121 additions and 0 deletions
  1. 121 0
      roles/slurm_restd/tasks/configure_restd_leap.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