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.

66 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. 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: ensure docker packages are installed
  37. action: "{{ docker_package_info.pkg_mgr }}"
  38. args:
  39. pkg: "{{item}}"
  40. state: present
  41. with_items: "{{ docker_package_info.pkgs }}"
  42. when: docker_package_info.pkgs|length > 0
  43. - name: Centos needs xfs storage type for devicemapper if used
  44. lineinfile:
  45. dest: /etc/sysconfig/docker-storage
  46. line: "DOCKER_STORAGE_OPTIONS='--storage-opt dm.fs=xfs'"
  47. regexp: '^DOCKER_STORAGE_OPTIONS=.*$'
  48. state: present
  49. backup: yes
  50. when: ansible_os_family == "RedHat"
  51. - meta: flush_handlers
  52. - name: ensure docker service is started and enabled
  53. service:
  54. name: "{{ item }}"
  55. enabled: yes
  56. state: started
  57. with_items:
  58. - docker