Adding self installation command for fabrica

This commit is contained in:
2021-03-23 10:47:39 +01:00
parent 740a8de4a2
commit b360760855
120 changed files with 301 additions and 164 deletions

View File

@ -0,0 +1,18 @@
<?xml version="1.0" encoding="utf-8"?>
<creole>
<files>
</files>
<containers>
</containers>
<variables>
<family name='Interface-0'>
<variable name='eth0_method' redefine='True' hidden='False'>
<value>statique</value>
</variable>
</family>
</variables>
<constraints>
</constraints>
<help>
</help>
</creole>

View File

@ -0,0 +1,77 @@
%set bonds = []
%set vlans = []
network:
version: 2
renderer: networkd
ethernets:
%for %%interface in range(0, %%int(%%nombre_interfaces)):
%set current_interface = 'eth' + str(%%interface)
%set interface_mode = %%getVar(%%current_interface + '_method')
%if %%getVar('activer_bonding_' + %%current_interface, "non") == 'non'
%%getVar('nom_zone_'+ %%current_interface):
%if %%interface_mode == 'statique' and %%getVar("adresse_ip_" + %%current_interface):
addresses:
- %%getVar("adresse_ip_" + %%current_interface)/%%calc_classe(%%getVar('adresse_netmask_' + %%current_interface))
%if %%getVar('alias_' + %%current_interface, "non") == "oui"
%for alias in %%getVar('alias_ip_' + %%current_interface)
- %%alias/%%calc_classe(getattr(alias, 'alias_netmask_' + %%current_interface))
%end for
%end if
%if %%interface_gw == %%getVar('nom_zone_' + %%current_interface):
gateway4: %%adresse_ip_gw
%end if
%if %%getVar('activer_ipv6') == "non"
dhcp6: no
accept-ra: no
optional-addresses: [ dhcp6 ]
%end if
%elif %%interface_mode == 'dhcp'
dhcp4: yes
%else
dhcp4: no
%end if
%else
%%bonds.append(%%current_interface)
%for %%slave in %%getVar('nom_carte_' + %%current_interface):
%%slave:
optional: false
%end for
%end if
%if %%getVar('vlan_' + %%current_interface, 'non') == 'oui'
%%vlans.append(%%current_interface)
%end if
%end for
%if len(%%bonds) > 0:
bonds:
%for bond in %%bonds:
%set %%bond_mode = %%getVar(%%bond + '_method')
%%getVar('nom_zone_' + %%bond):
interfaces: [%%custom_join(%%getVar('nom_carte_' + %%bond),',')]
%if %%bond_mode == 'statique'
addresses: [ %%getVar("adresse_ip_" + %%bond)/%%calc_classe(%%getVar('adresse_netmask_' + %%bond))]
%elif %%bond_mode == 'dhcp'
dhcp4: yes
%else
dhcp4: no
%end if
parameters:
mode: %%getVar('bonding_mode_' + %%bond)
mii-monitor-interval: %%getVar('bonding_miimon_' + %%bond)
up-delay: %%getVar('bonding_updelay_' + %%bond)
down-delay: %%getVar('bonding_downdelay_' + %%bond)
%end for
%end if
%if len(vlans) > 0:
vlans:
%for vlan in %%vlans:
%for vlan_id in %%getVar('vlan_id_' + %%vlan):
vlan%%vlan_id:
id: %%vlan_id
link: %%getVar('nom_zone_' + %%vlan)
addresses: [ %%getattr(vlan_id, 'vlan_ip_' + %%vlan)/%%calc_classe(%%getattr(vlan_id, 'vlan_netmask_' + %%vlan)) ]
%end for
%end for
%end if

View File

@ -0,0 +1,11 @@
# This file describes the network interfaces available on your system
# For more information, see netplan(5).
network:
version: 2
renderer: networkd
ethernets:
ens3:
dhcp4: yes
dhcp6: no
accept-ra: no
optional-addresses: [ dhcp6 ]