main.yml 1.9 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. systemd:
  26. name: slurmdbd
  27. state: restarted
  28. enabled: yes
  29. tags: install
  30. - name: Start slurmctld on manager
  31. systemd:
  32. name: slurmctld
  33. state: restarted
  34. enabled: yes
  35. tags: install
  36. - name: Show cluster if exists
  37. command: sacctmgr -n show cluster {{ cluster_name }}
  38. register: slurm_clusterlist
  39. changed_when: false
  40. - name: Create slurm cluster
  41. command: sacctmgr -i add cluster {{ cluster_name }}
  42. when: not slurm_clusterlist.stdout
  43. - name: Show account
  44. command: sacctmgr show account -s
  45. register: account_added
  46. changed_when: false
  47. - name: Create default slurm group
  48. command: sacctmgr -i add account defaultgroup Cluster={{ cluster_name }} Description="Default Account" Organization="Default Org"
  49. when: account_added.rc != 0
  50. - name: Check if user exists
  51. command: sacctmgr show user -s
  52. register: user_added
  53. changed_when: false
  54. - name: Add root to the default account
  55. command: sacctmgr -i add user root DefaultAccount=defaultgroup
  56. when: user_added.rc != 0