Matrix Docker Ansible eploy
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.
 
 

90 rivejä
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. - dig
  35. - python-dns
  36. state: present
  37. update_cache: yes
  38. when: ansible_os_family == 'Debian'
  39. - name: Ensure Docker's APT key is trusted (Debian)
  40. apt_key:
  41. url: https://download.docker.com/linux/ubuntu/gpg
  42. id: 9DC858229FC7DD38854AE2D88D81803C0EBFCD88
  43. state: present
  44. register: add_repository_key
  45. ignore_errors: true
  46. when: ansible_os_family == 'Debian'
  47. - name: Ensure Docker repository is enabled (Debian)
  48. apt_repository:
  49. repo: "deb https://download.docker.com/linux/{{ ansible_distribution|lower }} {{ ansible_distribution_release }} stable"
  50. state: present
  51. update_cache: yes
  52. when: ansible_os_family == 'Debian'
  53. - name: Ensure APT packages are installed (Debian)
  54. apt:
  55. name:
  56. - bash-completion
  57. - docker-ce
  58. - python-docker
  59. - ntp
  60. - fuse
  61. state: latest
  62. update_cache: yes
  63. when: ansible_os_family == 'Debian'
  64. - name: Ensure firewalld is started and autoruns
  65. service:
  66. name: firewalld
  67. state: started
  68. enabled: yes
  69. when: ansible_os_family == 'RedHat'
  70. - name: Ensure Docker is started and autoruns
  71. service:
  72. name: docker
  73. state: started
  74. enabled: yes
  75. - name: Ensure ntpd is started and autoruns
  76. service:
  77. name: "{{ 'ntpd' if ansible_os_family == 'RedHat' else 'ntp' }}"
  78. state: started
  79. enabled: yes