diff --git a/network/ifupdown2.sls b/network/ifupdown2.sls new file mode 100644 index 0000000000000000000000000000000000000000..3306cd3de3b06e96d1b39ca514b3ab94c03ef61c --- /dev/null +++ b/network/ifupdown2.sls @@ -0,0 +1,21 @@ +# +## Networking via ifupdown2 +# + +ifupdown2: + pkg.installed + +# ifupdown2 configuration +/etc/network/ifupdown2/ifupdown2.conf: + file.managed: + - source: salt://network/files/ifupdown2.conf + - require: + - pkg: ifupdown2 + + +# Reload interface configuration if neccessary +ifreload: + cmd.wait: + - name: /sbin/ifreload -af + - require: + - file: /etc/network/ifupdown2/ifupdown2.conf diff --git a/network/init.sls b/network/init.sls index e35a771264313f72fca4711dab00c95cca5d6f8a..1e3f960fdbd9a355942ac05f03cdf45d2d22d5c2 100644 --- a/network/init.sls +++ b/network/init.sls @@ -1,11 +1,10 @@ # -## Networking +## Networking genertic # -iproute2: - pkg.installed +{% set network_cfg_daemon = salt['pillar.get']('network_cfg_daemon', "ifupdown2") %} -ifupdown2: +iproute2: pkg.installed network-pkg: @@ -18,17 +17,10 @@ network-pkg: - knot-host - ipv6calc -# ifupdown2 configuration -/etc/network/ifupdown2/ifupdown2.conf: - file.managed: - - source: salt://network/files/ifupdown2.conf - - require: - - pkg: ifupdown2 - -# Reload interface configuration if neccessary -ifreload: - cmd.wait: - - name: /sbin/ifreload -af - - require: - - file: /etc/network/ifupdown2/ifupdown2.conf +include: +{%- if network_cfg_daemon == 'ifupdown2' %} + - network.ifupdown2 +{%- elif network_cfg_daemon == 'systemd' %} + - network.systemd +{%- endif %} diff --git a/network/systemd.sls b/network/systemd.sls new file mode 100644 index 0000000000000000000000000000000000000000..82b58716d55b027838e2872254c1cced74fa38a1 --- /dev/null +++ b/network/systemd.sls @@ -0,0 +1,16 @@ +# +## Networking via systemd-networkd +# + +include: + - systemd + +ifupdown2: + pkg.purged + +/etc/network/ifupdown2: + file.absent + +systemd-networkd.service: + service.running: + - enable: true