{% macro iscsi(name, hostname, path='/etc/iscsi') %}
mkdir /etc/iscsi
chmod 0755:/etc/iscsi
write /etc/iscsi/initiatorname.iscsi:InitiatorName={{ name }}:{{ hostname }}
{% endmacro %}

{% macro network_devices_el(mappings) %}
mkdir /etc/sysconfig/network-scripts
chmod 0755:/etc/sysconfig/network-scripts
{% filter dedent %}
{% for iface, mac in mappings.viewitems() %}
	write /etc/sysconfig/network-scripts/ifcfg-{{ iface }}:HWADDR="{{ mac }}" \
	BOOTPROTO="dhcp" \
	ONBOOT="yes" \
	TYPE="Ethernet" \
	NAME="{{ iface }}" \

{% endfor %}
{% endfilter %}
{% endmacro %}

{% macro network_devices_debian(mappings) %}
mkdir /etc/network/interfaces.d
chmod 0755:/etc/network/interfaces.d

write /etc/network/interfaces:auto lo \
iface lo inet loopback \
source /etc/network/interfaces.d/*.cfg \

{% filter dedent %}
{% for iface, mac in mappings.viewitems() %}
    write /etc/network/interfaces.d/ifcfg-{{ iface }}.cfg:auto {{ iface }} \
    iface {{ iface }} inet6 auto \
    iface {{ iface }} inet dhcp \
        hwaddress ether {{ mac }} \

{% endfor %}
{% endfilter %}
{% endmacro %}
