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.

67 lines
2.0 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. - name: check for minimum kernel version
  15. fail:
  16. msg: >
  17. docker requires a minimum kernel version of
  18. {{ docker_kernel_min_version }} on
  19. {{ ansible_distribution }}-{{ ansible_distribution_version }}
  20. when: ansible_kernel|version_compare(docker_kernel_min_version, "<")
  21. - name: ensure docker repository public key is installed
  22. action: "{{ docker_repo_key_info.pkg_key }}"
  23. args:
  24. id: "{{item}}"
  25. keyserver: "{{docker_repo_key_info.keyserver}}"
  26. state: present
  27. with_items: docker_repo_key_info.repo_keys
  28. - name: ensure docker repository is enabled
  29. action: "{{ docker_repo_info.pkg_repo }}"
  30. args:
  31. repo: "{{item}}"
  32. update_cache: yes
  33. state: present
  34. with_items: docker_repo_info.repos
  35. when: docker_repo_info.repos|length > 0
  36. - name: ensure docker packages are installed
  37. action: "{{ docker_package_info.pkg_mgr }}"
  38. args:
  39. pkg: "{{item}}"
  40. update_cache: yes
  41. state: latest
  42. with_items: docker_package_info.pkgs
  43. when: docker_package_info.pkgs|length > 0
  44. - name: Centos needs xfs storage type for devicemapper if used
  45. lineinfile:
  46. dest: /etc/sysconfig/docker-storage
  47. line: "DOCKER_STORAGE_OPTIONS='--storage-opt dm.fs=xfs'"
  48. regexp: '^DOCKER_STORAGE_OPTIONS=.*$'
  49. state: present
  50. backup: yes
  51. when: ansible_os_family == "RedHat"
  52. - meta: flush_handlers
  53. - name: ensure docker service is started and enabled
  54. service:
  55. name: "{{ item }}"
  56. enabled: yes
  57. state: started
  58. with_items:
  59. - docker