Skip to content

Commit

Permalink
Fix sysctl not work issue
Browse files Browse the repository at this point in the history
  • Loading branch information
kairen committed Nov 16, 2018
1 parent e31c341 commit 2f3086e
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions roles/container-runtime/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,19 +20,19 @@
include_tasks: containerd/main.yml

- name: Check sysctl k8s file
stat: path=/etc/sysctl.d/k8s.conf
stat: path=/etc/sysctl.d/99-k8s.conf
register: check_sysctl_conf

- name: Write bridge-netfilter system variables
- name: Write bridge-netfilter and ip-forward system variables
when: not check_sysctl_conf.stat.exists
copy:
content: |
net.ipv4.ip_forward=1
net.bridge.bridge-nf-call-ip6tables=1
net.bridge.bridge-nf-call-iptables=1
dest: /etc/sysctl.d/k8s.conf
dest: /etc/sysctl.d/99-k8s.conf
register: copy_sysctl

- name: Enable bridge-netfilter system variables
- name: Enable bridge-netfilter and ip-forward system variables
when: copy_sysctl
command: "sysctl -p /etc/sysctl.d/k8s.conf"
command: "sysctl -p /etc/sysctl.d/99-k8s.conf"

0 comments on commit 2f3086e

Please sign in to comment.