ansible-collections / community.windows

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

Support Updating Existing Lease / Reservation with New MAC #511

Closed ai-ryanbess closed 1 year ago

ai-ryanbess commented 1 year ago

Please support being able to provide a new mac address for an existing lease / reservation. Currently it bombs at line 336 of the PowerShell script.

Usecase:
We use SNOW as our source of truth. As assets get onboarded we want them to always use a DHCP reservation (for multiple good reasons) and we need those reservations to be there ahead of when the actual equipment gets on the network (again for multiple good reasons). At time one a human types the mac address in wrong. Our code goes into SNOW and sees there a new mac for it to create a reservation with. I wrote some additional quick PowerShell to ask the DHCP server for the next available IP and then use that IP to make the DHCP reservation with the current MAC that is in SNOW. Now that IP has been added into the CI (Configuration Item) within SNOW. We have a lot of other downstream workflows that now use that IP that was created (Firewall stuff). In this instance the human realizes they err and go in and update the mac to the correct mac. Our code goes back into snow and retrieves the IP from the CI and the now correct mac address. Please support looking for the existing reservation by IP (I see you are doing this by mac only). The code will fail to find the mac but will find the reservation/lease by IP (get-dhcpserverv4lease or get-dhcpserverv4reservation). The end goal is it should update the mac on that lease.

ai-ryanbess commented 1 year ago

This is a bug in the code. Closing and re-opening as a bug