multi_profile_creation.yml 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. # Copyright 2022 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: Validate cobbler configuration status
  16. set_fact:
  17. cobbler_config_status: false
  18. profile_exists: false
  19. when: cobbler_config_status
  20. - name: Check prifile for {{ provision_os }} exists
  21. set_fact:
  22. profile_exists: true
  23. when: provision_os in cobbler_profile_list.stdout
  24. - name: Create a temp iso directory to mount the iso files
  25. file:
  26. path: "/mnt/tmp"
  27. state: directory
  28. mode: "{{ temp_file_perm }}"
  29. when: not profile_exists
  30. - name: Check {{ provision_os }} folder status
  31. stat:
  32. path: "/mnt/{{ provision_os }}"
  33. register: file_status
  34. - name: Create directory for {{ provision_os }} to copy the iso files
  35. file:
  36. path: "/mnt/{{ provision_os }}"
  37. state: directory
  38. mode: "{{ temp_file_perm }}"
  39. when:
  40. - not file_status.stat.exists
  41. - not profile_exists
  42. - name: Mount the iso file
  43. command: mount -o loop {{ iso_file_path }} /mnt/tmp
  44. args:
  45. warn: no
  46. when: not profile_exists
  47. - name: Copy the iso file inside /mnt
  48. command: rsync -AHPSXav /mnt/tmp/ /mnt/{{ provision_os }}/
  49. changed_when: false
  50. failed_when: false
  51. args:
  52. warn: false
  53. when: not profile_exists
  54. - name: Unmount /mnt/tmp for further mounts
  55. command: umount /mnt/tmp
  56. when: not profile_exists
  57. - name: Provision password validation
  58. import_tasks: provision_password.yml
  59. - name: Cobbler configuration
  60. import_tasks: configure_cobbler.yml