main.yml 3.2 KB

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