Matrix Docker Ansible eploy
Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.
 
 

82 linhas
2.1 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. - firewalld
  24. - ntp
  25. - fuse
  26. state: latest
  27. update_cache: yes
  28. when: ansible_distribution == 'CentOS'
  29. - name: Ensure APT usage dependencies are installed (Debian)
  30. apt:
  31. name:
  32. - apt-transport-https
  33. - ca-certificates
  34. state: present
  35. update_cache: yes
  36. when: ansible_os_family == 'Debian'
  37. - name: Ensure Docker's APT key is trusted (Debian)
  38. apt_key:
  39. url: https://download.docker.com/linux/ubuntu/gpg
  40. id: 9DC858229FC7DD38854AE2D88D81803C0EBFCD88
  41. state: present
  42. register: add_repository_key
  43. ignore_errors: true
  44. when: ansible_os_family == 'Debian'
  45. - name: Ensure Docker repository is enabled (Debian)
  46. apt_repository:
  47. repo: "deb https://download.docker.com/linux/{{ ansible_distribution|lower }} {{ ansible_distribution_release }} stable"
  48. state: present
  49. update_cache: yes
  50. when: ansible_os_family == 'Debian'
  51. - name: Ensure APT packages are installed (Debian)
  52. apt:
  53. name:
  54. - bash-completion
  55. - docker-ce
  56. - python-docker
  57. - ntp
  58. - fuse
  59. state: latest
  60. update_cache: yes
  61. when: ansible_os_family == 'Debian'
  62. - name: Ensure firewalld is started and autoruns
  63. service: name=firewalld state=started enabled=yes
  64. when: ansible_os_family == 'RedHat'
  65. - name: Ensure Docker is started and autoruns
  66. service: name=docker state=started enabled=yes
  67. - name: Ensure ntpd is started and autoruns
  68. service:
  69. name: "{{ 'ntpd' if ansible_os_family == 'RedHat' else 'ntp' }}"
  70. state: started
  71. enabled: yes