add network

This commit is contained in:
ace
2021-10-27 00:34:13 +03:00
commit 3ef3e332ab
14 changed files with 248 additions and 0 deletions

View File

@ -0,0 +1,27 @@
DEVICE="{{ item.name }}"
USERCTL="{{ item.userctl | default('no') }}"
NM_CONTROLLED="{{ item.nm_controlled | default('no') }}"
{% if ite.bootproto is defined %}
BOOTPROTO="{{ item.bootproto }}"
{% endif %}
ONBOOT="{{ item.onboot | default('yes') }}"
{% if item.mtu is defined %}
MTU="{{ item.mtu }}"
{% endif %}
{% if item.slave is defined %}
MASTER="{{ item.master }}"
SLAVE="yes"
{% endif %}
{% if item.gateway is defined %}
GATEWAY="{{ item.gateway }}"
{% endif %}
{% for network in item.ip %}
{% if network.ipaddr is defined %}
IPADDR{{ loop.index }}="{{ network.ipaddr }}"
{% endif %}
{% if network.netmask is defined %}
NETMASK{{ loop.index }}="{{ network.netmask }}"
{% elif network.prefix is defined %}
PREFIX{{ loop.index }}="{{ network.prefix }}"
{% endif %}
{% endfor %}

View File

@ -0,0 +1,17 @@
DEVICE=lo
IPADDR=127.0.0.1
NETMASK=255.0.0.0
NETWORK=127.0.0.0
# If you're having problems with gated making 127.0.0.0/8 a martian,
# you can change this to something else (255.255.255.255, for example)
BROADCAST=127.255.255.255
{% for network in item.ip %}
IPADDR{{ loop.index }}={{ network.ipaddr }}
{% if network.netmask is defined %}
NETMASK{{ loop.index }}={{ network.netmask }}
{% elif network.prefix is defined %}
PREFIX{{ loop.index }}={{ network.prefix }}
{% endif %}
{% endfor %}
ONBOOT=yes
NAME=loopback

3
templates/route.j2 Normal file
View File

@ -0,0 +1,3 @@
{% for route in item.route %}
{{ route }}
{% endfor %}

14
templates/rt_tables.j2 Normal file
View File

@ -0,0 +1,14 @@
#
# reserved values
#
255 local
254 main
253 default
0 unspec
#
# local
#
#1 inr.ruhep
{% for table in network.network_scripts.pbr.table %}
{{ table.number }} {{ table.name }}
{% endfor %}

3
templates/rule.j2 Normal file
View File

@ -0,0 +1,3 @@
{% for rule in item.rule %}
{{ rule }}
{% endfor %}