Description
ansible.general 5.7.0
Problematic Scenario
checkmk_agent_server
is FQDN. No firewall related vars are overwritten.
Actual variables:
checkmk_agent_server = "my-checkmk-server.internal"
checkmk_agent_server_ips = [] # i.e. len == 0 # default
checkmk_agent_configure_firewall: 'true' # default
Experienced results:
No firewalld rule is applied, so agent-installed hosts remain unmonitorable if firewalld is active.
Expected results
We expect to obtain a local firewalld rule equivalent of performing following command on monitored host:
sudo firewall-cmd --permanent --add-port=6556/tcp
sudo firewall-cmd --reload
No rich rules would be needed.
Successful scenario(s)
checkmk_agent_server
is an IP, or checkmk_agent_server_ips
is populated with at least one IP.
This way a rich rule is applied.
Other notes
Tested with RHEL 9 agents, no Debian derivates were tested.
There is a problem with new checkmk_agent_server_ips variable behavior. If i do NOT want to set these IPs, like default behavior with defaults vars, firewall rule is not honored. Expected default behavior would be:
Let's say we have default vars like this:
checkmk_agent_server_ips = [] # i.e. len == 0 checkmk_agent_configure_firewall: 'true'
We expect to obtain a firewall rule on port of checkmk agent (6556) after role implementation.
BUT, with these conditions no firewall rule is performed because checkmk_agent_server_ips is not defined or empty ('[]'). Still, no rich rule is needed, a simple port opening is ok if no checkmk_agent_server_ips are applied.
If
checkmk_agent_server_ips
is populated with checkmk server IP or others (len > 1) rich rule may apply. Follow current behaviour.I experienced this with RHEL derivates, Debian systems were not tested.
Originally posted by @gabrielgbs97 in #593