Skip to content

parallaxisjones/ansible-role-dhcp

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

DHCP Role

Build Status

Description

This role manages the installation of DHCPd on a Raspberry Pi, although it should be able to manage any other Debian based system. When paired with the bind role, this role will set a DHCP server which will automatically create A and PTR records for new hosts whcih recieve an IP address from this DHCP server.

Provides

  1. An DHCP server

Requires

  1. Ansible 1.6 or higher
  2. Raspberry Pi (possibly other Debian based systems)

Variables

  • dhcp_static_hosts - A hash defining static IP address assignments. name, mac, and ip are required for each static host.
    • name - the hostname of the client
    • mac - the mac address of the client using colons
    • ip - the IP you want to assign the client.
  • dhcp_ddns_server - The DNS server where the DHCP server will report new clients. Use localhost if using the bind role.
  • dhcp_name_server - The IP of the DNS server clients should use.
  • dhcp_domain - The local domain to use. This is used to provide a search domain to clients.
  • dhcp_subnet_mask: The subnet mask to use for the DHCP network. Default '255.255.255.0'
  • dhcp_range - This defines the range of IPs which will be assigned to clients. The pool of addresses will range from low to high.
    • low - the first IP to assign to requesting clients
    • high - the last IP to assign to requesting clients
  • dhcp_network_ip - The IP representing the network. Ususally it's the first IP in the subnet. Example: '192.168.101.0'
  • dhcp_router: The IP of the default route to pass on to clients.
  • dhcp_broadcast_ip: The broadcast IP for the DHCP network. Usually this is the last IP in the subnet. Example: '192.168.101.255'
  • dhcp_reverse_zone_name: The reverse zone name. This is used to report to the DNS server when creating a new PTR record. Example: '101.168.192'
  • dhcp_service_name - The service name of the DHCPd service. This should not be chaned. Default: 'isc-dhcp-server'

Changing Variable Values

To Change the value of variables, create a file in host_vars/ or group_vars/ or define variables in the playbook.

There are other options for changing variable values. See Ansible Variable Documentation for more ideas.

Usage

Include this role in your plays and set varaibles as desired.

---
  name: dhcp-servers
  hosts: dhcp-servers
  vars:
    dhcp_range:
      low: '192.168.0.50'
      high: '192.168.0.100'
  roles:
    - dhcp

Tests

This role includes Travis CI tests.

About

Ansible role to configure DHCP on a Raspberry Pi

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published