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.

109 lines
3.3 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 either to 'generic', 'gce', 'aws' or 'openstack'"
  45. when: cloud_provider is defined and cloud_provider not in ['generic', 'gce', 'aws', 'openstack']
  46. - include: openstack-credential-check.yml
  47. when: cloud_provider is defined and cloud_provider == 'openstack'
  48. - name: Create cni directories
  49. file:
  50. path: "{{ item }}"
  51. state: directory
  52. owner: kube
  53. with_items:
  54. - "/etc/cni/net.d"
  55. - "/opt/cni/bin"
  56. when: kube_network_plugin in ["calico", "weave"]
  57. - name: Update package management cache (YUM)
  58. yum: update_cache=yes name='*'
  59. when: ansible_pkg_mgr == 'yum'
  60. - name: Install latest version of python-apt for Debian distribs
  61. apt: name=python-apt state=latest update_cache=yes cache_valid_time=3600
  62. when: ansible_os_family == "Debian"
  63. - name: Install python-dnf for latest RedHat versions
  64. command: dnf install -y python-dnf yum
  65. when: ansible_distribution == "Fedora" and
  66. ansible_distribution_major_version > 21
  67. changed_when: False
  68. - name: Install epel-release on RedHat/CentOS
  69. shell: rpm -qa | grep epel-release || rpm -ivh https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
  70. when: ansible_distribution in ["CentOS","RedHat"] and
  71. ansible_distribution_major_version >= 7
  72. changed_when: False
  73. - name: Install packages requirements
  74. action:
  75. module: "{{ ansible_pkg_mgr }}"
  76. name: "{{ item }}"
  77. state: latest
  78. with_items: "{{required_pkgs | default([]) | union(common_required_pkgs|default([]))}}"
  79. when: ansible_os_family != "CoreOS"
  80. # Todo : selinux configuration
  81. - name: Set selinux policy to permissive
  82. selinux: policy=targeted state=permissive
  83. when: ansible_os_family == "RedHat"
  84. changed_when: False
  85. - name: Write openstack cloud-config
  86. template:
  87. src: openstack-cloud-config.j2
  88. dest: "{{ kube_config_dir }}/cloud_config"
  89. group: "{{ kube_cert_group }}"
  90. mode: 0640
  91. when: cloud_provider is defined and cloud_provider == "openstack"
  92. - include: etchosts.yml