#jinja2:lstrip_blocks: True
---
network:
  renderer: networkd
  ethernets:
    {{ network_name }}:
      accept-ra: false
    {% if networks[0].dhcp4 == false %}
      addresses:
        - {{ networks[0].address }}/{{ net_mask | ansible.utils.ipaddr('prefix') }}
      routes:
        - to: {{ networks[0].route }}
          via: {{ networks[0].gateway }}
    {% endif %}
      dhcp-identifier: mac
      dhcp4: {{ networks[0].dhcp4 }}
      dhcp6: {{ networks[0].dhcp6 }}
      match:
        macaddress: {{ macaddress }}
      nameservers:
        addresses:
          - {{ networks[0].dns[0]['nameserver'] }}
          - {{ networks[0].dns[1]['nameserver'] }}
      set-name: {{ network_name }}
  version: 2