Browse Source

Issue #868: Install slurm on Leap OS

Signed-off-by: DeepikaKrishnaiah <deepika_k2@dell.com>
DeepikaKrishnaiah 3 years ago
parent
commit
4fd6ef63a7

+ 4 - 0
control_plane/roles/control_plane_common/tasks/main.yml

@@ -24,6 +24,10 @@
   import_tasks: package_installation.yml
   tags: init
 
+- name: Set the docker os version
+  import_tasks: set_docker_os.yml
+  tags: init
+  
 - name: Basic configuration
   import_tasks: fetch_base_inputs.yml
 

+ 39 - 0
control_plane/roles/control_plane_common/tasks/set_docker_os.yml

@@ -0,0 +1,39 @@
+#  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: Replace the rocky os version in dockerfile
+  replace:
+    path: "{{ item.path }}"
+    regexp: '^FROM rockylinux/rockylinux:docker_os'
+    replace: 'FROM rockylinux/rockylinux:{{ docker_rocky_os_version }}'
+  with_items:
+    - { path: "{{ cobbler_rocky_dockerfile_path }}"}
+    - { path: "{{ ib_dockerfile_path }}"}
+
+- name: Replace the leap os version in dockerfile
+  replace:
+    path: "{{ item.path }}"
+    regexp: '^FROM registry.opensuse.org/opensuse/leap:docker_os'
+    replace: 'FROM registry.opensuse.org/opensuse/leap:{{ docker_leap_os_version }}'
+  with_items:
+    - { path: "{{ cobbler_leap_dockerfile_path }}"}
+
+- name: Replace the alpine os version in dockerfile
+  replace:
+    path: "{{ item.path }}"
+    regexp: '^FROM alpine:docker_os'
+    replace: 'FROM alpine:{{ docker_alpine_os_version }}'
+  with_items:
+    - { path: "{{ mgmnt_dockerfile_path }}"}

+ 9 - 0
control_plane/roles/control_plane_common/vars/main.yml

@@ -40,6 +40,15 @@ common_packages_rocky:
   - device-mapper-persistent-data
   - yum-plugin-versionlock
 
+# Usage: set_docker_os.yml
+docker_rocky_os_version: "8"
+docker_leap_os_version: "15.3"
+docker_alpine_os_version: "3.15"
+cobbler_rocky_dockerfile_path: "{{ playbook_dir }}/roles/provision_cobbler/files/Dockerfile_rocky"
+cobbler_leap_dockerfile_path: "{{ playbook_dir }}/roles/provision_cobbler/files/Dockerfile_leap"
+ib_dockerfile_path: "{{ playbook_dir }}/roles/control_plane_ib/files/Dockerfile"
+mgmnt_dockerfile_path: "{{ playbook_dir }}/roles/control_plane_device/files/Dockerfile"
+
 # Usage: pre_requisite.yml
 internet_delay: 0
 internet_timeout: 10

+ 1 - 1
control_plane/roles/control_plane_device/files/Dockerfile

@@ -1,5 +1,5 @@
 # Dockerfile for creating the management network container
-FROM alpine:latest
+FROM alpine:docker_os
 
 #Installing packages
 RUN apk add dhcp

+ 1 - 1
control_plane/roles/control_plane_ib/files/Dockerfile

@@ -1,4 +1,4 @@
-FROM rockylinux/rockylinux:8.5
+FROM rockylinux/rockylinux:docker_os
 
 RUN dnf install -y epel-release
 RUN dnf install dhcp-server -y \

+ 1 - 1
control_plane/roles/control_plane_ib/files/infiniband_container_configure.yml

@@ -1,4 +1,4 @@
- Copyright 2021 Dell Inc. or its subsidiaries. All Rights Reserved.
+# Copyright 2021 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.

+ 2 - 2
control_plane/roles/provision_cobbler/files/Dockerfile_leap

@@ -1,4 +1,4 @@
-FROM registry.opensuse.org/opensuse/leap:15.3
+FROM registry.opensuse.org/opensuse/leap:docker_os
 
 #Enable all repose
 RUN zypper mr -ea
@@ -67,4 +67,4 @@ VOLUME [ "/srv/www/cobbler", "/var/lib/cobbler/backup", "/mnt" ]
 
 RUN systemctl enable dhcpd
 
-CMD ["sbin/init"]
+CMD ["sbin/init"]

+ 2 - 2
control_plane/roles/provision_cobbler/files/Dockerfile_rocky

@@ -1,4 +1,4 @@
-FROM rockylinux/rockylinux:8.5
+FROM rockylinux/rockylinux:docker_os
 
 # RPM REPOs
 RUN dnf install -y \
@@ -66,4 +66,4 @@ VOLUME [ "/var/www/cobbler", "/var/lib/cobbler/backup", "/mnt" ]
 
 RUN systemctl enable dhcpd
 
-CMD ["sbin/init"]
+CMD ["sbin/init"]

+ 14 - 1
roles/slurm_common/tasks/main.yml

@@ -1,4 +1,4 @@
-#  Copyright 2020 Dell Inc. or its subsidiaries. All Rights Reserved.
+#  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.
@@ -57,10 +57,23 @@
     name: "{{ common_packages }}"
     state: present
   tags: install
+    when: os_supported_leap not in compute_os
+
+- name: Install packages for slurm
+  package:
+    name: "{{ leap_common_packages }}"
+    state: present
+  when: os_supported_leap in compute_os
 
 - name: Create munge key
   command: "{{ munge_cmd }}"
   changed_when: true
