This role installs and configures a DHCP server.
This role requires Ansible 1.4 or higher and platform requirements are listed in the metadata file.
The variables that can be passed to this role and a brief description about them are as follows. These are all based on the configuration variales of the DHCP server configuration.
# Basic configuration information
dhcp_interfaces: eth0
dhcp_common_domain: example.org
dhcp_common_nameservers: ns1.example.org, ns2.example.org
dhcp_common_default_lease_time: 600
dhcp_common_max_lease_time: 7200
dhcp_common_ddns_update_style: none
dhcp_common_authoritative: true
dhcp_common_log_facility: local7
# Subnet configuration
dhcp_subnets:
# Required variables example
- base: 192.168.1.0
netmask: 255.255.255.0
# Full list of possibilities
- base: 192.168.10.0
netmask: 255.255.255.0
range_start: 192.168.10.150
range_end: 192.168.10.200
routers: 192.168.10.1
broadcast_address: 192.168.10.255
domain_nameservers: 192.168.10.1, 192.168.10.2
domain_name: example.org
default_lease_time: 3600
max_lease_time: 7200
# Fixed lease configuration
dhcp_hosts:
- name: local-server
mac_address: "00:11:22:33:44:55"
fixed_address: 192.168.10.10
default_lease_time: 43200
max_lease_time: 86400
# Class configuration
dhcp_classes:
- name: foo
rule: 'match if substring (option vendor-class-identifier, 0, 4) = "SUNW"'
# Shared network configurations
dhcp_shared_networks:
- name: shared-net
subnets:
- base: 192.168.100.0
netmask: 255.255.255.0
routers: 192.168.10.1
pools:
- range_start: 192.168.100.10
range_end: 192.168.100.20
rule: 'allow members of "foo"'
- range_start: 192.168.110.10
range_end: 192.168.110.20
rule: 'deny members of "foo"'
-
Install DHCP server on interface eth0 with one simple subnet:
- hosts: all
roles:
- role: dhcp_server
dhcp_interfaces: eth0
dhcp_common_domain: example.org
dhcp_common_nameservers: ns1.example.org, ns2.example.org
dhcp_common_default_lease_time: 600
dhcp_common_max_lease_time: 7200
dhcp_common_ddns_update_style: none
dhcp_common_authoritative: true
dhcp_common_log_facility: local7
dhcp_subnets:
- base: 192.168.10.0 netmask: 255.255.255.0 range_start: 192.168.10.150 range_end: 192.168.10.200 routers: 192.168.10.1
- role: dhcp_server
dhcp_interfaces: eth0
dhcp_common_domain: example.org
dhcp_common_nameservers: ns1.example.org, ns2.example.org
dhcp_common_default_lease_time: 600
dhcp_common_max_lease_time: 7200
dhcp_common_ddns_update_style: none
dhcp_common_authoritative: true
dhcp_common_log_facility: local7
dhcp_subnets:
- hosts: all
roles:
None
BSD
Philippe Dellaert