community.windows.win_dhcp_lease – Manage Windows Server DHCP Leases¶
Note
This plugin is part of the community.windows collection (version 1.3.0).
To install it use: ansible-galaxy collection install community.windows
.
To use it in a playbook, specify: community.windows.win_dhcp_lease
.
Synopsis¶
Manage Windows Server DHCP Leases (IPv4 Only)
Adds, Removes and Modifies DHCP Leases and Reservations
Task should be delegated to a Windows DHCP Server
Requirements¶
The below requirements are needed on the host that executes this module.
This module requires Windows Server 2012 or Newer
Parameters¶
Examples¶
- name: Ensure DHCP reservation exists
community.windows.win_dhcp_lease:
type: reservation
ip: 192.168.100.205
scope_id: 192.168.100.0
mac: 00:B1:8A:D1:5A:1F
dns_hostname: "{{ ansible_inventory }}"
description: Testing Server
- name: Ensure DHCP lease or reservation does not exist
community.windows.win_dhcp_lease:
mac: 00:B1:8A:D1:5A:1F
state: absent
- name: Ensure DHCP lease or reservation does not exist
community.windows.win_dhcp_lease:
ip: 192.168.100.205
state: absent
- name: Convert DHCP lease to reservation & update description
community.windows.win_dhcp_lease:
type: reservation
ip: 192.168.100.205
description: Testing Server
- name: Convert DHCP reservation to lease
community.windows.win_dhcp_lease:
type: lease
ip: 192.168.100.205
Return Values¶
Common return values are documented here, the following are the fields unique to this module:
Authors¶
Joe Zollo (@joezollo)