main.yml 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. ---
  2. # These tasks dispatch to the proper set of docker tasks based on the
  3. # inventory:openshift_docker_use_system_container variable
  4. - include: udev_workaround.yml
  5. when: docker_udev_workaround | default(False) | bool
  6. - set_fact:
  7. l_use_system_container: "{{ openshift.docker.use_system_container | default(False) }}"
  8. l_use_crio: "{{ openshift_use_crio | default(False) }}"
  9. l_use_crio_only: "{{ openshift_use_crio_only | default(False) }}"
  10. - name: Add enterprise registry, if necessary
  11. set_fact:
  12. l2_docker_additional_registries: "{{ l2_docker_additional_registries + [openshift_docker_ent_reg] }}"
  13. when:
  14. - openshift.common.deployment_type == 'openshift-enterprise'
  15. - openshift_docker_ent_reg != ''
  16. - openshift_docker_ent_reg not in l2_docker_additional_registries
  17. - not l_use_crio_only
  18. - name: Use Package Docker if Requested
  19. include: package_docker.yml
  20. when:
  21. - not l_use_system_container
  22. - not l_use_crio_only
  23. - name: Use System Container Docker if Requested
  24. include: systemcontainer_docker.yml
  25. when:
  26. - l_use_system_container
  27. - not l_use_crio_only
  28. - name: Add CRI-O usage Requested
  29. include: systemcontainer_crio.yml
  30. when:
  31. - l_use_crio
  32. - openshift_docker_is_node_or_master | bool
  33. - name: stat the docker data dir
  34. stat:
  35. path: "{{ docker_default_storage_path }}"
  36. register: dockerstat
  37. - when:
  38. - l_use_crio
  39. - dockerstat.stat.islink is defined and not (dockerstat.stat.islink | bool)
  40. block:
  41. - name: stop the current running docker
  42. systemd:
  43. state: stopped
  44. name: "{{ openshift.docker.service_name }}"
  45. - name: "Ensure {{ docker_alt_storage_path }} exists"
  46. file:
  47. path: "{{ docker_alt_storage_path }}"
  48. state: directory
  49. - name: "Set the selinux context on {{ docker_alt_storage_path }}"
  50. command: "semanage fcontext -a -e {{ docker_default_storage_path }} {{ docker_alt_storage_path }}"
  51. register: results
  52. failed_when:
  53. - results.rc == 1
  54. - "'already exists' not in results.stderr"
  55. - name: "restorecon the {{ docker_alt_storage_path }}"
  56. command: "restorecon -r {{ docker_alt_storage_path }}"
  57. - name: Remove the old docker location
  58. file:
  59. state: absent
  60. path: "{{ docker_default_storage_path }}"
  61. - name: Setup the link
  62. file:
  63. state: link
  64. src: "{{ docker_alt_storage_path }}"
  65. path: "{{ docker_default_storage_path }}"
  66. - name: start docker
  67. systemd:
  68. state: started
  69. name: "{{ openshift.docker.service_name }}"