configure_cobbler.yml 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  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: Delete the cobbler container if exits
  16. docker_container:
  17. name: cobbler
  18. state: absent
  19. tags: install
  20. when: cobbler_container_status == true and cobbler_config_status == false
  21. - name: Run cobbler container
  22. command: "{{ cobbler_run_command }}"
  23. changed_when: false
  24. tags: install
  25. when: cobbler_container_status == true and cobbler_config_status == false
  26. - name: Configuring cobbler inside container (It may take 5-10 mins)
  27. command: docker exec cobbler ansible-playbook /root/kickstart.yml
  28. changed_when: false
  29. tags: install
  30. when: cobbler_config_status == false
  31. - name: Schedule task
  32. cron:
  33. name: "start cobbler on reboot"
  34. special_time: reboot
  35. job: "ansible-playbook {{ role_path }}/files/start_cobbler.yml"
  36. tags: install
  37. when: cobbler_config_status == false
  38. - name: Execute cobbler sync in cobbler container
  39. command: docker exec cobbler cobbler sync
  40. changed_when: true
  41. when: cobbler_config_status == true
  42. - name: Remove the files
  43. file:
  44. path: "{{ item }}"
  45. state: absent
  46. with_items:
  47. - "{{ role_path }}/files/.users.digest"
  48. - "{{ role_path }}/files/dhcp.template"
  49. - "{{ role_path }}/files/settings"
  50. - "{{ role_path }}/files/centos7.ks"
  51. - "{{ role_path }}/files/new_mapping_file.csv.bak"