From a12729ba3b6863535cd6e6db14464af8cf4b52d9 Mon Sep 17 00:00:00 2001 From: David Kilias Date: Sat, 20 Jan 2024 17:21:45 +0100 Subject: [PATCH] feat: add dns_dhcp for vyos --- host-vyos.yml | 51 ++++++++++++++++++++---------- host_vars/vyos.n39.eu/dns-dhcp.yml | 44 ++++++++++++++++++++++++++ 2 files changed, 78 insertions(+), 17 deletions(-) create mode 100644 host_vars/vyos.n39.eu/dns-dhcp.yml diff --git a/host-vyos.yml b/host-vyos.yml index 4b0cf86..6429c07 100644 --- a/host-vyos.yml +++ b/host-vyos.yml @@ -8,42 +8,58 @@ roles: tasks: + + - name: Configure a DHCP Server + vyos.vyos.vyos_config: + lines: + - set system option keyboard-layout 'de' + - name: Replace provided configuration with device configuration vyos.vyos.vyos_interfaces: config: - name: eth0 - description: VLAN04 - Client Netz - - name: eth1 - description: VLAN07 - Telekom Modem - - name: eth2 - description: VLAN09 - DMZ - - name: eth3 - description: VLAN71 - Telekom Status - - name: eth4 - description: VLAN100 - RAW Internet + description: Trunk + vifs: + - vlan_id: 1 + description: VIF 1 - mgmt + - vlan_id: 4 + description: VIF 4 - user + - vlan_id: 7 + description: VIF 7 - telekom pppoe + - vlan_id: 9 + description: VIF 9 - dmz + - vlan_id: 71 + description: VIF 71 - telekom status + - vlan_id: 100 + description: VIF 100 - RAW Internet state: replaced - name: Merge provided configuration with device configuration vyos.vyos.vyos_l3_interfaces: config: - - name: eth0 + - name: eth0.1 ipv4: - - address: 172.23.48.2/22 - - name: eth2 + - address: 172.23.63.2/24 + - name: eth0.4 + ipv4: + - address: 172.23.48.4/22 + - name: eth0.9 ipv4: - address: 172.23.52.2/22 - - name: eth3 + - name: eth0.71 ipv4: - address: 192.168.100.3/24 - - name: eth4 + - name: eth0.100 ipv4: - address: 192.168.39.1/24 + state: replaced - name: Configure a DHCP Server vyos.vyos.vyos_config: lines: - - set service dhcp-server disabled 'false' - - set service dhcp-server shared-network-name Client subnet 172.23.48.0/22 default-router '172.23.48.2' start '172.23.48.150' stop '172.23.51.250' + - set service dhcp-server disabled 'false' + - set service dhcp-server shared-network-name Client subnet 172.23.63.0/24 default-router '172.23.63.2' + - set service dhcp-server shared-network-name Client subnet 172.23.48.0/22 default-router '172.23.48.4' start '172.23.48.150' stop '172.23.51.250' - set service dhcp-server shared-network-name Client subnet 172.23.52.0/22 default-router '172.23.52.2' start '172.23.53.0' stop '172.23.53.255' - set service dhcp-server shared-network-name Client subnet 192.168.39.0/24 default-router '192.168.39.1' save: yes @@ -51,7 +67,8 @@ - name: And a DNS forwarder vyos.vyos.vyos_config: lines: - - set system static-host-mapping host-name + - set system static-host-mapping host-name ipv6.host.domain.loc inet xxxx:xxxx:xxxx:xxxx::x + - set system static-host-mapping host-name ipv6.host.domain.loc alias host.domain.loc save: yes handlers: diff --git a/host_vars/vyos.n39.eu/dns-dhcp.yml b/host_vars/vyos.n39.eu/dns-dhcp.yml new file mode 100644 index 0000000..46d4184 --- /dev/null +++ b/host_vars/vyos.n39.eu/dns-dhcp.yml @@ -0,0 +1,44 @@ +entries: +- hostname: sw-1 + mac: 00:0f:cb:ed:5e:e0 + address: 172.23.63.34 + # aliases: + # - name: +- hostname: sw-4 + mac: 00:1e:8c:74:79:62 + address: 172.23.63.35 + aliases: + - name: gx-2124x.n39.eu +- hostname: beaker-mgmt + mac: 00:19:99:ec:07:5d + address: 172.23.63.43 +- hostname: sw-2.n39.eu + mac: 10:0d:7f:4a:c0:21 + address: 172.23.63.94 + aliases: + - name: gs108tv2-1.n39.eu +- hostname: sw-3.n39.eu + mac: 20:0c:c8:4e:2c:56 + address: 172.23.63.104 + aliases: + - name: gs105pe-1.n39.eu +- hostname: pottwal.n39.eu + mac: 52:82:de:fc:1e:94 + address: 172.23.52.44 + aliases: + - name: apt-proxy.n39.eu + - name: label.n39.eu + - name: syslog.n39.eu + - name: pad.n39.eu + - name: git.n39.eu + - name: uritools.n39.eu + - name: uritools-api.n39.eu + - name: uptime.n39.eu + - name: redmine.n39.eu + - name: influx.n39.eu + - name: jabber.n39.eu + - name: conference.jabber.n39.eu + - name: grafana.n39.eu + - name: inventory.n39.eu + - name: sl.n39.eu + - name: spaceapi.n39.eu \ No newline at end of file