dhcp_provisioner
Ansible Role: dhcp_provisioner¶
Table of Contents:
Overview¶
dhcp_provisioner is a role to build and deploy a DHCP configuration file to support Zero Touch Provisioning with Arista EOS devices.
!!! tip - The role supports 2 modes: offline
and online
:
Offline
mode let you generate a configuration you can apply on your DHCP server after carefully reviewing it.Online
mode lets you generate and push configuration to Cloudvision, RHEL or Ubuntu based linux systems.
Role requirements¶
This role requires to install arista.cvp
collection to support CloudVision interactions.
$ ansible-galaxy collection install arista.cvp
Role Inputs and Outputs¶
Inputs¶
Inventory configuration¶
An entry must be part of the inventory to describe DHCP server.
all:
children:
TOOLS:
hosts:
dhcp_server01:
Module variables¶
Variables dedicated to DHCP device¶
fabric_group
: Ansible group where devices are defined per type.ztp_network_summary
: Subnet where DHCP will listen for requestztp_pool_start
: First IP available in the poolztp_pool_end
: Last IP available in the poolztp_lease_time
: Maximum lease time before device loose IP. Renewal is max/2 (default is 300sec)ztp_mac_source
: Define which mac-address field is used for identification: interface ma-address (interface
) or system-mac-address (system
). Default:system
ztp_mode
: Define how role works eitheroffline
oronline
. (Defaultoffline
)
Example:
---
- name: Build Switch configuration
hosts: TOOLS
connection: local
gather_facts: false
tasks:
- name: Create dhcp configuration file
import_role:
name: arista.avd.dhcp_provisioner
vars:
ztp_network_summary: 10.73.1.0/24
ztp_pool_start: 10.73.1.200
ztp_pool_end: 10.73.1.210
ztp_lease_time: 300
fabric_group: 'DC1_FABRIC'
ztp_mac_source: system
This module also reads information from Fabric definition. For any node defined under spine, l3leaf and l2leaf, role generate an DHCP entry if mac-address is found. Entry is based on the following fields:
mgmt_ip
: Management IP set as pereos_designs
mac_address
: Mac address used for DHCP. it can be either interface mac-address or system-mac-address
# Spine Switches
spine:
platform: vEOS-LAB
bgp_as: 65001
# defines the range of acceptable remote ASNs from leaf switches
nodes:
AVD2-SPINE1:
id: 1
mgmt_ip: 10.73.254.1/24
mac_address: '0c:1d:c0:1d:62:01'
AVD2-SPINE2:
id: 2
mgmt_ip: 10.73.254.2/24
mac_address: '0c:1d:c0:1d:62:02'
This module also use cvp_instance_ip
/ cvp_instance_ips
knob to set correct registration URL. So in case you need to extend TerminAttr daemon, you should use an approach similar to the following code:
cvp_instance_ips:
- < cvp instance 01 >
- < cvp instance 02 >
- < cvp instance 03 >
cvp_ingestauth_key: < Fake ingest key overwritten by custom_structured_configuration >
# Cloud Vision server information
custom_structured_configuration_daemon_terminattr:
cvauth:
method: "token"
token_file: "< path to the token file >"
Outputs¶
- DHCP configuration file under
intended/configs/dhcpd.conf
Tasks¶
- Generate structured configuration for DHCP configuration as documented in
arista.cvp.dhcp_configuration
. - Load generated variables.
- Create DHCP configuration file.
- If mode is online, apply configuration to DHCP server.
Requirements¶
Requirements are located here: avd-requirements
License¶
Project is published under Apache 2.0 License