Files
ansible_proxmox_WOL/templates/wol-interfaces.service.j2

19 lines
555 B
Plaintext
Raw Normal View History

[Unit]
Description=Set Wake-on-LAN on network interfaces
After=network.target
Wants=network.target
[Service]
Type=oneshot
ExecStart=/bin/bash -c '{% set cmds = [] %}
{% for intf, enabled, supported in en_interfaces | zip(wol_enabled.results, wol_supported.results) %}
{% if wol_mode in supported.stdout and wol_mode not in enabled.stdout %}
{% set _ = cmds.append("/sbin/ethtool -s " ~ intf ~ " wol " ~ wol_mode) %}
{% endif %}
{% endfor %}
{{ cmds | join("; ") if cmds | length > 0 else ":" }}'
RemainAfterExit=yes
[Install]
WantedBy=multi-user.target