You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

59 lines
1.8 KiB

  1. ---
  2. - name: Create docker service systemd directory if it doesn't exist
  3. file:
  4. path: /etc/systemd/system/docker.service.d
  5. state: directory
  6. - name: Write docker proxy drop-in
  7. template:
  8. src: http-proxy.conf.j2
  9. dest: /etc/systemd/system/docker.service.d/http-proxy.conf
  10. notify: restart docker
  11. when: http_proxy is defined or https_proxy is defined
  12. - name: get systemd version
  13. # noqa 303 - systemctl is called intentionally here
  14. shell: set -o pipefail && systemctl --version | head -n 1 | cut -d " " -f 2
  15. args:
  16. executable: /bin/bash
  17. register: systemd_version
  18. when: not is_ostree
  19. changed_when: false
  20. check_mode: false
  21. - name: Write docker.service systemd file
  22. template:
  23. src: docker.service.j2
  24. dest: /etc/systemd/system/docker.service
  25. register: docker_service_file
  26. notify: restart docker
  27. when: not ansible_os_family in ["Flatcar Container Linux by Kinvolk"]
  28. - name: Write docker options systemd drop-in
  29. template:
  30. src: docker-options.conf.j2
  31. dest: "/etc/systemd/system/docker.service.d/docker-options.conf"
  32. notify: restart docker
  33. - name: Write docker dns systemd drop-in
  34. template:
  35. src: docker-dns.conf.j2
  36. dest: "/etc/systemd/system/docker.service.d/docker-dns.conf"
  37. notify: restart docker
  38. when: dns_mode != 'none' and resolvconf_mode == 'docker_dns'
  39. - name: Copy docker orphan clean up script to the node
  40. copy:
  41. src: cleanup-docker-orphans.sh
  42. dest: "{{ bin_dir }}/cleanup-docker-orphans.sh"
  43. mode: 0755
  44. when: docker_orphan_clean_up | bool
  45. - name: Write docker orphan clean up systemd drop-in
  46. template:
  47. src: docker-orphan-cleanup.conf.j2
  48. dest: "/etc/systemd/system/docker.service.d/docker-orphan-cleanup.conf"
  49. notify: restart docker
  50. when: docker_orphan_clean_up | bool
  51. - meta: flush_handlers