From 690166af9a538026c596b92e0d9516d0a89e24cc Mon Sep 17 00:00:00 2001 From: Jeff Geerling Date: Tue, 1 Sep 2020 12:22:54 -0500 Subject: [PATCH] PR #75 follow-up: Make sure proper package is present and only run on older Debian and other OSes. --- tasks/sysctl-setup.yml | 22 +++++++++++++++------- vars/Debian.yml | 1 + vars/RedHat.yml | 1 + 3 files changed, 17 insertions(+), 7 deletions(-) diff --git a/tasks/sysctl-setup.yml b/tasks/sysctl-setup.yml index f6332fd..174ebca 100644 --- a/tasks/sysctl-setup.yml +++ b/tasks/sysctl-setup.yml @@ -1,13 +1,21 @@ --- -# See: https://kubernetes.io/docs/setup/production-environment/tools/kubeadm/install-kubeadm/#letting-iptables-see-bridged-traffic -- name: Set sysctl for IPv4 bridges - sysctl: - name: net.bridge.bridge-nf-call-iptables - value: '1' +- name: Ensure procps is installed. + package: + name: "{{ procps_package }}" state: present + when: > + ansible_distribution != 'Debian' + or ansible_distribution_major_version | int < 10 -- name: Set sysctl for IPv6 bridges +# See: https://kubernetes.io/docs/setup/production-environment/tools/kubeadm/install-kubeadm/#letting-iptables-see-bridged-traffic +- name: Let iptables see bridged traffic. sysctl: - name: net.bridge.bridge-nf-call-ip6tables + name: "{{ item }}" value: '1' state: present + loop: + - net.bridge.bridge-nf-call-iptables + - net.bridge.bridge-nf-call-ip6tables + when: > + ansible_distribution != 'Debian' + or ansible_distribution_major_version | int < 10 diff --git a/vars/Debian.yml b/vars/Debian.yml index 67f5eae..8b8d1a2 100644 --- a/vars/Debian.yml +++ b/vars/Debian.yml @@ -1,2 +1,3 @@ --- +procps_package: procps kubelet_environment_file_path: /etc/default/kubelet diff --git a/vars/RedHat.yml b/vars/RedHat.yml index db8b7ac..e156651 100644 --- a/vars/RedHat.yml +++ b/vars/RedHat.yml @@ -1,4 +1,5 @@ --- +procps_package: procps-ng kubelet_environment_file_path: /etc/sysconfig/kubelet kubernetes_packages: - name: kubelet-{{ kubernetes_version_rhel_package }}-0