Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ability to retrieve dhcp reservation or lease without modification #591

Open
dbond007 opened this issue Nov 8, 2024 · 0 comments
Open

Comments

@dbond007
Copy link

dbond007 commented Nov 8, 2024

SUMMARY

I would like to be able to retrieve details about a reservation, specifically if its present, without modifying it.
Currently if using

- name: Locate the dhcp assigned ip address in the dhcp server
  community.windows.win_dhcp_lease:
    mac: "{{ find_mac }}"
  register: dhcp_results
  delegate_to: "{{ dhcp_delegate }}"

it will fail if it isn't present, and will modify the current entry if it is. Changing the name of the reservation to reservation-{MAC}
I want to know the details only, not make any changes. This is similar to the current feature request #498 to pull all info, but i want it for the mac address for a single lease

ISSUE TYPE
  • Allow dhcp info retrieval without modification of the current entry.
COMPONENT NAME

windows.win_dhcp_lease

ADDITIONAL INFORMATION

If only the mac is present, retrieve only, or if that's considered breaking change, as it may have been depended upon to auto (not that it creates and entry with only a mac, but if new functionality was made to create a new entry with a current free ip, then a different attribute, like lookup_mac would be needed for lookup only.

- name: Locate the dhcp assigned ip address in the dhcp server
  community.windows.win_dhcp_lease:
    lookup_mac: "{{ find_mac }}"
  register: dhcp_results
  delegate_to: "{{ dhcp_delegate }}"

Powershell to do the same would be:
Get-DhcpServerv4Scope | foreach {Get-DhcpServerv4Lease -computername $env:computername -allleases -ScopeId ($_.ScopeId)} | ? clientid -match 'xx-xx-xx-xx-xx-xx'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant