Matrix Docker Ansible eploy
選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。
 
 

91 行
2.3 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: Gather package facts (Debian)
  37. package_facts:
  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' and 'docker.io' not in ansible_facts.packages
  47. - name: Ensure Docker repository is enabled (Debian)
  48. apt_repository:
  49. repo: "deb [arch=amd64] 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' and 'docker.io' not in ansible_facts.packages
  53. - name: Ensure APT packages are installed (Debian)
  54. apt:
  55. name:
  56. - bash-completion
  57. - python-docker
  58. - ntp
  59. - fuse
  60. state: latest
  61. update_cache: yes
  62. when: ansible_os_family == 'Debian'
  63. - name: Ensure docker-ce is installed (Debian)
  64. apt:
  65. name:
  66. - docker-ce
  67. state: latest
  68. update_cache: yes
  69. when: "'docker.io' not in ansible_facts.packages"
  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