configpolicy/roles/rhel-network/templates/ifcfg.j2

60 lines
1.3 KiB
Django/Jinja

{#- vim: set ft=jinja : -#}
DEVICE="{{ item.ifname }}"
{% if item.enabled %}
ONBOOT="yes"
{% else %}
ONBOOT="no"
{% endif %}
{% if item.mode == "auto" %}
BOOTPROTO="dhcp"
{% elif item.mode == "manual" %}
BOOTPROTO="none"
IPADDR="{{ item.addr }}"
{% if item.mask is defined %}
NETMASK="{{ item.mask }}"
{% else %}
PREFIX={{ item.prefix|d(24) }}
{% endif %}
{% if item.gateway is defined %}
GATEWAY="{{ item.gateway }}"
{% endif %}
{% for dns in item.dns|d(()) %}
DNS{{ loop.index }}="{{ dns }}"
{% endfor %}
{% if item.addr6 is defined %}
IPV6ADDR="{{ item.addr6 }}"
{% endif %}
{% else %}
BOOTPROTO="none"
{% endif %}
{% if item.dhcpv6 is defined %}
{% if item.dhcpv6.enabled|d(True) %}
DHCPV6C="yes"
{% if item.dhcpv6.stateless|d(False) %}
DHCPV6C_OPTIONS="-S"
{% elif item.dhcpv6.temporary|d(False) %}
DHCPV6C_OPTIONS="-T"
{% elif item.dhcpv6.pd|d(False) %}
DHCPV6C_OPTIONS="-P"
{% endif %}
{% endif %}
{% endif %}
{% if item.master|d %}
SLAVE=yes
MASTER={{ item.master }}
{% endif %}
{% if item.bond_opts|d %}
BONDING_OPTS="{% for key, value in default_bond_opts|combine(item.bond_opts)|dictsort %}{{ key }}={{ value }}{% if not loop.last %} {% endif %}{% endfor %}"
{% endif %}
{% if item.vlan_id|d %}
VLAN=yes
VID={{ item.vlan_id }}
{% if item.physdev|d %}
PHYSDEV={{ item.physdev }}
{% endif %}
{% endif %}