main.yml 3.2 KB

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