{% set ifupdown__tpl_systemd_version = (ifupdown__register_systemd_version.stdout|d('215')) + '.0' %}
# {{ ansible_managed }}

[Unit]
Description=Bring network interface up for %i
Documentation=man:interfaces(5) man:ifup(8)
Documentation=https://bugs.debian.org/765000
Documentation=https://bugs.debian.org/819314
After=local-fs.target network-pre.target networking.service systemd-sysctl.service
Before=network.target shutdown.target network-online.target
Conflicts=shutdown.target
BindsTo=sys-subsystem-net-devices-%i.device
ConditionPathIsDirectory=/run/network
DefaultDependencies=no
IgnoreOnIsolate=yes

[Service]
{# https://bugs.debian.org/761909 #}
{% if ansible_service_mgr == 'systemd' and ifupdown__tpl_systemd_version is version_compare('228.0', '>=') %}
# avoid stopping on shutdown via stopping system-iface.slice
Slice=system.slice
{% endif %}
ExecStart=/bin/sh -ec 'ifup --allow=boot %i; ifquery --state %i'
ExecStop=/sbin/ifdown %i
RemainAfterExit=true
TimeoutStartSec=5min
