From c3c5817af6095624a6de0e9731628de0217a7637 Mon Sep 17 00:00:00 2001 From: mirwan Date: Fri, 27 Apr 2018 17:50:58 +0200 Subject: [PATCH] sysctl file should be in defaults so that it can be overriden (#2475) * sysctl file should be in defaults so that it can be overriden * Change sysctl_file_path to be consistent with roles/kubernetes/preinstall/defaults/main.yml --- roles/kubernetes/node/defaults/main.yml | 2 ++ roles/kubernetes/node/tasks/main.yml | 2 ++ roles/kubernetes/preinstall/defaults/main.yml | 2 ++ roles/kubernetes/preinstall/tasks/main.yml | 6 ------ 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/roles/kubernetes/node/defaults/main.yml b/roles/kubernetes/node/defaults/main.yml index e1a1f1777..35a364d21 100644 --- a/roles/kubernetes/node/defaults/main.yml +++ b/roles/kubernetes/node/defaults/main.yml @@ -93,6 +93,8 @@ kube_cadvisor_port: 0 # The read-only port for the Kubelet to serve on with no authentication/authorization. kube_read_only_port: 0 +# sysctl_file_path to add sysctl conf to +sysctl_file_path: "/etc/sysctl.d/99-sysctl.conf" # For the openstack integration kubelet will need credentials to access # openstack apis like nova and cinder. Per default this values will be diff --git a/roles/kubernetes/node/tasks/main.yml b/roles/kubernetes/node/tasks/main.yml index 13cc0740d..f7520caf8 100644 --- a/roles/kubernetes/node/tasks/main.yml +++ b/roles/kubernetes/node/tasks/main.yml @@ -61,6 +61,7 @@ name: net.ipv4.ip_local_reserved_ports value: "{{ kube_apiserver_node_port_range }}" sysctl_set: yes + sysctl_file: "{{ sysctl_file_path }}" state: present reload: yes when: kube_apiserver_node_port_range is defined @@ -96,6 +97,7 @@ sysctl: name: "{{ item }}" state: present + sysctl_file: "{{ sysctl_file_path }}" value: 1 reload: yes when: sysctl_bridge_nf_call_iptables.rc == 0 diff --git a/roles/kubernetes/preinstall/defaults/main.yml b/roles/kubernetes/preinstall/defaults/main.yml index 3bf847fb9..4e4b892b1 100644 --- a/roles/kubernetes/preinstall/defaults/main.yml +++ b/roles/kubernetes/preinstall/defaults/main.yml @@ -31,3 +31,5 @@ resolveconf_cloud_init_conf: /etc/resolveconf_cloud_init.conf populate_inventory_to_hosts_file: true preinstall_selinux_state: permissive + +sysctl_file_path: "/etc/sysctl.d/99-sysctl.conf" diff --git a/roles/kubernetes/preinstall/tasks/main.yml b/roles/kubernetes/preinstall/tasks/main.yml index 8df0ff9ee..0a994e8e2 100644 --- a/roles/kubernetes/preinstall/tasks/main.yml +++ b/roles/kubernetes/preinstall/tasks/main.yml @@ -245,12 +245,6 @@ tags: - bootstrap-os -- name: set default sysctl file path - set_fact: - sysctl_file_path: "/etc/sysctl.d/99-sysctl.conf" - tags: - - bootstrap-os - - name: Stat sysctl file configuration stat: path: "{{sysctl_file_path}}"