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.

75 lines
2.4 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. tags: facts
  16. - name: check for minimum kernel version
  17. fail:
  18. msg: >
  19. docker requires a minimum kernel version of
  20. {{ docker_kernel_min_version }} on
  21. {{ ansible_distribution }}-{{ ansible_distribution_version }}
  22. when: (ansible_os_family != "CoreOS") and (ansible_kernel|version_compare(docker_kernel_min_version, "<"))
  23. tags: facts
  24. - name: ensure docker repository public key is installed
  25. action: "{{ docker_repo_key_info.pkg_key }}"
  26. args:
  27. id: "{{item}}"
  28. keyserver: "{{docker_repo_key_info.keyserver}}"
  29. state: present
  30. register: keyserver_task_result
  31. until: keyserver_task_result|success
  32. retries: 4
  33. delay: "{{ retry_stagger | random + 3 }}"
  34. with_items: "{{ docker_repo_key_info.repo_keys }}"
  35. when: ansible_os_family != "CoreOS"
  36. - name: ensure docker repository is enabled
  37. action: "{{ docker_repo_info.pkg_repo }}"
  38. args:
  39. repo: "{{item}}"
  40. state: present
  41. with_items: "{{ docker_repo_info.repos }}"
  42. when: (ansible_os_family != "CoreOS") and (docker_repo_info.repos|length > 0)
  43. - name: Configure docker repository on RedHat/CentOS
  44. copy:
  45. src: "rh_docker.repo"
  46. dest: "/etc/yum.repos.d/docker.repo"
  47. when: ansible_distribution in ["CentOS","RedHat"]
  48. - name: ensure docker packages are installed
  49. action: "{{ docker_package_info.pkg_mgr }}"
  50. args:
  51. pkg: "{{item.name}}"
  52. force: "{{item.force|default(omit)}}"
  53. state: present
  54. register: docker_task_result
  55. until: docker_task_result|success
  56. retries: 4
  57. delay: "{{ retry_stagger | random + 3 }}"
  58. with_items: "{{ docker_package_info.pkgs }}"
  59. when: (ansible_os_family != "CoreOS") and (docker_package_info.pkgs|length > 0)
  60. - name: Set docker systemd config
  61. include: systemd.yml
  62. - name: ensure docker service is started and enabled
  63. service:
  64. name: "{{ item }}"
  65. enabled: yes
  66. state: started
  67. with_items:
  68. - docker