main.yaml 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. ---
  2. - name: stop docker
  3. service: name=docker state=stopped
  4. - block:
  5. - name: create the docker-storage config file
  6. template:
  7. src: "{{ role_path }}/templates/docker-storage-setup-overlayfs.j2"
  8. dest: /etc/sysconfig/docker-storage-setup
  9. owner: root
  10. group: root
  11. mode: 0644
  12. when:
  13. - ansible_distribution_version | version_compare('7.4', '>=')
  14. - ansible_distribution == "RedHat"
  15. - block:
  16. - name: create the docker-storage-setup config file
  17. template:
  18. src: "{{ role_path }}/templates/docker-storage-setup-dm.j2"
  19. dest: /etc/sysconfig/docker-storage-setup
  20. owner: root
  21. group: root
  22. mode: 0644
  23. when:
  24. - ansible_distribution_version | version_compare('7.4', '<')
  25. - ansible_distribution == "RedHat"
  26. - block:
  27. - name: create the docker-storage-setup config file for CentOS
  28. template:
  29. src: "{{ role_path }}/templates/docker-storage-setup-dm.j2"
  30. dest: /etc/sysconfig/docker-storage-setup
  31. owner: root
  32. group: root
  33. mode: 0644
  34. # TODO(shadower): Find out which CentOS version supports overlayfs2
  35. when:
  36. - ansible_distribution == "CentOS"
  37. - name: Install Docker
  38. package: name=docker state=present
  39. - name: start docker
  40. service: name=docker state=restarted enabled=true