# win\_firewall\_rule is removing even when state=present

**URL:** <https://forum.ansible.com/t/win-firewall-rule-is-removing-even-when-state-present/22466>\
**Category:** Ansible Project\
**Created:** [September 2, 2016, 1:44pm UTC](https://forum.ansible.com/t/win-firewall-rule-is-removing-even-when-state-present/22466 "2016-09-02T13:44:40Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Justin\_Dugan](https://avatars.discourse-cdn.com/v4/letter/j/9de053/32.png) [@Justin\_Dugan](https://forum.ansible.com/u/Justin_Dugan)\
**Post date:** [September 2, 2016, 1:44pm UTC](https://forum.ansible.com/t/win-firewall-rule-is-removing-even-when-state-present/22466/1 "2016-09-02T13:44:40Z")

</div>

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.
