'Windows firewall rule delete with ansible

I am currently working on replacing my setup PS scripts with Ansible playbooks for Windows server setup.

There is a module community.windows.win_firewall_rule that allows you to edit, create and delete Windows firewall rules. Creating new rules and editing existing ones works fine.

What I can't do is delete existing (built-in) rules, e.g. "Xbox Game UI" or Cortana.

I haven't found an example where someone deleted a firewall rule. But from the documentation, I would guess that you only need the name and state absent to remove an existing firewall rule.

Or is it not possible to remove a built-in firewall rule? As an administrator in the GUI or via PS it's no problem to delete these and editing built-in rules via Ansible works fine.

What am I doing wrong ? The execution of the play does not fail, it just comes back ok without changing anything.

 - name: delete firewall rule Xbox Game UI
   community.windows.win_firewall_rule:
      name: "Xbox Game UI"
      state: absent
      # direction: out


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source