Skip to content

Commit

Permalink
CentOS/RHEL compatibility for Ansible roles
Browse files Browse the repository at this point in the history
- Setting IPv4 & IPv6 forwarding
- Setting `sysctl:net.bridge.bridge-nf-call-iptables` and `bridge-nf-call-ip6tables` to enabled since it is disabled by default on some CentOS systems
  • Loading branch information
xvzf committed Sep 28, 2019
1 parent 830a191 commit 2b10d43
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 1 deletion.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Build a Kubernetes cluster using Ansible with k3s. The goal is easily install a

- [X] Debian
- [ ] Ubuntu
- [ ] CentOS
- [X] CentOS

on processor architecture:

Expand Down
35 changes: 35 additions & 0 deletions roles/prereq/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
---
- name: Set SELinux to disabled state
selinux:
state: disabled
when: ansible_distribution == 'CentOS' or ansible_distribution == 'Red Hat Enterprise Linux'

- name: Enable IPv4 forwarding
sysctl:
name: net.ipv4.ip_forward
value: "1"
state: present
reload: yes

- name: Enable IPv6 forwarding
sysctl:
name: net.ipv6.conf.all.forwarding
value: "1"
state: present
reload: yes

- name: Set bridge-nf-call-iptables (just to be sure)
sysctl:
name: net.bridge.bridge-nf-call-iptables
value: "1"
state: present
reload: yes
when: ansible_distribution == 'CentOS' or ansible_distribution == 'Red Hat Enterprise Linux'

- name: Set bridge-nf-call-ip6tables (just to be sure)
sysctl:
name: net.bridge.bridge-nf-call-iptables
value: "1"
state: present
reload: yes
when: ansible_distribution == 'CentOS' or ansible_distribution == 'Red Hat Enterprise Linux'
1 change: 1 addition & 0 deletions site.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
gather_facts: yes
become: yes
roles:
- { role: prereq }
- { role: download }
- { role: raspbian }

Expand Down

0 comments on commit 2b10d43

Please sign in to comment.