setup_docker_symlink.yml 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. ---
  2. - block:
  3. - name: stop the current running docker
  4. systemd:
  5. state: stopped
  6. name: "{{ openshift_docker_service_name }}"
  7. - name: copy "{{ docker_default_storage_path }}" to "{{ docker_alt_storage_path }}"
  8. command: "cp -r {{ docker_default_storage_path }} {{ docker_alt_storage_path }}"
  9. register: results
  10. failed_when:
  11. - results.rc != 0
  12. - name: "Set the selinux context on {{ docker_alt_storage_path }}"
  13. command: "semanage fcontext -a -e {{ docker_default_storage_path }} {{ docker_alt_storage_path }}"
  14. environment:
  15. LANG: C
  16. register: results
  17. failed_when:
  18. - results.rc == 1
  19. - "'already exists' not in results.stderr"
  20. - name: "restorecon the {{ docker_alt_storage_path }}"
  21. command: "restorecon -r {{ docker_alt_storage_path }}"
  22. - name: ensure the unmount of top level mount point
  23. mount:
  24. path: "{{ docker_default_storage_path }}"
  25. state: unmounted
  26. - name: Remove the old docker location
  27. file:
  28. state: absent
  29. path: "{{ docker_default_storage_path }}"
  30. - name: Setup the link
  31. file:
  32. state: link
  33. src: "{{ docker_alt_storage_path }}"
  34. path: "{{ docker_default_storage_path }}"
  35. - name: start docker
  36. systemd:
  37. state: started
  38. name: "{{ openshift_docker_service_name }}"