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.

64 lines
1.9 KiB

9 years ago
9 years ago
9 years ago
9 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. - meta: flush_handlers
  50. - name: ensure docker service is started and enabled
  51. service:
  52. name: "{{ item }}"
  53. enabled: yes
  54. state: started
  55. with_items:
  56. - docker