Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions group_vars/routers/all.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
---
edgerouter_dhcp_networks:
- name: cycledhcp
subnet: 10.20.0.0/16
static-hosts:
- hostname: earl.noise
ipaddress: 10.20.0.10
mac-address: b8:27:eb:0c:c6:e9
- hostname: enter-ap.noise
ipaddress: 10.20.0.13
mac-address: 80:2a:a8:c0:f7:44
5 changes: 5 additions & 0 deletions hosts.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,11 @@ all:
cloud:
hosts:
cloud.noise: {}
routers:
hosts:
# EdgeRouter ER-4
cycletrailer.noisebridge.net:
ansible_network_os: edgeos

# Aliases (production)
noisebridge-net:
Expand Down
6 changes: 6 additions & 0 deletions roles/edgerouter/defaults/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
edgerouter_dhcp_subnets:
internal:
subnet: 192.168.0.0/24

edgerouter_static_hosts: {}
18 changes: 18 additions & 0 deletions roles/edgerouter/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
---
- name: Create DHCP network
edgeos_config:
lines:
- "set system dhcp-server shared-network-name {{ item.name }} subnet {{ item.subnet }}"
connection: network_cli
with_items: "{{ edgerouter_dhcp_networks }}"

- name: Add static hosts
edgeos_config:
lines:
- "set system static-host-mapping host-name {{ item.1.hostname }} inet {{ item.1.ipaddress }}"
- "set service dhcp-server shared-network-name {{ item.0.name }} subnet {{ item.0.subnet }} static-mapping {{ item.1.hostname }} ip-address {{ item.1.ipaddress }}"
- "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 }}'"
connection: network_cli
with_subelements:
- "{{ edgerouter_dhcp_networks }}"
- static-hosts
8 changes: 7 additions & 1 deletion site.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---

- name: node defaults
hosts: all
hosts: all:!routers
become: yes
become_method: sudo
tags: [common]
Expand Down Expand Up @@ -82,3 +82,9 @@
tags: [cloud]
roles:
- nextcloud-docker

- name: Routers
hosts: routers
tags: [routers]
roles:
- edgerouter