main.yml 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  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: Copy slurm conf from buffer
  18. copy:
  19. src: "{{ buffer_path }}"
  20. dest: "{{ slurm_confpth }}"
  21. mode: "{{ slurm_mode }}"
  22. - name: Start slurmctld on manager
  23. service:
  24. name: slurmctld
  25. enabled: yes
  26. tags: install
  27. - name: Enable slurmdbd on manager
  28. service:
  29. name: slurmdbd
  30. enabled: yes
  31. tags: install
  32. - name: Show cluster if exists
  33. command: sacctmgr -n show cluster {{ inventory_hostname }}
  34. register: slurm_clusterlist
  35. changed_when: false
  36. - name: Create slurm cluster
  37. command: sacctmgr -i add cluster {{ inventory_hostname }}
  38. when: slurm_clusterlist.stdout.find(inventory_hostname) == 1
  39. - name: Show account
  40. command: sacctmgr show account
  41. register: account_added
  42. changed_when: false
  43. - name: Create default slurm group
  44. command: sacctmgr -i add account defaultgroup Cluster={{ inventory_hostname }} Description="Default Account" Organization="Default Org"
  45. when: account_added.stdout.find(inventory_hostname) == 1
  46. tags: install
  47. - name: Check if user exists
  48. command: sacctmgr show user
  49. register: user_added
  50. changed_when: false
  51. - name: Add root to the default account
  52. command: sacctmgr -i add user root DefaultAccount=defaultgroup
  53. when: account_added.stdout.find(inventory_hostname) == 1
  54. tags: install