main.yml 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  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: check slurmdbd is active
  37. systemd:
  38. name: slurmdbd
  39. register: slurmdbd_status
  40. until: 'slurmdbd_status.status.ActiveState=="active"'
  41. retries: 20
  42. - name: Show cluster if exists
  43. command: sacctmgr -n show cluster {{ cluster_name }}
  44. register: slurm_clusterlist
  45. changed_when: false
  46. - name: Create slurm cluster
  47. command: sacctmgr -i add cluster {{ cluster_name }}
  48. when: not slurm_clusterlist.stdout
  49. - name: Show account
  50. command: sacctmgr show account -s
  51. register: account_added
  52. changed_when: false
  53. - name: Create default slurm group
  54. command: sacctmgr -i add account defaultgroup Cluster={{ cluster_name }} Description="Default Account" Organization="Default Org"
  55. when: account_added.rc != 0
  56. - name: Check if user exists
  57. command: sacctmgr show user -s
  58. register: user_added
  59. changed_when: false
  60. - name: Add root to the default account
  61. command: sacctmgr -i add user root DefaultAccount=defaultgroup
  62. when: user_added.rc != 0