exit: add DHCP relay for new server
Really quite shoddy as it is right now. Should get better once the old server is retired.
This commit is contained in:
parent
bb41d406f8
commit
99aef43574
5 changed files with 27 additions and 43 deletions
|
@ -1,17 +1,12 @@
|
|||
{% set dhcp_vlans = vrf_prefixes | selectattr('custom_fields.dhcp_ranges')
|
||||
| map(attribute='vlan.vid') | sort -%}
|
||||
{% set my_server = item.0 %}
|
||||
{% set my_vlans = item.1 | map(attribute='vlan.vid') | sort %}
|
||||
{% set my_prefix = prefixes | selectattr("prefix", "==", my_server | ipaddr("network/prefix")) | first -%}
|
||||
|
||||
# What servers should the DHCP relay forward requests to?
|
||||
SERVERS="{{ dhcp }}"
|
||||
|
||||
# On what interfaces should the DHCP relay (dhrelay) serve DHCP requests?
|
||||
# Always include the interface towards the DHCP server.
|
||||
# This variable requires a -i for each interface configured above.
|
||||
# This will be used in the actual dhcrelay command
|
||||
# For example, "-i eth0 -i eth1"
|
||||
INTF_CMD="{{ interfaces | selectattr('parent') | selectattr('parent.name', '==', 'bridge')
|
||||
| selectattr('untagged_vlan') | selectattr('untagged_vlan.vid', 'in', dhcp_vlans)
|
||||
| map(attribute='name') | sort | map('regex_replace', '^', '-id ') | join(' ') }} -iu {{ iface_uplink }} -iu peerlink.4"
|
||||
|
||||
# Additional options that are passed to the DHCP relay daemon?
|
||||
OPTIONS="-U outside"
|
||||
SERVERS="{{ my_server | ipaddr('address') }}"
|
||||
{% if my_prefix.vrf.name == 'outside' %}
|
||||
INTF_CMD="{{ my_vlans | map('regex_replace', '^', '-id bridge.') | join(' ') }} -iu {{ iface_uplink }} -iu peerlink.4 -U {{ my_prefix.vrf.name }}"
|
||||
OPTIONS=""
|
||||
{% else %}
|
||||
INTF_CMD="{{ my_vlans | map('regex_replace', '^', '-id bridge.') | join(' ') }} -U bridge.{{ my_prefix.vlan.vid }}"
|
||||
OPTIONS="--giaddr-src"
|
||||
{% endif %}
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
{% set dhcrelays = prefixes | selectattr('prefix', 'in', dhcp_servers | map('first') | ipaddr("network/prefix"))
|
||||
| map(attribute="vrf.name") | map('regex_replace', '^', 'dhcrelay@') %}
|
||||
{% set exits = [inventory_hostname, peer]|sort -%}
|
||||
|
||||
global_defs {
|
||||
|
@ -18,5 +20,8 @@ vrrp_instance dhcrelay {
|
|||
@^{{ exit }} {{ "169.254.1.0/24" | ipaddr(loop.index + 1) | ipaddr('address') }}
|
||||
{% endfor %}
|
||||
}
|
||||
notify /usr/local/bin/keepalive-service
|
||||
notify_master "systemctl start {{ dhcrelays | join(' ') }}"
|
||||
notify_fault "systemctl start {{ dhcrelays | join(' ') }}"
|
||||
notify_backup "systemctl stop {{ dhcrelays | join(' ') }}"
|
||||
notify_stop "systemctl stop {{ dhcrelays | join(' ') }}"
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue