setup_docker_symlink.yml 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  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: Remove the old docker location
  23. file:
  24. state: absent
  25. path: "{{ docker_default_storage_path }}"
  26. - name: Setup the link
  27. file:
  28. state: link
  29. src: "{{ docker_alt_storage_path }}"
  30. path: "{{ docker_default_storage_path }}"
  31. - name: start docker
  32. systemd:
  33. state: started
  34. name: "{{ openshift_docker_service_name }}"