configure_cobbler.yml 3.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  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: Deploy cobbler pod
  16. command: "kubectl apply -f {{ role_path }}/files/k8s_cobbler.yml"
  17. changed_when: true
  18. tags: install
  19. when:
  20. - cobbler_container_status
  21. - not cobbler_config_status
  22. - not provision_os_change
  23. - name: Wait for cobbler pod to come to ready state
  24. command: kubectl wait --for=condition=ready -n {{ cobbler_namespace }} pod -l app=cobbler
  25. changed_when: false
  26. tags: install
  27. - name: Get cobbler pod name
  28. command: 'kubectl get pod -n {{ cobbler_namespace }} -l app=cobbler -o jsonpath="{.items[0].metadata.name}"'
  29. changed_when: false
  30. register: cobbler_pod_name
  31. tags: install
  32. - name: Wait for 30 seconds to get cobbler pod ready
  33. wait_for:
  34. timeout: 30
  35. - name: Configuring cobbler inside container (It may take 5-10 mins)
  36. command: "kubectl exec --stdin --tty -n {{ cobbler_namespace }} {{ cobbler_pod_name.stdout }} -- ansible-playbook /root/cobbler_configurations_rocky.yml -e provision_os={{ provision_os }} -e file_perm={{ file_perm }}"
  37. changed_when: true
  38. tags: install
  39. when:
  40. - not cobbler_config_status
  41. - mgmt_os == os_supported_rocky
  42. - not provision_os_change
  43. - name: Configuring cobbler inside container (It may take 5-10 mins)
  44. command: "kubectl exec --stdin --tty -n {{ cobbler_namespace }} {{ cobbler_pod_name.stdout }} -- ansible-playbook /root/cobbler_configurations_leap.yml -e provision_os={{ provision_os }} -e host_network_nic={{ host_network_nic }} -e file_perm={{ file_perm }}"
  45. changed_when: true
  46. tags: install
  47. when:
  48. - not cobbler_config_status
  49. - os_supported_leap in mgmt_os
  50. - not provision_os_change
  51. - name: Configuring cobbler for multiple profile support
  52. command: "kubectl exec --stdin --tty -n {{ cobbler_namespace }} {{ cobbler_pod_name.stdout }} -- ansible-playbook /root/multi_cluster_provisioning.yml -e provision_os={{ provision_os }} -e provision_os_change={{ provision_os_change }} -e file_perm={{ file_perm }}"
  53. changed_when: true
  54. tags: install
  55. when: provision_os_change
  56. - name: Execute cobbler sync in cobbler container
  57. command: 'kubectl exec --stdin --tty -n {{ cobbler_namespace }} {{ cobbler_pod_name.stdout }} -- cobbler sync'
  58. changed_when: true
  59. when: cobbler_config_status
  60. - name: Store the provisioned os in .provisioned_os.txt file
  61. shell: echo "{{ provision_os }}">> {{ role_path }}/files/.provisioned_os
  62. changed_when: false
  63. - name: Remove the files
  64. file:
  65. path: "{{ item }}"
  66. state: absent
  67. with_items:
  68. - "{{ role_path }}/files/.users.digest"
  69. - "{{ role_path }}/files/dhcp.template"
  70. - "{{ role_path }}/files/settings"
  71. - "{{ role_path }}/files/temp_host_mapping_file.csv.bak"
  72. - "/mnt/tmp"