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.

69 lines
2.1 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_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. - name: ensure docker repository is enabled
  30. action: "{{ docker_repo_info.pkg_repo }}"
  31. args:
  32. repo: "{{item}}"
  33. state: present
  34. with_items: "{{ docker_repo_info.repos }}"
  35. when: docker_repo_info.repos|length > 0
  36. - name: Configure docker repository on RedHat/CentOS
  37. copy:
  38. src: "rh_docker.repo"
  39. dest: "/etc/yum.repos.d/docker.repo"
  40. when: ansible_distribution in ["CentOS","RedHat"] and
  41. ansible_distribution_major_version >= 7
  42. - name: ensure docker packages are installed
  43. action: "{{ docker_package_info.pkg_mgr }}"
  44. args:
  45. pkg: "{{item}}"
  46. state: present
  47. with_items: "{{ docker_package_info.pkgs }}"
  48. when: docker_package_info.pkgs|length > 0
  49. - name: allow for proxies on systems using systemd
  50. include: systemd-proxies.yml
  51. when: ansible_service_mgr == "systemd" and
  52. (http_proxy is defined or https_proxy is defined or no_proxy is defined)
  53. - meta: flush_handlers
  54. - name: ensure docker service is started and enabled
  55. service:
  56. name: "{{ item }}"
  57. enabled: yes
  58. state: started
  59. with_items:
  60. - docker