main.yaml 2.5 KB

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