vm-ansible/roles/netplan/templates/netplan.yaml
Torma Kristóf c269796d99
Some checks reported errors
continuous-integration/drone/push Build was killed
Update roles/netplan/templates/netplan.yaml
2024-03-30 14:20:34 +01:00

42 lines
1.2 KiB
YAML

# {{ansible_managed}}
network:
version: 2
renderer: networkd
ethernets:
{{ ansible_default_ipv4.interface }}:
dhcp4: true
dhcp-identifier: mac
{% if netplan.default_gateway is defined and netplan.default_gateway|length > 0 %}
dhcp4-overrides:
use-routes: false
gateway4: {{netplan.default_gateway}}
{% endif %}
{% if netplan.additionalinterfaces is defined and netplan.additionalinterfaces|length > 0 %}
{% for interface in netplan.additionalinterfaces %}
{{ interface.name }}:
dhcp4: {{ interface.dhcp4 }}
dhcp6: {{ interface.dhcp6 }}
dhcp-identifier: mac
dhcp4-overrides:
use-routes: false
{% if interface.addresses is defined and interface.addresses|length > 0 %}
addresses:
{% for address in interface.addresses %}
- {{address}}
{% endfor %}
{% endif %}
{% if interface.gateway4 is defined and interface.gateway4|length > 0 %}
gateway4: {{interface.gateway4}}
{% endif %}
{% if interface.gateway6 is defined and interface.gateway6|length > 0 %}
gateway6: '{{interface.gateway6}}'
{% endif %}
{% if interface.denydns %}
nameservers:
addresses: []
search: []
{% endif %}
{% endfor %}
{% endif %}
...