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.

100 lines
2.7 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. - name: Create kubernetes config directory
  17. file:
  18. path: "{{ kube_config_dir }}"
  19. state: directory
  20. owner: kube
  21. - name: Create kubernetes script directory
  22. file:
  23. path: "{{ kube_script_dir }}"
  24. state: directory
  25. owner: kube
  26. - name: Create kubernetes manifests directory
  27. file:
  28. path: "{{ kube_manifest_dir }}"
  29. state: directory
  30. owner: kube
  31. - name: Create kubernetes logs directory
  32. file:
  33. path: "{{ kube_log_dir }}"
  34. state: directory
  35. owner: kube
  36. when: ansible_service_mgr in ["sysvinit","upstart"]
  37. - name: Create cni directories
  38. file:
  39. path: "{{ item }}"
  40. state: directory
  41. owner: kube
  42. with_items:
  43. - "/etc/cni/net.d"
  44. - "/opt/cni/bin"
  45. when: kube_network_plugin == "calico"
  46. - name: Update package management cache (APT)
  47. apt: update_cache=yes
  48. when: ansible_pkg_mgr == 'apt'
  49. - name: Update package management cache (YUM)
  50. yum: update_cache=yes name='*'
  51. when: ansible_pkg_mgr == 'yum'
  52. - name: Install python-apt for Debian distribs
  53. command: apt-get install -y python-apt
  54. when: ansible_os_family == "Debian"
  55. changed_when: False
  56. - name: Install python-dnf for latest RedHat versions
  57. command: dnf install -y python-dnf yum
  58. when: ansible_distribution == "Fedora" and
  59. ansible_distribution_major_version > 21
  60. changed_when: False
  61. - name: Install epel-release on RHEL
  62. command: rpm -ivh http://dl.fedoraproject.org/pub/epel/7/x86_64/e/epel-release-7-5.noarch.rpm
  63. when: ansible_distribution == "RedHat"
  64. - name: Install epel-release on CentOS
  65. action:
  66. module: "{{ ansible_pkg_mgr }}"
  67. name: "epel-release"
  68. state: latest
  69. when: ansible_distribution == "CentOS"
  70. - name: Install packages requirements
  71. action:
  72. module: "{{ ansible_pkg_mgr }}"
  73. name: "{{ item }}"
  74. state: latest
  75. with_items: "{{required_pkgs | union(common_required_pkgs)}}"
  76. when: ansible_os_family in [ "Debian", "RedHat" ]
  77. # Todo : selinux configuration
  78. - name: Set selinux policy to permissive
  79. selinux: policy=targeted state=permissive
  80. when: ansible_os_family == "RedHat"
  81. changed_when: False
  82. - include: etchosts.yml
  83. - include: python-bootstrap.yml
  84. when: ansible_os_family not in [ "Debian", "RedHat" ]