main.yml 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184
  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: Install epel repository
  16. package:
  17. name: epel-release
  18. state: present
  19. tags: install
  20. - name: Munge installation
  21. package:
  22. name: munge-devel
  23. state: present
  24. tags: install
  25. - name: Install packages for slurm
  26. package:
  27. name: "{{ common_packages }}"
  28. state: present
  29. tags: install
  30. - name: pip upgrade pip
  31. pip:
  32. name: pip
  33. executable: pip3
  34. extra_args: --upgrade
  35. state: latest
  36. tags: install
  37. - name: create munge key
  38. command: "{{ munge_cmd }}"
  39. changed_when: true
  40. tags: install
  41. - name: copy munge key
  42. copy:
  43. src: munge.key
  44. dest: "{{ munge_dest }}"
  45. owner: munge
  46. group: munge
  47. mode: "{{ munge_mode }}"
  48. tags: install
  49. - name: slurm configuration - slurm.conf
  50. copy:
  51. src: slurm.conf
  52. dest: "{{ slurm_dest }}"
  53. mode: "{{ slurm_mode }}"
  54. tags: install
  55. - name: add cluster name
  56. lineinfile:
  57. path: "{{ slurm_confpth }}"
  58. regexp: "clustername="
  59. line: "clustername={{ cluster_name }}"
  60. tags: install
  61. - name: add slurm user name
  62. lineinfile:
  63. path: "{{ slurm_confpth }}"
  64. regexp: "SlurmUser="
  65. line: "SlurmUser={{ slurm_user }}"
  66. tags: install
  67. - name: Add slurmctld port no
  68. lineinfile:
  69. path: "{{ slurm_confpth }}"
  70. regexp: "SlurmctldPort="
  71. line: "SlurmctldPort={{ slurmctld_port }}"
  72. tags: install
  73. - name: Add slurmd port no
  74. lineinfile:
  75. path: "{{ slurm_confpth }}"
  76. regexp: "SlurmdPort="
  77. line: "SlurmdPort={{ slurmd_port }}"
  78. tags: install
  79. - name: Add spool path
  80. lineinfile:
  81. path: "{{ slurm_confpth }}"
  82. regexp: "SlurmdSpoolDir="
  83. line: "SlurmdSpoolDir={{ spool_pth }}"
  84. tags: install
  85. - name: Add slurmctld pid file path
  86. lineinfile:
  87. path: "{{ slurm_confpth }}"
  88. regexp: "SlurmctldPidFile="
  89. line: "SlurmctldPidFile={{ slurmctld_pid }}"
  90. tags: install
  91. - name: Add slurmd pid file path
  92. lineinfile:
  93. path: "{{ slurm_confpth }}"
  94. regexp: "SlurmdPidFile="
  95. line: "SlurmdPidFile={{ slurmd_pid }}"
  96. tags: install
  97. - name: Add slurmctld log file path
  98. lineinfile:
  99. path: "{{ slurm_confpth }}"
  100. regexp: "SlurmctldLogFile="
  101. line: "SlurmctldLogFile={{ slurmctld_log }}"
  102. tags: install
  103. - name: Add slurmd log file path
  104. lineinfile:
  105. path: "{{ slurm_confpth }}"
  106. regexp: "SlurmdLogFile="
  107. line: "SlurmdLogFile={{ slurmd_log }}"
  108. tags: install
  109. - name: Create slurm group
  110. group:
  111. name: slurm
  112. state: present
  113. tags: install
  114. - name: Add the user 'slurm' with uid 6001 and a primary group of 'slurm'
  115. user:
  116. name: slurm
  117. comment: Slurm User Account
  118. uid: "{{ slurm_uid }}"
  119. group: slurm
  120. tags: install
  121. - name: Create slurm log directory
  122. file:
  123. path: "{{ slurm_logpth }}"
  124. state: directory
  125. owner: slurm
  126. group: slurm
  127. mode: "{{ gen_mode }}"
  128. recurse: yes
  129. tags: install
  130. - name: Give slurm user permission to spool
  131. file:
  132. path: "{{ spool_pth }}"
  133. owner: slurm
  134. group: slurm
  135. state: directory
  136. mode: "{{ gen_mode }}"
  137. recurse: yes
  138. tags: install
  139. - name: Give slurm user permission to slurmctld
  140. file:
  141. path: "{{ slurmctld_pid }}"
  142. owner: slurm
  143. group: slurm
  144. mode: "{{ gen_mode }}"
  145. state: touch
  146. tags: install
  147. - name: Give slurm user permission to slurmd
  148. file:
  149. path: "{{ slurmd_pid }}"
  150. owner: slurm
  151. group: slurm
  152. mode: "{{ gen_mode }}"
  153. state: touch
  154. tags: install
  155. - name: Start munge service
  156. service:
  157. name: munge
  158. state: restarted
  159. enabled: yes
  160. tags: install