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.

103 lines
2.9 KiB

  1. ---
  2. - include: gitinfos.yml
  3. when: run_gitinfos
  4. - name: gather os specific variables
  5. include_vars: "{{ item }}"
  6. with_first_found:
  7. - files:
  8. - "{{ ansible_distribution|lower }}-{{ ansible_distribution_version|lower|replace('/', '_') }}.yml"
  9. - "{{ ansible_distribution|lower }}-{{ ansible_distribution_release }}.yml"
  10. - "{{ ansible_distribution|lower }}-{{ ansible_distribution_major_version|lower|replace('/', '_') }}.yml"
  11. - "{{ ansible_distribution|lower }}.yml"
  12. - "{{ ansible_os_family|lower }}.yml"
  13. - defaults.yml
  14. paths:
  15. - ../vars
  16. skip: true
  17. - name: Force binaries directory for CoreOS
  18. set_fact:
  19. bin_dir: "/opt/bin"
  20. when: ansible_os_family == "CoreOS"
  21. - name: Create kubernetes config directory
  22. file:
  23. path: "{{ kube_config_dir }}"
  24. state: directory
  25. owner: kube
  26. - name: Create kubernetes script directory
  27. file:
  28. path: "{{ kube_script_dir }}"
  29. state: directory
  30. owner: kube
  31. - name: Create kubernetes manifests directory
  32. file:
  33. path: "{{ kube_manifest_dir }}"
  34. state: directory
  35. owner: kube
  36. - name: Create kubernetes logs directory
  37. file:
  38. path: "{{ kube_log_dir }}"
  39. state: directory
  40. owner: kube
  41. when: ansible_service_mgr in ["sysvinit","upstart"]
  42. - name: check cloud_provider value
  43. fail:
  44. msg: "If set the 'cloud_provider' var must be set eithe to 'gce' or 'aws'"
  45. when: cloud_provider is defined and cloud_provider not in ['gce', 'aws']
  46. - name: Create cni directories
  47. file:
  48. path: "{{ item }}"
  49. state: directory
  50. owner: kube
  51. with_items:
  52. - "/etc/cni/net.d"
  53. - "/opt/cni/bin"
  54. when: kube_network_plugin == "calico"
  55. - name: Update package management cache (YUM)
  56. yum: update_cache=yes name='*'
  57. when: ansible_pkg_mgr == 'yum'
  58. - name: Install latest version of python-apt for Debian distribs
  59. apt: name=python-apt state=latest update_cache=yes cache_valid_time=3600
  60. when: ansible_os_family == "Debian"
  61. - name: Install python-dnf for latest RedHat versions
  62. command: dnf install -y python-dnf yum
  63. when: ansible_distribution == "Fedora" and
  64. ansible_distribution_major_version > 21
  65. changed_when: False
  66. - name: Install epel-release on RHEL
  67. command: rpm -ivh http://dl.fedoraproject.org/pub/epel/7/x86_64/e/epel-release-7-5.noarch.rpm
  68. when: ansible_distribution == "RedHat"
  69. - name: Install epel-release on CentOS
  70. action:
  71. module: "{{ ansible_pkg_mgr }}"
  72. name: "epel-release"
  73. state: latest
  74. when: ansible_distribution == "CentOS"
  75. - name: Install packages requirements
  76. action:
  77. module: "{{ ansible_pkg_mgr }}"
  78. name: "{{ item }}"
  79. state: latest
  80. with_items: "{{required_pkgs | default([]) | union(common_required_pkgs|default([]))}}"
  81. when: ansible_os_family != "CoreOS"
  82. # Todo : selinux configuration
  83. - name: Set selinux policy to permissive
  84. selinux: policy=targeted state=permissive
  85. when: ansible_os_family == "RedHat"
  86. changed_when: False
  87. - include: etchosts.yml