Skip to content

Add firewalld/ufw support - #722

Open
redy01 wants to merge 6 commits into
autobase-tech:mainfrom
redy01:add-firewalld_ufw
Open

redy01 wants to merge 6 commits into
autobase-tech:mainfrom
redy01:add-firewalld_ufw

Conversation

@redy01

@redy01 redy01 commented Aug 6, 2024

Copy link
Copy Markdown

No description provided.

@redy01
redy01 marked this pull request as ready for review August 6, 2024 19:50
@SDV109

SDV109 commented Aug 13, 2024

Copy link
Copy Markdown
Contributor

@redy01 Hi, I completed all the settings, started running the ansible playbook-playbook deploy_pgcluster.yml and I get an error:
image

vars/system.yml

# Firewall
firewall_enabled_at_boot: true  # or 'true' for configure firewall
firewall_type: "firewalld"  # available 'iptables','firewalld','ufw'

@vitabaks

Copy link
Copy Markdown
Member

try to define three roles in the playbook instead of role: "fw_{{ firewall_type }}", each with its own condition

Example:

  roles:
    - role: fw_iptables
      vars:
        firewall_allowed_tcp_ports: "{{ firewall_ports_dynamic_var | default([]) | unique }}"
        firewall_additional_rules: "{{ firewall_rules_dynamic_var | default([]) | unique }}"
      when: firewall_type == 'iptables' and firewall_enabled_at_boot | bool
      tags: firewall

    - role: fw_firewalld
      vars:
        firewall_allowed_tcp_ports: "{{ firewall_ports_dynamic_var | default([]) | unique }}"
      when: firewall_type == 'firewalld' and firewall_enabled_at_boot | bool
      tags: firewall

    - role: fw_ufw
      vars:
        firewall_allowed_tcp_ports: "{{ firewall_ports_dynamic_var | default([]) | unique }}"
      when: firewall_type == 'ufw' and firewall_enabled_at_boot | bool
      tags: firewall

This approach increases clarity and can sometimes simplify troubleshooting by making the playbook's flow more explicit.

@vitabaks

vitabaks commented Aug 19, 2024

Copy link
Copy Markdown
Member

Please note that the ansible code has been moved to the automation directory.

@rausub

rausub commented Nov 8, 2024

Copy link
Copy Markdown

hi has there been any development on this ? Thanks :) great work guys

@vitabaks

Copy link
Copy Markdown
Member

The author of this PR has not completed it yet, I can do it if this functionality is really necessary.

@rausub

rausub commented Dec 19, 2024

Copy link
Copy Markdown

Hi, yes I believe this functionality is crucial as firewalld is the preferred way to manage on oracle/redhat and ufw in ubuntu. Maintaining iptables + firewalld can become cumbersome, would rather stick with just firewalld . Thanks ! Great work with the project

@vitabaks vitabaks added automation Automation functionality using Ansible priority: low labels Feb 21, 2025
@vitabaks vitabaks self-assigned this Jul 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

automation Automation functionality using Ansible priority: low

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants