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.

128 lines
3.9 KiB

  1. ---
  2. - name: 'GIT | Install script for collecting git info'
  3. template:
  4. src: "{{ role_path }}/gen-gitinfos.sh"
  5. dest: "{{ bin_dir }}/gen-gitinfos.sh"
  6. mode: a+rwx
  7. - include: gitinfos.yml
  8. when: run_gitinfos
  9. - include: set_facts.yml
  10. - name: gather os specific variables
  11. include_vars: "{{ item }}"
  12. with_first_found:
  13. - files:
  14. - "{{ ansible_distribution|lower }}-{{ ansible_distribution_version|lower|replace('/', '_') }}.yml"
  15. - "{{ ansible_distribution|lower }}-{{ ansible_distribution_release }}.yml"
  16. - "{{ ansible_distribution|lower }}-{{ ansible_distribution_major_version|lower|replace('/', '_') }}.yml"
  17. - "{{ ansible_distribution|lower }}.yml"
  18. - "{{ ansible_os_family|lower }}.yml"
  19. - defaults.yml
  20. paths:
  21. - ../vars
  22. skip: true
  23. - name: Force binaries directory for CoreOS
  24. set_fact:
  25. bin_dir: "/opt/bin"
  26. when: ansible_os_family == "CoreOS"
  27. - name: Create kubernetes config directory
  28. file:
  29. path: "{{ kube_config_dir }}"
  30. state: directory
  31. owner: kube
  32. when: "{{ inventory_hostname in groups['k8s-cluster'] }}"
  33. - name: Create kubernetes script directory
  34. file:
  35. path: "{{ kube_script_dir }}"
  36. state: directory
  37. owner: kube
  38. when: "{{ inventory_hostname in groups['k8s-cluster'] }}"
  39. - name: Create kubernetes manifests directory
  40. file:
  41. path: "{{ kube_manifest_dir }}"
  42. state: directory
  43. owner: kube
  44. when: "{{ inventory_hostname in groups['k8s-cluster'] }}"
  45. - name: Create kubernetes logs directory
  46. file:
  47. path: "{{ kube_log_dir }}"
  48. state: directory
  49. owner: kube
  50. when: ansible_service_mgr in ["sysvinit","upstart"] and "{{ inventory_hostname in groups['k8s-cluster'] }}"
  51. - name: check cloud_provider value
  52. fail:
  53. msg: "If set the 'cloud_provider' var must be set either to 'generic', 'gce', 'aws' or 'openstack'"
  54. when: cloud_provider is defined and cloud_provider not in ['generic', 'gce', 'aws', 'openstack']
  55. - include: openstack-credential-check.yml
  56. when: cloud_provider is defined and cloud_provider == 'openstack'
  57. - name: Create cni directories
  58. file:
  59. path: "{{ item }}"
  60. state: directory
  61. owner: kube
  62. with_items:
  63. - "/etc/cni/net.d"
  64. - "/opt/cni/bin"
  65. when: kube_network_plugin in ["calico", "weave"] and "{{ inventory_hostname in groups['k8s-cluster'] }}"
  66. - name: Update package management cache (YUM)
  67. yum: update_cache=yes name='*'
  68. when: ansible_pkg_mgr == 'yum'
  69. - name: Install latest version of python-apt for Debian distribs
  70. apt: name=python-apt state=latest update_cache=yes cache_valid_time=3600
  71. when: ansible_os_family == "Debian"
  72. - name: Install python-dnf for latest RedHat versions
  73. command: dnf install -y python-dnf yum
  74. when: ansible_distribution == "Fedora" and
  75. ansible_distribution_major_version > 21
  76. changed_when: False
  77. - name: Install epel-release on RedHat/CentOS
  78. shell: rpm -qa | grep epel-release || rpm -ivh https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
  79. when: ansible_distribution in ["CentOS","RedHat"] and
  80. ansible_distribution_major_version >= 7
  81. changed_when: False
  82. - name: Install packages requirements
  83. action:
  84. module: "{{ ansible_pkg_mgr }}"
  85. name: "{{ item }}"
  86. state: latest
  87. with_items: "{{required_pkgs | default([]) | union(common_required_pkgs|default([]))}}"
  88. when: ansible_os_family != "CoreOS"
  89. - name: Disable IPv6 DNS lookup
  90. lineinfile:
  91. dest: /etc/gai.conf
  92. line: "precedence ::ffff:0:0/96 100"
  93. state: present
  94. backup: yes
  95. when: disable_ipv6_dns and ansible_os_family != "CoreOS"
  96. # Todo : selinux configuration
  97. - name: Set selinux policy to permissive
  98. selinux: policy=targeted state=permissive
  99. when: ansible_os_family == "RedHat"
  100. changed_when: False
  101. - name: Write openstack cloud-config
  102. template:
  103. src: openstack-cloud-config.j2
  104. dest: "{{ kube_config_dir }}/cloud_config"
  105. group: "{{ kube_cert_group }}"
  106. mode: 0640
  107. when: cloud_provider is defined and cloud_provider == "openstack"
  108. - include: etchosts.yml