diff --git a/roles/kubernetes/preinstall/defaults/main.yml b/roles/kubernetes/preinstall/defaults/main.yml index 8ab2c9aa1..0a168eb99 100644 --- a/roles/kubernetes/preinstall/defaults/main.yml +++ b/roles/kubernetes/preinstall/defaults/main.yml @@ -17,6 +17,7 @@ common_required_pkgs: - ebtables - bash-completion - tar + - "{{ kube_proxy_mode == 'ipvs' | ternary(['ipvsadm', 'ipset'], []) }}" # Set to true if your network does not support IPv6 # This may be necessary for pulling Docker images from diff --git a/roles/kubernetes/preinstall/tasks/0070-system-packages.yml b/roles/kubernetes/preinstall/tasks/0070-system-packages.yml index 8d02a8575..7f0c05474 100644 --- a/roles/kubernetes/preinstall/tasks/0070-system-packages.yml +++ b/roles/kubernetes/preinstall/tasks/0070-system-packages.yml @@ -59,14 +59,9 @@ tags: - bootstrap-os -- name: Update common_required_pkgs with ipvsadm when kube_proxy_mode is ipvs - set_fact: - common_required_pkgs: "{{ common_required_pkgs | default([]) + ['ipvsadm', 'ipset'] }}" - when: kube_proxy_mode == 'ipvs' - - name: Install packages requirements package: - name: "{{ required_pkgs | default([]) | union(common_required_pkgs | default([])) }}" + name: "{{ required_pkgs | union(common_required_pkgs) | flatten }}" state: present register: pkgs_task_result until: pkgs_task_result is succeeded