main.yaml 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  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: Download Slurm source
  16. get_url:
  17. url: "{{ slurm_url }}"
  18. dest: /root/Downloads/
  19. checksum: "{{ slurm_md5 }}"
  20. tags: install
  21. - name: Build SLURM RPMs
  22. command: rpmbuild -ta /root/Downloads/slurm-20.02.0.tar.bz2
  23. tags: install
  24. - name: Copy RPMs to NFS share
  25. copy:
  26. src: "{{ item }}"
  27. dest: /home/rpms/
  28. with_fileglob:
  29. - /root/rpmbuild/RPMS/x86_64/slurm*20*.rpm
  30. tags: install
  31. - name: Install SLURM RPMs on Master
  32. yum:
  33. name: "{{ item }}"
  34. #name: "{{ query('fileglob', ['/home/rpms/slurm*20*.rpm']) }}" <-- how it should work to avoid loop
  35. with_fileglob:
  36. - /home/rpms/slurm*20*.rpm
  37. tags: install
  38. - name: Firewall Rule slurm allow 6817/tcp
  39. command: firewall-cmd --zone=internal --add-port=6817/tcp --permanent
  40. tags: install
  41. - name: Firewall Rule slurm allow 6818/tcp
  42. command: firewall-cmd --zone=internal --add-port=6818/tcp --permanent
  43. tags: install
  44. - name: Firewall Rule slurm allow 6819/tcp
  45. command: firewall-cmd --zone=internal --add-port=6819/tcp --permanent
  46. tags: install
  47. - name: Firewall Rule slurm allow all incoming traffic on internal network
  48. command: firewall-cmd --permanent --zone=internal --add-rich-rule='rule family="ipv4" source address="192.168.1.0/24" accept'
  49. tags: install
  50. - name: Firewall Reload
  51. command: firewall-cmd --reload
  52. tags: install
  53. - name: Start MariaDB
  54. service:
  55. name: mariadb
  56. state: restarted
  57. enabled: yes
  58. tags: install
  59. - name: Grant Permissions for SLURM DB
  60. command: mysql -u root -e "GRANT ALL ON slurm_acct_db.* TO 'slurm'@'localhost' identified by 'password' with grant option;"
  61. tags: install
  62. - name: Create slurmdbd.conf file
  63. copy:
  64. src: /etc/slurm/slurmdbd.conf.example
  65. dest: /etc/slurm/slurmdbd.conf
  66. mode: 0600
  67. tags: install
  68. - name: Populate Accounting Database
  69. command: slurmdbd
  70. tags: install
  71. - name: Create Slurm Cluster
  72. command: sacctmgr -i add cluster {{inventory_hostname}}
  73. tags: install
  74. - name: Create Default Slurm Group
  75. command: sacctmgr -i add account defaultgroup Cluster={{inventory_hostname}} Description="Default Account" Organization="Default Org"
  76. tags: install
  77. - name: Add root to the Default Account
  78. command: sacctmgr -i add user root DefaultAccount=defaultgroup
  79. tags: install
  80. - name: Start slurmctld on Master
  81. service:
  82. name: slurmctld
  83. state: restarted
  84. enabled: yes
  85. tags: install
  86. - name: Enable Slurmdbd on Master
  87. service:
  88. name: slurmdbd
  89. state: restarted
  90. enabled: yes
  91. tags: install