Skip to content

Commit 11f6a75

Browse files
committed
Add EdgeRouter config deployment.
* Add edgerouter role to deploy DHCP server and static hosts. * Deploy cycletrailer's DHCP config.
1 parent 0f6146b commit 11f6a75

File tree

5 files changed

+47
-1
lines changed

5 files changed

+47
-1
lines changed

group_vars/routers/all.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
---
2+
edgerouter_dhcp_networks:
3+
- name: cycledhcp
4+
subnet: 10.20.0.0/16
5+
static-hosts:
6+
- hostname: earl.noise
7+
ipaddress: 10.20.0.10
8+
mac-address: b8:27:eb:0c:c6:e9
9+
- hostname: enter-ap.noise
10+
ipaddress: 10.20.0.13
11+
mac-address: 80:2a:a8:c0:f7:44

hosts.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,11 @@ all:
3131
cloud:
3232
hosts:
3333
cloud.noise: {}
34+
routers:
35+
hosts:
36+
# EdgeRouter ER-4
37+
cycletrailer.noisebridge.net:
38+
ansible_network_os: edgeos
3439

3540
# Aliases (production)
3641
noisebridge-net:

roles/edgerouter/defaults/main.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
edgerouter_dhcp_subnets:
3+
internal:
4+
subnet: 192.168.0.0/24
5+
6+
edgerouter_static_hosts: {}

roles/edgerouter/tasks/main.yml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
---
2+
- name: Create DHCP network
3+
edgeos_config:
4+
lines:
5+
- "set system dhcp-server shared-network-name {{ item.name }} subnet {{ item.subnet }}"
6+
connection: network_cli
7+
with_items: "{{ edgerouter_dhcp_networks }}"
8+
9+
- name: Add static hosts
10+
edgeos_config:
11+
lines:
12+
- "set system static-host-mapping host-name {{ item.1.hostname }} inet {{ item.1.ipaddress }}"
13+
- "set service dhcp-server shared-network-name {{ item.0.name }} subnet {{ item.0.subnet }} static-mapping {{ item.1.hostname }} ip-address {{ item.1.ipaddress }}"
14+
- "set service dhcp-server shared-network-name {{ item.0.name }} subnet {{ item.0.subnet }} static-mapping {{ item.1.hostname }} mac-address '{{ item.1.mac-address }}'"
15+
connection: network_cli
16+
with_subelements:
17+
- "{{ edgerouter_dhcp_networks }}"
18+
- static-hosts

site.yml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22

33
- name: node defaults
4-
hosts: all
4+
hosts: all:!routers
55
become: yes
66
become_method: sudo
77
tags: [common]
@@ -81,3 +81,9 @@
8181
tags: [cloud]
8282
roles:
8383
- nextcloud-docker
84+
85+
- name: Routers
86+
hosts: routers
87+
tags: [routers]
88+
roles:
89+
- edgerouter

0 commit comments

Comments
 (0)