ansible/linux/dhclient.yml

24 lines
772 B
YAML

---
## Configures dhclient to use the MAC address of the system instead of Client ID, removes all previous leases, and restarts the networking service.
- hosts: all
gather_facts: yes
become: yes
tasks:
- name: Configure dhclient to use the MAC address of the system instead of Client ID.
blockinfile:
state: present
insertafter: EOF
dest: /etc/dhcp/dhclient.conf
marker: "# Changed by ansible playbook: Use MAC address instead of DHCP Client ID"
content: |
send dhcp-client-identifier = hardware;
- name: Remove any dhclient leases in /var/lib/dhcp.
shell:
cmd: rm /var/lib/dhcp/*
removes: /var/lib/dhcp/*
- name: Restart networking service.
service:
name: networking
state: restarted