main.yml 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. # Copyright 2020 Dell Inc. or its subsidiaries. All Rights Reserved.
  2. #
  3. # Licensed under the Apache License, Version 2.0 (the "License");
  4. # you may not use this file except in compliance with the License.
  5. # You may obtain a copy of the License at
  6. #
  7. # http://www.apache.org/licenses/LICENSE-2.0
  8. #
  9. # Unless required by applicable law or agreed to in writing, software
  10. # distributed under the License is distributed on an "AS IS" BASIS,
  11. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. # See the License for the specific language governing permissions and
  13. # limitations under the License.
  14. ---
  15. - name: Include common variables
  16. include_vars: ../../slurm_manager/vars/main.yml
  17. - name: Copy slurm conf from buffer
  18. copy:
  19. src: "{{ buffer_path }}"
  20. dest: "{{ slurm_confpth }}"
  21. mode: "{{ slurm_mode }}"
  22. - name: Install packages for slurm
  23. package:
  24. name: "{{ item }}"
  25. state: present
  26. with_items:
  27. - "{{ slurm_packages }}"
  28. tags: install
  29. - name: Install development tools
  30. package:
  31. name: "{{ item }}"
  32. enablerepo: PowerTools
  33. state: present
  34. with_items:
  35. - "{{ dev_tools }}"
  36. tags: install
  37. - name: Create temporary download folder for slurm
  38. file:
  39. path: "{{ tmp_path }}"
  40. owner: slurm
  41. group: slurm
  42. mode: "{{ tmp_mode }}"
  43. state: directory
  44. - name: Download slurm source
  45. get_url:
  46. url: "{{ slurm_url }}"
  47. dest: "{{ tmp_path }}"
  48. checksum: "{{ slurm_md5 }}"
  49. validate_certs: no
  50. tags: install
  51. - name: Build slurm rpms
  52. command: rpmbuild -ta "{{ rpmbuild_path }}"
  53. changed_when: false
  54. args:
  55. warn: no
  56. - name: Verify package md5
  57. command: rpm -qa
  58. ignore_errors: true
  59. register: verify_result
  60. changed_when: no
  61. failed_when: no
  62. args:
  63. warn: no
  64. - name: Install rpms
  65. command: rpm -Uvh ~"{{ rpm_loop }}"
  66. args:
  67. chdir: "{{ rpm_path }}"
  68. warn: no
  69. when: verify_result.rc != 0
  70. - name: Add socket and core info
  71. lineinfile:
  72. path: "{{ slurm_confpth }}"
  73. regexp: "NodeName= Sockets= CoresPerSocket="
  74. line: "NodeName={{ group_names[0] }} Sockets={{ hostvars[inventory_hostname]['ansible_facts']['processor_count'] }}
  75. CoresPerSocket={{ hostvars[inventory_hostname]['ansible_facts']['processor_cores'] }}"
  76. - name: Save slurm conf in buffer
  77. fetch:
  78. src: "{{ slurm_confpth }}"
  79. dest: "{{ buffer_path }}"
  80. flat: true
  81. - name: Start slurmd on compute nodes
  82. service:
  83. name: slurmd.service
  84. enabled: yes
  85. tags: install