netz39-infra-ansible/host-vyos.yml

78 lines
2.4 KiB
YAML

---
- hosts: vyos.n39.eu
become: true
vars:
ansible_python_interpreter: /usr/bin/python3
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: 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.1
ipv4:
- 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: eth0.71
ipv4:
- address: 192.168.100.3/24
- 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.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
- name: And a DNS forwarder
vyos.vyos.vyos_config:
lines:
- 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:
- name: restart
vyos.vyos.command:
commands:
- restart