skylab
/
skylab-ansible
Archived
2
0
Fork 0
This repository has been archived on 2023-05-19. You can view files and clone it, but cannot push or open issues or pull requests.
skylab-ansible/skylab/core/roles/server/templates/network.j2

33 lines
888 B
Django/Jinja

# ANSIBLE MANAGED FILE - DO NOT EDIT
#
[Match]
Name={{ item.key }}
[Network]
DHCP={{ "Yes" if item.value.dhcp | default(false) else "No" }}
IPv6AcceptRA=No
{% if item.value.dns is defined %}
{% for server in item.value.dns %}
DNS={{ server }}
{% endfor %}
{% endif %}
{% if item.value.bond is defined %}
Bond={{ item.value.bond }}
{% endif %}
{% if not item.value.dhcp | default(false) %}
{% if item.value.gateway is defined %}
Gateway={{ item.value.gateway | ansible.netcommon.ipaddr('address') }}
{% endif %}
{% for address in item.value.addresses | default([]) %}
Address={{ address | ansible.netcommon.ipaddr('host/prefix') }}
{% endfor %}
{% endif %}
{% for interface in skylab_networking.keys() %}
{% if interface.startswith(item.key) and interface.partition('.')[2] | regex_search('^[0-9]{1,4}$') and interface != item.key %}
VLAN={{ interface }}
{% endif %}
{% endfor %}
# EOF