Browse Source

Merge pull request #1002 from code0x9/master

use ansible sysctl module for config ip forwarding
pull/1015/head
Bogdan Dobrelya 7 years ago
committed by GitHub
parent
commit
89ae9f1f88
1 changed files with 20 additions and 7 deletions
  1. 27
      roles/kubernetes/preinstall/tasks/main.yml

27
roles/kubernetes/preinstall/tasks/main.yml

@ -139,15 +139,28 @@
when: disable_ipv6_dns and not ansible_os_family in ["CoreOS", "Container Linux by CoreOS"] when: disable_ipv6_dns and not ansible_os_family in ["CoreOS", "Container Linux by CoreOS"]
tags: bootstrap-os 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}}
register: sysctl_file_stat
tags: bootstrap-os
- name: Change sysctl file path to link source if linked
set_fact:
sysctl_file_path: "{{sysctl_file_stat.stat.lnk_source}}"
when: sysctl_file_stat.stat.islnk is defined and sysctl_file_stat.stat.islnk
tags: bootstrap-os
- name: Enable ip forwarding - name: Enable ip forwarding
lineinfile:
dest: /etc/sysctl.d/99-sysctl.conf
regexp: '^net.ipv4.ip_forward='
line: 'net.ipv4.ip_forward=1'
sysctl:
sysctl_file: "{{sysctl_file_path}}"
name: net.ipv4.ip_forward
value: 1
state: present state: present
create: yes
backup: yes
validate: 'sysctl -f %s'
tags: bootstrap-os tags: bootstrap-os
- name: Write openstack cloud-config - name: Write openstack cloud-config

Loading…
Cancel
Save