robertdebock.dhcpd

Ansible Role: dhcpd

This guide helps you install and set up dhcpd (Dynamic Host Configuration Protocol daemon) on your system.

Links
GitHub GitLab Downloads Version
GitHub GitLab Downloads Version

Example Playbook

This example is from molecule/default/converge.yml and is tested every time there are new changes.

---
- name: Converge
  hosts: all
  become: true
  gather_facts: true

  vars:
    dhcpd_subnets:
      - network: "{{ ansible_default_ipv4.network }}"
        netmask: "255.255.255.0"

  roles:
    - role: robertdebock.dhcpd

Before running this, the machine needs to be set up. In a CI environment, this is done using molecule/default/prepare.yml:

---
- name: Prepare
  hosts: all
  become: true
  gather_facts: false

  roles:
    - role: robertdebock.bootstrap
    - role: robertdebock.apt_autostart
    - role: robertdebock.core_dependencies

For more details and examples, refer to this tutorial.

Role Variables

Default settings for variables can be found in defaults/main.yml:

---
# Default values for dhcpd

# Configuration for the DHCP daemon
dhcpd_ipv4_interface: "{{ ansible_default_ipv4.interface | default('eth0') }}"

# Global settings
dhcpd_default_lease_time: 600
dhcpd_max_lease_time: 7200
dhcpd_subnet_mask: "255.255.255.0"
dhcpd_broadcast_address: "10.0.2.255"
dhcpd_routers: "10.0.2.254"
dhcpd_domain_name_servers:
  - "192.168.1.1"
  - "192.168.1.2"
dhcpd_domain_search: example.com

# PXE booting settings
dhcpd_filename: "pxelinux.0"
dhcpd_next_server: "10.0.2.254"

# DHCP subnet properties
dhcpd_subnets:
  - network: "10.0.2.0"
    netmask: "255.255.255.0"
    range_start: "10.0.2.200"
    range_end: "10.0.2.210"

Requirements

State of Used Roles

These roles are used to set up the system, but you can choose a different method to prepare your system.

Requirement GitHub GitLab
robertdebock.apt_autostart GitHub Status GitLab Status
robertdebock.bootstrap GitHub Status GitLab Status
robertdebock.core_dependencies GitHub Status GitLab Status

Context

This role is part of many other related roles. For more information, check the documentation.

Compatibility

This role has been tested on different container images:

Container Tags
Alpine all
EL 9
Debian all
Fedora all
Ubuntu all

Ansible version 2.12 is the minimum required. Tests have also been conducted on prior versions and the current development version.

If you encounter any issues, please report them on GitHub.

License

This project is licensed under Apache-2.0.

Author Information

Created by robertdebock.

Consider sponsoring me.

Informazioni sul progetto

Install and configure dhcpd on your system.

Installa
ansible-galaxy install robertdebock.dhcpd
Licenza
apache-2.0
Download
804
Proprietario
I know my way around (Linux) infrastructure, have a passion for automation, Docker, Ansible, Molecule and ci/cd.