Matrix Docker Ansible eploy
Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

80 строки
1.9 KiB

  1. ---
  2. - name: Ensure Docker repository is enabled (CentOS)
  3. template:
  4. src: "{{ role_path }}/files/yum.repos.d/{{ item }}"
  5. dest: "/etc/yum.repos.d/{{ item }}"
  6. owner: "root"
  7. group: "root"
  8. mode: 0644
  9. with_items:
  10. - docker-ce.repo
  11. when: ansible_distribution == 'CentOS'
  12. - name: Ensure Docker's RPM key is trusted
  13. rpm_key:
  14. state: present
  15. key: https://download.docker.com/linux/centos/gpg
  16. when: ansible_distribution == 'CentOS'
  17. - name: Ensure yum packages are installed (CentOS)
  18. yum:
  19. name:
  20. - bash-completion
  21. - docker-ce
  22. - docker-python
  23. - ntp
  24. - fuse
  25. state: latest
  26. update_cache: yes
  27. when: ansible_distribution == 'CentOS'
  28. - name: Ensure APT usage dependencies are installed (Debian)
  29. apt:
  30. name:
  31. - apt-transport-https
  32. - ca-certificates
  33. state: present
  34. update_cache: yes
  35. when: ansible_os_family == 'Debian'
  36. - name: Ensure Docker's APT key is trusted (Debian)
  37. apt_key:
  38. url: https://download.docker.com/linux/ubuntu/gpg
  39. id: 9DC858229FC7DD38854AE2D88D81803C0EBFCD88
  40. state: present
  41. register: add_repository_key
  42. ignore_errors: true
  43. when: ansible_os_family == 'Debian'
  44. - name: Ensure Docker repository is enabled (Debian)
  45. apt_repository:
  46. repo: "deb [arch=amd64] https://download.docker.com/linux/{{ ansible_distribution|lower }} {{ ansible_distribution_release }} stable"
  47. state: present
  48. update_cache: yes
  49. when: ansible_os_family == 'Debian'
  50. - name: Ensure APT packages are installed (Debian)
  51. apt:
  52. name:
  53. - bash-completion
  54. - docker-ce
  55. - python-docker
  56. - ntp
  57. - fuse
  58. state: latest
  59. update_cache: yes
  60. when: ansible_os_family == 'Debian'
  61. - name: Ensure Docker is started and autoruns
  62. service:
  63. name: docker
  64. state: started
  65. enabled: yes
  66. - name: Ensure ntpd is started and autoruns
  67. service:
  68. name: "{{ 'ntpd' if ansible_os_family == 'RedHat' else 'ntp' }}"
  69. state: started
  70. enabled: yes