main.yml 2.0 KB

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