Some checks failed
ansible-lint / Ansible Lint (push) Failing after 9s
This refactoring involves restructuring the `ExecStart` method to utilize a list of commands instead of a single string. This change allows for more flexible execution based on certain conditions, enhancing the modularity and maintainability of the code.
19 lines
555 B
Django/Jinja
19 lines
555 B
Django/Jinja
[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
|