main.yml 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  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: Give slurm user permission to slurmd spool
  18. file:
  19. path: "{{ spool_slurmd_pth }}"
  20. owner: slurm
  21. group: slurm
  22. mode: "{{ tmp_mode }}"
  23. state: touch
  24. - name: Create log files on compute nodes
  25. file:
  26. path: "{{ slurm_logpth }}"
  27. owner: slurm
  28. group: slurm
  29. mode: "{{ tmp_mode }}"
  30. state: touch
  31. with_items:
  32. - slurmd.log
  33. - name: Install firewalld
  34. package:
  35. name: firewalld
  36. state: present
  37. tags: firewalld
  38. - name: Stop and disable firewalld
  39. service:
  40. name: firewalld
  41. state: stopped
  42. enabled: no
  43. tags: firewalld
  44. - name: Copy slurm conf from buffer
  45. copy:
  46. src: "{{ buffer_path }}"
  47. dest: "{{ slurm_confpth }}"
  48. mode: "{{ slurm_mode }}"
  49. - name: Install packages for slurm
  50. package:
  51. name: "{{ slurm_packages }}"
  52. state: present
  53. tags: install
  54. - name: Install development tools
  55. package:
  56. name: "{{ dev_tools }}"
  57. state: present
  58. tags: install
  59. - name: Get the hostname
  60. command: hostname
  61. register: machine_name
  62. changed_when: true
  63. - name: Set compute node hostname/host ip to add in manager hosts file
  64. set_fact:
  65. compute_host: "{{ inventory_hostname }}"
  66. compute_ip: "{{ machine_name.stdout }}"
  67. - name: Get socket and core info from compute nodes
  68. set_fact:
  69. node_name: "{{ machine_name.stdout }}"
  70. sockets: "{{ hostvars[inventory_hostname]['ansible_facts']['processor_count'] }}"
  71. cores: "{{ hostvars[inventory_hostname]['ansible_facts']['processor_cores'] }}"
  72. - name: Add compute nodes core & socket info in slurm config file
  73. lineinfile:
  74. dest: "{{ slurm_confpth }}"
  75. line: "NodeName={{ hostvars[item].node_name }} Sockets={{ hostvars[item].sockets }} CoresPerSocket={{ hostvars[item].cores }}"
  76. state: present
  77. create: yes
  78. mode: "{{ slurm_mode }}"
  79. with_items:
  80. - "{{ groups['compute'] }}"
  81. - name: Save slurm conf in buffer
  82. fetch:
  83. src: "{{ slurm_confpth }}"
  84. dest: "{{ buffer_path }}"
  85. flat: true
  86. - name: Start slurmd on compute nodes
  87. systemd:
  88. name: slurmd.service
  89. state: started
  90. enabled: yes
  91. tags: install