+  when: os_supported_leap not in compute_os
+
+- name: Create munge key
+  shell: dd if=/dev/random bs=1 count=1024 >/etc/munge/munge.key
+  changed_when: true
+  when: os_supported_leap in compute_os
 
 - name: Copy munge key
   copy:

+ 9 - 2
roles/slurm_common/vars/main.yml

@@ -1,4 +1,4 @@
-#  Copyright 2020 Dell Inc. or its subsidiaries. All Rights Reserved.
+#  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.
@@ -23,6 +23,12 @@ common_packages:
    - mariadb-devel
    - man2html
 
+leap_common_packages:
+   - slurm
+   - munge
+   - mariadb
+   - slurm-munge
+
 common_python2_packages:
    - MySQL-python
    - python-netaddr
@@ -59,4 +65,5 @@ slurmd_log: "/var/log/slurm/slurmd.log"
 
 os_centos: 'centos'
 os_rocky: 'rocky'
-os_version: '8.0'
+os_version: '8.0'
+os_supported_leap: "leap"

+ 9 - 0
roles/slurm_manager/tasks/main.yml

@@ -52,12 +52,21 @@
     name: "{{ slurm_packages }}"
     state: present
   tags: install
+  when: os_supported_leap not in compute_os
+
+- name: Install packages for slurm
+  package:
+    name: "{{ leap_slurm_packages }}"
+    state: present
+  tags: install
+  when: os_supported_leap in compute_os
 
 - name: Install development tools
   package:
     name: "{{ dev_tools }}"
     state: present
   tags: install
+  when: os_supported_leap not in compute_os
 
 - name: Get the hostname
   command: hostname

+ 9 - 1
roles/slurm_manager/vars/main.yml

@@ -45,6 +45,10 @@ log_files_manager:
    - slurm_jobacct.log
    - slurm_jobcomp.log
 
+leap_slurm_packages:
+   - slurm-slurmdbd
+   - git
+
 tmp_mode: "0755"
 cluster_state_path: "/var/spool/slurm/cluster_state"
 spool_slurmctld_pth: "/var/spool/slurmctld"
@@ -71,4 +75,8 @@ dbd_host: "localhost"
 logfile: "/var/log/slurm/slurmdbd.log"
 pidfile: "/var/run/slurmdbd.pid"
 buffer_path: "/tmp/slurm.conf"
-slurm_mode: "0644"
+slurm_mode: "0644"
+
+os_centos: 'centos'
+os_rocky: 'rocky'
+os_supported_leap: "leap"

+ 1 - 0
roles/slurm_restd/files/slurm-restd-custom.service

@@ -2,6 +2,7 @@
 Description = Start slurm restd
 
 [Service]
+Environment = SLURM_JWT=bvijavojviqjkenilejvkejfvvjfjv
 ExecStart = slurmrestd -a rest_auth/jwt -s openapi/v0.0.36 "0.0.0.0:6820"
 Restart = always
 RestartSec = 15

+ 14 - 3
roles/slurm_restd/tasks/install_jansson.yml

@@ -18,6 +18,14 @@
     name: "{{ slurm_restd_packages }}"
     state: present
   tags: install
+  when: os_supported_leap not in compute_os
+
+- name: Install packages for slurm restd on leap
+  package:
+    name: "{{ slurm_restd_packages_leap }}"
+    state: present
+  tags: install
+  when: os_supported_leap in compute_os
 
 - name: Download and untar jansson package
   unarchive:
@@ -25,9 +33,12 @@
     dest: "{{ jansson_download_dir }}"
     remote_src: yes
 
-- name: Go to jansson directory
-  command: cd "{{ jansson_dir_path }}"
-  changed_when: false
+- name: Install required C packages
+  zypper:
+    name: "{{ slurm_gcc_leap }}"
+    state: present
+    type: pattern
+  when: os_supported_leap in compute_os
 
 - name: Execute autoreconf
   shell:  set -o pipefail && cd "{{ jansson_dir_path }}" && autoreconf -i

+ 12 - 0
roles/slurm_restd/vars/main.yml

@@ -21,11 +21,23 @@ slurm_restd_packages:
    - libtool
    - make
 
+slurm_restd_packages_leap:
+   - slurm-rest
+   - libjson-c-devel
+   - http-parser-devel
+   - libtool
+   - make
+   - libopenssl-devel
+
+slurm_gcc_leap:
+  - devel_basis
+
 fil_mode: "0755"
 jansson_download_dir: /var/lib/
 jansson_src_url: https://github.com/akheron/jansson/archive/refs/tags/v2.14.tar.gz
 jansson_path: /usr/local/lib/pkgconfig
 jansson_dir_path: /var/lib/jansson-2.14/
+os_supported_leap: "leap"
 
 # Usage: install_libjwt.yml
 libjwt_repo: https://github.com/benmcollins/libjwt.git

+ 4 - 2
roles/slurm_workers/tasks/main.yml

@@ -1,4 +1,4 @@
-#  Copyright 2021 Dell Inc. or its subsidiaries. All Rights Reserved.
+#  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.
@@ -81,12 +81,14 @@
     name: "{{ slurm_packages }}"
     state: present
   tags: install
+  when: os_supported_leap not in compute_os
 
 - name: Install development tools
   package:
     name: "{{ dev_tools }}"
     state: present
   tags: install
+  when: os_supported_leap not in compute_os
 
 - name: Get the hostname
   command: hostname
@@ -158,4 +160,4 @@
   fetch:
     src: "{{ slurm_confpth }}"
     dest: "{{ buffer_path }}"
-    flat: true
+    flat: true