I created the rule using the following in powershell:
netsh advfirewall firewall add rule name=JBoss dir=in action=allow protocol=tcp localport=“8080,8443,9990”
Then after running the following in ansible, the rule is removed:
- name: Setup firewall for JBoss
win_firewall_rule:
name: JBoss
state: present
localport: ‘8080,8443,9990’
action: allow
direction: in
protocol: tcp
force: yes
If force is commented, it complains the rule already exists. With force, it removes the rule instead of updating it if required. If the rule doesn’t already exist, it is not created using ansible.