netz39-infra-ansible/host-vyos.yml

79 lines
2.4 KiB
YAML
Raw Normal View History

2024-01-19 19:20:52 +01:00
---
- hosts: vyos.n39.eu
become: true
vars:
ansible_python_interpreter: /usr/bin/python3
roles:
tasks:
2024-01-20 17:21:45 +01:00
- name: Configure a DHCP Server
vyos.vyos.vyos_config:
lines:
- set system option keyboard-layout 'de'
2024-01-19 19:20:52 +01:00
- name: Replace provided configuration with device configuration
vyos.vyos.vyos_interfaces:
config:
- name: eth0
2024-01-20 17:21:45 +01:00
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
2024-01-19 19:20:52 +01:00
state: replaced
- name: Merge provided configuration with device configuration
vyos.vyos.vyos_l3_interfaces:
config:
2024-01-20 17:21:45 +01:00
- name: eth0.1
ipv4:
- address: 172.23.63.2/24
- name: eth0.4
2024-01-19 19:20:52 +01:00
ipv4:
2024-01-20 17:21:45 +01:00
- address: 172.23.48.4/22
- name: eth0.9
2024-01-19 19:20:52 +01:00
ipv4:
- address: 172.23.52.2/22
2024-01-20 17:21:45 +01:00
- name: eth0.71
2024-01-19 19:20:52 +01:00
ipv4:
- address: 192.168.100.3/24
2024-01-20 17:21:45 +01:00
- name: eth0.100
2024-01-19 19:20:52 +01:00
ipv4:
- address: 192.168.39.1/24
2024-01-20 17:21:45 +01:00
state: replaced
2024-01-19 19:20:52 +01:00
- name: Configure a DHCP Server
vyos.vyos.vyos_config:
lines:
2024-01-20 17:21:45 +01:00
- 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'
2024-01-19 19:20:52 +01:00
- 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
- name: And a DNS forwarder
vyos.vyos.vyos_config:
lines:
2024-01-20 17:21:45 +01:00
- 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
2024-01-19 19:20:52 +01:00
save: yes
handlers:
- name: restart
vyos.vyos.command:
commands:
- restart