ansible-collections / community.windows

Windows community collection for Ansible
https://galaxy.ansible.com/community/windows
GNU General Public License v3.0
199 stars 153 forks source link

Fix Problem with multiple remoteips #440

Closed globi84 closed 1 year ago

globi84 commented 1 year ago
SUMMARY

There is a problem when you have defined multiple remoteip in the win_firewall_rule module mixed with ipv4 and ipv6. Ansible will always say there is a change because the ip's are not in the same order.

I fixed this problem, with the split command and compare both arrays. this way is no specific order needed.

ISSUE TYPE
COMPONENT NAME

win_firewall_rule

ADDITIONAL INFORMATION
# Config
- name: FileServer-ServerManager-Winmgmt-TCP-In
  community.windows.win_firewall_rule:
    name: File Server Remote Management (WMI-In)
    remoteip: "10.236.0.100/32,10.236.0.104/32,10.236.0.109/32,192.168.127.66/32,192.168.80.0/25,192.168.89.128/25,192.168.89.161/32,192.168.89.162/32,192.168.89.233/32,192.33.96.0/22,2001:1:10ec:3dc1::21/128,2001:1:10ec:3dc1::23/128,2001:1:10ec:3dc1::24/128,2001:1:10ec:3dc2::/118,2001:1:10ec:3dc4::/118"
    enabled: true
    profiles:
      - domain
      - private
      - public

#Before
changed: [phd-vm8]
[File Server Remote Management (WMI-In)]
-RemoteAddresses='10.236.0.100/255.255.255.255,10.236.0.104/255.255.255.255,10.236.0.109/255.255.255.255,192.168.80.0/255.255.255.128,192.168.89.128/255.255.255.128,192.168.127.66/255.255.255.255,2001:1:10ec:3dc2::/118,2001:1:10ec:3dc4::/118,2001:1:10ec:3dc1::21/128,2001:1:10ec:3dc1::24/128,2001:1:10ec:3dc1::23/128'
+RemoteAddresses='10.236.0.100/255.255.255.255,10.236.0.104/255.255.255.255,10.236.0.109/255.255.255.255,192.168.80.0/255.255.255.128,192.168.89.128/255.255.255.128,192.168.127.66/255.255.255.255,2001:1:10ec:3dc4::/118,2001:1:10ec:3dc2::/118,2001:1:10ec:3dc1::24/128,2001:1:10ec:3dc1::23/128,2001:1:10ec:3dc1::21/128'

#After
TASK [win_dfs : FileServer-ServerManager-Winmgmt-TCP-In] ***********************************************************************************
ok: [phd-vm8]
jborean93 commented 1 year ago

@globi84 do you need help trying to resolve the sanity problems? We'll have to get that fixed before we can move forward.

globi84 commented 1 year ago

@globi84 do you need help trying to resolve the sanity problems? We'll have to get that fixed before we can move forward.

Hi @jborean93

when you can tell me what is wrong on my site then will i made a fix.

for me does it look fine.

regards

jborean93 commented 1 year ago

If you look at the test failures at https://dev.azure.com/ansible/community.windows/_build/results?buildId=56378&view=logs&jobId=1bcebbb2-61b8-532e-b461-2508a6839989 you can see

00:23 ERROR: Found 1 line-endings issue(s) which need to be resolved: 00:23 ERROR: changelogs/fragments/440-win_firewall_rule.yml:0:0: use "\n" for line endings instead of "\r\n" (75%)

Your changelog file is using \r\n for line endings but we expect it to be \n. Make sure when you commit the file it contains \n line endings and not \r\n.

globi84 commented 1 year ago

I hope this is right for you

jborean93 commented 1 year ago

Thanks, it looks great.