Add networkd configuration to server role
Update inventory with necessary networking settings
This commit is contained in:
18
roles/server/templates/netdev.j2
Normal file
18
roles/server/templates/netdev.j2
Normal file
@@ -0,0 +1,18 @@
|
||||
# ANSIBLE MANAGED FILE - DO NOT MANUALLY EDIT
|
||||
#
|
||||
[NetDev]
|
||||
Name={{ item.key }}
|
||||
type={{ item.value.type }}
|
||||
|
||||
{% if item.value.type.lower() == 'bond' %}
|
||||
[Bond]
|
||||
Mode={{ item.value.bond_mode | default('balance-rr') }}
|
||||
PrimaryReselectPolicy=always
|
||||
MIIMonitorSec=1s
|
||||
{% endif %}
|
||||
{% if item.value.type.lower() == 'vlan' %}
|
||||
[VLAN]
|
||||
Id={{ item.key.partition('.')[2] }}
|
||||
{% endif %}
|
||||
|
||||
# EOF
|
32
roles/server/templates/network.j2
Normal file
32
roles/server/templates/network.j2
Normal file
@@ -0,0 +1,32 @@
|
||||
# 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 item.value.dhcp | default(false) %}
|
||||
Gateway={{ item.value.gateway | ansible.netcommon.ipaddr('address') }}
|
||||
{% for address in item.value.addresses %}
|
||||
Address={{ address | ansible.netcommon.ipaddr('host/prefix') }}
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
|
||||
|
||||
{% for interface in skylab_networking.interfaces.keys() %}
|
||||
{% if interface.startswith(item.key) and interface.partition('.')[2] | number %}
|
||||
VLAN={{ interface }}
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
|
||||
# EOF
|
Reference in New Issue
Block a user