netz39-infra-ansible/host-vyos.yml
2024-01-19 19:20:52 +01:00

61 lines
1.8 KiB
YAML

---
- hosts: vyos.n39.eu
become: true
vars:
ansible_python_interpreter: /usr/bin/python3
roles:
tasks:
- 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
state: replaced
- name: Merge provided configuration with device configuration
vyos.vyos.vyos_l3_interfaces:
config:
- name: eth0
ipv4:
- address: 172.23.48.2/22
- name: eth2
ipv4:
- address: 172.23.52.2/22
- name: eth3
ipv4:
- address: 192.168.100.3/24
- name: eth4
ipv4:
- address: 192.168.39.1/24
- 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 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:
- set system static-host-mapping host-name
save: yes
handlers:
- name: restart
vyos.vyos.command:
commands:
- restart