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.

191 lines
5.1 KiB

9 years ago
Upgrade ansible (#10190) * project: update all dependencies including ansible Upgrade to ansible 7.x and ansible-core 2.14.x. There seems to be issue with ansible 8/ansible-core 2.15 so we remain on those versions for now. It's quite a big bump already anyway. Signed-off-by: Arthur Outhenin-Chalandre <arthur.outhenin-chalandre@proton.ch> * tests: install aws galaxy collection Signed-off-by: Arthur Outhenin-Chalandre <arthur.outhenin-chalandre@proton.ch> * ansible-lint: disable various rules after ansible upgrade Temporarily disable a bunch of linting action following ansible upgrade. Those should be taken care of separately. Signed-off-by: Arthur Outhenin-Chalandre <arthur.outhenin-chalandre@proton.ch> * project: resolve deprecated-module ansible-lint error Signed-off-by: Arthur Outhenin-Chalandre <arthur.outhenin-chalandre@proton.ch> * project: resolve no-free-form ansible-lint error Signed-off-by: Arthur Outhenin-Chalandre <arthur.outhenin-chalandre@proton.ch> * project: resolve schema[meta] ansible-lint error Signed-off-by: Arthur Outhenin-Chalandre <arthur.outhenin-chalandre@proton.ch> * project: resolve schema[playbook] ansible-lint error Signed-off-by: Arthur Outhenin-Chalandre <arthur.outhenin-chalandre@proton.ch> * project: resolve schema[tasks] ansible-lint error Signed-off-by: Arthur Outhenin-Chalandre <arthur.outhenin-chalandre@proton.ch> * project: resolve risky-file-permissions ansible-lint error Signed-off-by: Arthur Outhenin-Chalandre <arthur.outhenin-chalandre@proton.ch> * project: resolve risky-shell-pipe ansible-lint error Signed-off-by: Arthur Outhenin-Chalandre <arthur.outhenin-chalandre@proton.ch> * project: remove deprecated warn args Signed-off-by: Arthur Outhenin-Chalandre <arthur.outhenin-chalandre@proton.ch> * project: use fqcn for non builtin tasks Signed-off-by: Arthur Outhenin-Chalandre <arthur.outhenin-chalandre@proton.ch> * project: resolve syntax-check[missing-file] for contrib playbook Signed-off-by: Arthur Outhenin-Chalandre <arthur.outhenin-chalandre@proton.ch> * project: use arithmetic inside jinja to fix ansible 6 upgrade Signed-off-by: Arthur Outhenin-Chalandre <arthur.outhenin-chalandre@proton.ch> --------- Signed-off-by: Arthur Outhenin-Chalandre <arthur.outhenin-chalandre@proton.ch>
1 year ago
Upgrade ansible (#10190) * project: update all dependencies including ansible Upgrade to ansible 7.x and ansible-core 2.14.x. There seems to be issue with ansible 8/ansible-core 2.15 so we remain on those versions for now. It's quite a big bump already anyway. Signed-off-by: Arthur Outhenin-Chalandre <arthur.outhenin-chalandre@proton.ch> * tests: install aws galaxy collection Signed-off-by: Arthur Outhenin-Chalandre <arthur.outhenin-chalandre@proton.ch> * ansible-lint: disable various rules after ansible upgrade Temporarily disable a bunch of linting action following ansible upgrade. Those should be taken care of separately. Signed-off-by: Arthur Outhenin-Chalandre <arthur.outhenin-chalandre@proton.ch> * project: resolve deprecated-module ansible-lint error Signed-off-by: Arthur Outhenin-Chalandre <arthur.outhenin-chalandre@proton.ch> * project: resolve no-free-form ansible-lint error Signed-off-by: Arthur Outhenin-Chalandre <arthur.outhenin-chalandre@proton.ch> * project: resolve schema[meta] ansible-lint error Signed-off-by: Arthur Outhenin-Chalandre <arthur.outhenin-chalandre@proton.ch> * project: resolve schema[playbook] ansible-lint error Signed-off-by: Arthur Outhenin-Chalandre <arthur.outhenin-chalandre@proton.ch> * project: resolve schema[tasks] ansible-lint error Signed-off-by: Arthur Outhenin-Chalandre <arthur.outhenin-chalandre@proton.ch> * project: resolve risky-file-permissions ansible-lint error Signed-off-by: Arthur Outhenin-Chalandre <arthur.outhenin-chalandre@proton.ch> * project: resolve risky-shell-pipe ansible-lint error Signed-off-by: Arthur Outhenin-Chalandre <arthur.outhenin-chalandre@proton.ch> * project: remove deprecated warn args Signed-off-by: Arthur Outhenin-Chalandre <arthur.outhenin-chalandre@proton.ch> * project: use fqcn for non builtin tasks Signed-off-by: Arthur Outhenin-Chalandre <arthur.outhenin-chalandre@proton.ch> * project: resolve syntax-check[missing-file] for contrib playbook Signed-off-by: Arthur Outhenin-Chalandre <arthur.outhenin-chalandre@proton.ch> * project: use arithmetic inside jinja to fix ansible 6 upgrade Signed-off-by: Arthur Outhenin-Chalandre <arthur.outhenin-chalandre@proton.ch> --------- Signed-off-by: Arthur Outhenin-Chalandre <arthur.outhenin-chalandre@proton.ch>
1 year ago
Upgrade ansible (#10190) * project: update all dependencies including ansible Upgrade to ansible 7.x and ansible-core 2.14.x. There seems to be issue with ansible 8/ansible-core 2.15 so we remain on those versions for now. It's quite a big bump already anyway. Signed-off-by: Arthur Outhenin-Chalandre <arthur.outhenin-chalandre@proton.ch> * tests: install aws galaxy collection Signed-off-by: Arthur Outhenin-Chalandre <arthur.outhenin-chalandre@proton.ch> * ansible-lint: disable various rules after ansible upgrade Temporarily disable a bunch of linting action following ansible upgrade. Those should be taken care of separately. Signed-off-by: Arthur Outhenin-Chalandre <arthur.outhenin-chalandre@proton.ch> * project: resolve deprecated-module ansible-lint error Signed-off-by: Arthur Outhenin-Chalandre <arthur.outhenin-chalandre@proton.ch> * project: resolve no-free-form ansible-lint error Signed-off-by: Arthur Outhenin-Chalandre <arthur.outhenin-chalandre@proton.ch> * project: resolve schema[meta] ansible-lint error Signed-off-by: Arthur Outhenin-Chalandre <arthur.outhenin-chalandre@proton.ch> * project: resolve schema[playbook] ansible-lint error Signed-off-by: Arthur Outhenin-Chalandre <arthur.outhenin-chalandre@proton.ch> * project: resolve schema[tasks] ansible-lint error Signed-off-by: Arthur Outhenin-Chalandre <arthur.outhenin-chalandre@proton.ch> * project: resolve risky-file-permissions ansible-lint error Signed-off-by: Arthur Outhenin-Chalandre <arthur.outhenin-chalandre@proton.ch> * project: resolve risky-shell-pipe ansible-lint error Signed-off-by: Arthur Outhenin-Chalandre <arthur.outhenin-chalandre@proton.ch> * project: remove deprecated warn args Signed-off-by: Arthur Outhenin-Chalandre <arthur.outhenin-chalandre@proton.ch> * project: use fqcn for non builtin tasks Signed-off-by: Arthur Outhenin-Chalandre <arthur.outhenin-chalandre@proton.ch> * project: resolve syntax-check[missing-file] for contrib playbook Signed-off-by: Arthur Outhenin-Chalandre <arthur.outhenin-chalandre@proton.ch> * project: use arithmetic inside jinja to fix ansible 6 upgrade Signed-off-by: Arthur Outhenin-Chalandre <arthur.outhenin-chalandre@proton.ch> --------- Signed-off-by: Arthur Outhenin-Chalandre <arthur.outhenin-chalandre@proton.ch>
1 year ago
Upgrade ansible (#10190) * project: update all dependencies including ansible Upgrade to ansible 7.x and ansible-core 2.14.x. There seems to be issue with ansible 8/ansible-core 2.15 so we remain on those versions for now. It's quite a big bump already anyway. Signed-off-by: Arthur Outhenin-Chalandre <arthur.outhenin-chalandre@proton.ch> * tests: install aws galaxy collection Signed-off-by: Arthur Outhenin-Chalandre <arthur.outhenin-chalandre@proton.ch> * ansible-lint: disable various rules after ansible upgrade Temporarily disable a bunch of linting action following ansible upgrade. Those should be taken care of separately. Signed-off-by: Arthur Outhenin-Chalandre <arthur.outhenin-chalandre@proton.ch> * project: resolve deprecated-module ansible-lint error Signed-off-by: Arthur Outhenin-Chalandre <arthur.outhenin-chalandre@proton.ch> * project: resolve no-free-form ansible-lint error Signed-off-by: Arthur Outhenin-Chalandre <arthur.outhenin-chalandre@proton.ch> * project: resolve schema[meta] ansible-lint error Signed-off-by: Arthur Outhenin-Chalandre <arthur.outhenin-chalandre@proton.ch> * project: resolve schema[playbook] ansible-lint error Signed-off-by: Arthur Outhenin-Chalandre <arthur.outhenin-chalandre@proton.ch> * project: resolve schema[tasks] ansible-lint error Signed-off-by: Arthur Outhenin-Chalandre <arthur.outhenin-chalandre@proton.ch> * project: resolve risky-file-permissions ansible-lint error Signed-off-by: Arthur Outhenin-Chalandre <arthur.outhenin-chalandre@proton.ch> * project: resolve risky-shell-pipe ansible-lint error Signed-off-by: Arthur Outhenin-Chalandre <arthur.outhenin-chalandre@proton.ch> * project: remove deprecated warn args Signed-off-by: Arthur Outhenin-Chalandre <arthur.outhenin-chalandre@proton.ch> * project: use fqcn for non builtin tasks Signed-off-by: Arthur Outhenin-Chalandre <arthur.outhenin-chalandre@proton.ch> * project: resolve syntax-check[missing-file] for contrib playbook Signed-off-by: Arthur Outhenin-Chalandre <arthur.outhenin-chalandre@proton.ch> * project: use arithmetic inside jinja to fix ansible 6 upgrade Signed-off-by: Arthur Outhenin-Chalandre <arthur.outhenin-chalandre@proton.ch> --------- Signed-off-by: Arthur Outhenin-Chalandre <arthur.outhenin-chalandre@proton.ch>
1 year ago
Upgrade ansible (#10190) * project: update all dependencies including ansible Upgrade to ansible 7.x and ansible-core 2.14.x. There seems to be issue with ansible 8/ansible-core 2.15 so we remain on those versions for now. It's quite a big bump already anyway. Signed-off-by: Arthur Outhenin-Chalandre <arthur.outhenin-chalandre@proton.ch> * tests: install aws galaxy collection Signed-off-by: Arthur Outhenin-Chalandre <arthur.outhenin-chalandre@proton.ch> * ansible-lint: disable various rules after ansible upgrade Temporarily disable a bunch of linting action following ansible upgrade. Those should be taken care of separately. Signed-off-by: Arthur Outhenin-Chalandre <arthur.outhenin-chalandre@proton.ch> * project: resolve deprecated-module ansible-lint error Signed-off-by: Arthur Outhenin-Chalandre <arthur.outhenin-chalandre@proton.ch> * project: resolve no-free-form ansible-lint error Signed-off-by: Arthur Outhenin-Chalandre <arthur.outhenin-chalandre@proton.ch> * project: resolve schema[meta] ansible-lint error Signed-off-by: Arthur Outhenin-Chalandre <arthur.outhenin-chalandre@proton.ch> * project: resolve schema[playbook] ansible-lint error Signed-off-by: Arthur Outhenin-Chalandre <arthur.outhenin-chalandre@proton.ch> * project: resolve schema[tasks] ansible-lint error Signed-off-by: Arthur Outhenin-Chalandre <arthur.outhenin-chalandre@proton.ch> * project: resolve risky-file-permissions ansible-lint error Signed-off-by: Arthur Outhenin-Chalandre <arthur.outhenin-chalandre@proton.ch> * project: resolve risky-shell-pipe ansible-lint error Signed-off-by: Arthur Outhenin-Chalandre <arthur.outhenin-chalandre@proton.ch> * project: remove deprecated warn args Signed-off-by: Arthur Outhenin-Chalandre <arthur.outhenin-chalandre@proton.ch> * project: use fqcn for non builtin tasks Signed-off-by: Arthur Outhenin-Chalandre <arthur.outhenin-chalandre@proton.ch> * project: resolve syntax-check[missing-file] for contrib playbook Signed-off-by: Arthur Outhenin-Chalandre <arthur.outhenin-chalandre@proton.ch> * project: use arithmetic inside jinja to fix ansible 6 upgrade Signed-off-by: Arthur Outhenin-Chalandre <arthur.outhenin-chalandre@proton.ch> --------- Signed-off-by: Arthur Outhenin-Chalandre <arthur.outhenin-chalandre@proton.ch>
1 year ago
  1. ---
  2. - name: Fetch facts
  3. import_tasks: facts.yml
  4. tags:
  5. - facts
  6. - kubelet
  7. - name: Pre-upgrade kubelet
  8. import_tasks: pre_upgrade.yml
  9. tags:
  10. - kubelet
  11. - name: Ensure /var/lib/cni exists
  12. file:
  13. path: /var/lib/cni
  14. state: directory
  15. mode: "0755"
  16. - name: Install kubelet binary
  17. import_tasks: install.yml
  18. tags:
  19. - kubelet
  20. - name: Install kube-vip
  21. import_tasks: loadbalancer/kube-vip.yml
  22. when:
  23. - ('kube_control_plane' in group_names)
  24. - kube_vip_enabled
  25. tags:
  26. - kube-vip
  27. - name: Install nginx-proxy
  28. import_tasks: loadbalancer/nginx-proxy.yml
  29. when:
  30. - ('kube_control_plane' not in group_names) or (kube_apiserver_bind_address != '0.0.0.0')
  31. - loadbalancer_apiserver_localhost
  32. - loadbalancer_apiserver_type == 'nginx'
  33. tags:
  34. - nginx
  35. - name: Install haproxy
  36. import_tasks: loadbalancer/haproxy.yml
  37. when:
  38. - ('kube_control_plane' not in group_names) or (kube_apiserver_bind_address != '0.0.0.0')
  39. - loadbalancer_apiserver_localhost
  40. - loadbalancer_apiserver_type == 'haproxy'
  41. tags:
  42. - haproxy
  43. - name: Ensure nodePort range is reserved
  44. ansible.posix.sysctl:
  45. name: net.ipv4.ip_local_reserved_ports
  46. value: "{{ kube_apiserver_node_port_range }}"
  47. sysctl_set: true
  48. sysctl_file: "{{ sysctl_file_path }}"
  49. state: present
  50. reload: true
  51. when: kube_apiserver_node_port_range is defined
  52. tags:
  53. - kube-proxy
  54. - name: Verify if br_netfilter module exists
  55. command: "modinfo br_netfilter"
  56. environment:
  57. PATH: "{{ ansible_env.PATH }}:/sbin" # Make sure we can workaround RH's conservative path management
  58. register: modinfo_br_netfilter
  59. failed_when: modinfo_br_netfilter.rc not in [0, 1]
  60. changed_when: false
  61. check_mode: false
  62. # TODO: Remove once upstream issue is fixed
  63. # https://github.com/ansible-collections/community.general/issues/7717
  64. - name: Verify br_netfilter module path exists
  65. file:
  66. path: "{{ item }}"
  67. state: directory
  68. mode: "0755"
  69. loop:
  70. - /etc/modules-load.d
  71. - /etc/modprobe.d
  72. - name: Enable br_netfilter module
  73. community.general.modprobe:
  74. name: br_netfilter
  75. state: present
  76. when: modinfo_br_netfilter.rc == 0
  77. - name: Persist br_netfilter module
  78. copy:
  79. dest: /etc/modules-load.d/kubespray-br_netfilter.conf
  80. content: br_netfilter
  81. mode: "0644"
  82. when: modinfo_br_netfilter.rc == 0
  83. # kube-proxy needs net.bridge.bridge-nf-call-iptables enabled when found if br_netfilter is not a module
  84. - name: Check if bridge-nf-call-iptables key exists
  85. command: "sysctl net.bridge.bridge-nf-call-iptables"
  86. failed_when: false
  87. changed_when: false
  88. check_mode: false
  89. register: sysctl_bridge_nf_call_iptables
  90. - name: Enable bridge-nf-call tables
  91. ansible.posix.sysctl:
  92. name: "{{ item }}"
  93. state: present
  94. sysctl_file: "{{ sysctl_file_path }}"
  95. value: "1"
  96. reload: true
  97. when: sysctl_bridge_nf_call_iptables.rc == 0
  98. with_items:
  99. - net.bridge.bridge-nf-call-iptables
  100. - net.bridge.bridge-nf-call-arptables
  101. - net.bridge.bridge-nf-call-ip6tables
  102. - name: Modprobe Kernel Module for IPVS
  103. community.general.modprobe:
  104. name: "{{ item }}"
  105. state: present
  106. persistent: present
  107. loop: "{{ kube_proxy_ipvs_modules }}"
  108. when: kube_proxy_mode == 'ipvs'
  109. tags:
  110. - kube-proxy
  111. - name: Modprobe conntrack module
  112. community.general.modprobe:
  113. name: "{{ item }}"
  114. state: present
  115. persistent: present
  116. register: modprobe_conntrack_module
  117. ignore_errors: true # noqa ignore-errors
  118. loop: "{{ conntrack_modules }}"
  119. when:
  120. - kube_proxy_mode == 'ipvs'
  121. - "(modprobe_conntrack_module|default({'rc': 1})).rc != 0" # loop until first success
  122. tags:
  123. - kube-proxy
  124. - name: Check cloud provider credentials
  125. include_tasks: "cloud-credentials/{{ cloud_provider }}-credential-check.yml"
  126. when:
  127. - cloud_provider is defined
  128. - cloud_provider in [ 'openstack', 'azure', 'vsphere' ]
  129. tags:
  130. - cloud-provider
  131. - facts
  132. - name: Test if openstack_cacert is a base64 string
  133. set_fact:
  134. openstack_cacert_is_base64: "{% if openstack_cacert is search('^([A-Za-z0-9+/]{4})*([A-Za-z0-9+/]{3}= | [A-Za-z0-9+/]{2}==)?$') %}true{% else %}false{% endif %}"
  135. when:
  136. - cloud_provider is defined
  137. - cloud_provider == 'openstack'
  138. - openstack_cacert is defined
  139. - openstack_cacert | length > 0
  140. - name: Write cacert file
  141. copy:
  142. src: "{{ openstack_cacert if not openstack_cacert_is_base64 else omit }}"
  143. content: "{{ openstack_cacert | b64decode if openstack_cacert_is_base64 else omit }}"
  144. dest: "{{ kube_config_dir }}/openstack-cacert.pem"
  145. group: "{{ kube_cert_group }}"
  146. mode: "0640"
  147. when:
  148. - cloud_provider is defined
  149. - cloud_provider == 'openstack'
  150. - openstack_cacert is defined
  151. - openstack_cacert | length > 0
  152. tags:
  153. - cloud-provider
  154. - name: Write cloud-config
  155. template:
  156. src: "cloud-configs/{{ cloud_provider }}-cloud-config.j2"
  157. dest: "{{ kube_config_dir }}/cloud_config"
  158. group: "{{ kube_cert_group }}"
  159. mode: "0640"
  160. when:
  161. - cloud_provider is defined
  162. - cloud_provider in [ 'openstack', 'azure', 'vsphere', 'aws', 'gce' ]
  163. notify: Node | restart kubelet
  164. tags:
  165. - cloud-provider
  166. - name: Install kubelet
  167. import_tasks: kubelet.yml
  168. tags:
  169. - kubelet
  170. - kubeadm