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: "{{ slurm_packages }}"
  25. state: present
  26. with_items:
  27. - "{{ slurm_packages }}"
  28. tags: install
  29. - name: Install development tools
  30. package:
  31. name: "{{ item | join (',') }}"
  32. state: present
  33. with_items:
  34. - "{{ dev_tools }}"
  35. tags: install
  36. - name: Create temporary download folder for slurm
  37. file:
  38. path: "{{ tmp_path }}"
  39. owner: slurm
  40. group: slurm
  41. mode: "{{ tmp_mode }}"
  42. state: directory
  43. - name: Download slurm source
  44. get_url:
  45. url: "{{ slurm_url }}"
  46. dest: "{{ tmp_path }}"
  47. checksum: "{{ slurm_md5 }}"
  48. validate_certs: no
  49. tags: install
  50. - name: Build slurm rpms
  51. command: rpmbuild -ta "{{ rpmbuild_path }}"
  52. changed_when: false
  53. args:
  54. warn: no
  55. - name: Verify package md5
  56. command: rpm -qa
  57. ignore_errors: true
  58. register: verify_result
  59. changed_when: no
  60. failed_when: no
  61. args:
  62. warn: no
  63. - name: Install rpms
  64. command: rpm -Uvh ~"{{ rpm_loop }}"
  65. args:
  66. chdir: "{{ rpm_path }}"
  67. warn: no
  68. when: verify_result.rc != 0
  69. - name: Add socket and core info
  70. lineinfile:
  71. path: "{{ slurm_confpth }}"
  72. regexp: "NodeName= Sockets= CoresPerSocket="
  73. line: "NodeName={{ group_names[0] }} Sockets={{ hostvars[inventory_hostname]['ansible_facts']['processor_count'] }}
  74. CoresPerSocket={{ hostvars[inventory_hostname]['ansible_facts']['processor_cores'] }}"
  75. - name: Save slurm conf in buffer
  76. fetch:
  77. src: "{{ slurm_confpth }}"
  78. dest: "{{ buffer_path }}"
  79. flat: true
  80. - name: Start slurmd on compute nodes
  81. service:
  82. name: slurmd.service
  83. enabled: yes
  84. tags: install