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.

70 lines
2.3 KiB

9 years ago
8 years ago
8 years ago
8 years ago
  1. ---
  2. - name: gather os specific variables
  3. include_vars: "{{ item }}"
  4. with_first_found:
  5. - files:
  6. - "{{ ansible_distribution|lower }}-{{ ansible_distribution_version|lower|replace('/', '_') }}.yml"
  7. - "{{ ansible_distribution|lower }}-{{ ansible_distribution_release }}.yml"
  8. - "{{ ansible_distribution|lower }}-{{ ansible_distribution_major_version|lower|replace('/', '_') }}.yml"
  9. - "{{ ansible_distribution|lower }}.yml"
  10. - "{{ ansible_os_family|lower }}.yml"
  11. - defaults.yml
  12. paths:
  13. - ../vars
  14. skip: true
  15. - name: check for minimum kernel version
  16. fail:
  17. msg: >
  18. docker requires a minimum kernel version of
  19. {{ docker_kernel_min_version }} on
  20. {{ ansible_distribution }}-{{ ansible_distribution_version }}
  21. when: (ansible_os_family != "CoreOS") and (ansible_kernel|version_compare(docker_kernel_min_version, "<"))
  22. - name: ensure docker repository public key is installed
  23. action: "{{ docker_repo_key_info.pkg_key }}"
  24. args:
  25. id: "{{item}}"
  26. keyserver: "{{docker_repo_key_info.keyserver}}"
  27. state: present
  28. with_items: "{{ docker_repo_key_info.repo_keys }}"
  29. when: ansible_os_family != "CoreOS"
  30. - name: ensure docker repository is enabled
  31. action: "{{ docker_repo_info.pkg_repo }}"
  32. args:
  33. repo: "{{item}}"
  34. state: present
  35. with_items: "{{ docker_repo_info.repos }}"
  36. when: (ansible_os_family != "CoreOS") and (docker_repo_info.repos|length > 0)
  37. - name: Configure docker repository on RedHat/CentOS
  38. copy:
  39. src: "rh_docker.repo"
  40. dest: "/etc/yum.repos.d/docker.repo"
  41. when: ansible_distribution in ["CentOS","RedHat"] and
  42. ansible_distribution_major_version >= 7
  43. - name: ensure docker packages are installed
  44. action: "{{ docker_package_info.pkg_mgr }}"
  45. args:
  46. pkg: "{{item.name}}"
  47. force: "{{item.force|default(omit)}}"
  48. state: present
  49. with_items: "{{ docker_package_info.pkgs }}"
  50. when: (ansible_os_family != "CoreOS") and (docker_package_info.pkgs|length > 0)
  51. - name: allow for proxies on systems using systemd
  52. include: systemd-proxies.yml
  53. when: ansible_service_mgr == "systemd" and
  54. (http_proxy is defined or https_proxy is defined or no_proxy is defined)
  55. - meta: flush_handlers
  56. - name: ensure docker service is started and enabled
  57. service:
  58. name: "{{ item }}"
  59. enabled: yes
  60. state: started
  61. with_items:
  62. - docker