Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update firewall rules for firewalld #329

Merged
merged 1 commit into from
May 30, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 33 additions & 2 deletions roles/prereq/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@
- name: If firewalld enabled, open api port
ansible.posix.firewalld:
port: "{{ api_port }}/tcp"
zone: trusted
zone: internal
state: enabled
permanent: true
immediate: true
Expand All @@ -82,10 +82,41 @@
when: groups['server'] | length > 1
ansible.posix.firewalld:
port: "2379-2381/tcp"
zone: trusted
zone: internal
state: enabled
permanent: true
immediate: true

- name: If firewalld enabled, open inter-node ports
ansible.posix.firewalld:
port: "{{ item }}"
zone: internal
state: enabled
permanent: true
immediate: true
with_items:
- 5001/tcp # Spegel (Embedded distributed registry)
- 8472/udp # Flannel VXLAN
- 10250/tcp # Kubelet metrics
- 51820/udp # Flannel Wireguard (IPv4)
- 51821/udp # Flannel Wireguard (IPv6)

- name: If firewalld enabled, allow node CIDRs
ansible.posix.firewalld:
source: "{{ item }}"
zone: internal
state: enabled
permanent: true
immediate: true
loop: >-
{{
(
groups['server'] | default([])
+ groups['agent'] | default([])
)
| map('extract', hostvars, ['ansible_default_ipv4', 'address'])
| flatten | unique | list
}}

- name: If firewalld enabled, allow default CIDRs
ansible.posix.firewalld:
Expand Down
Loading