2023-09-18 16:18:30 +02:00
|
|
|
- hosts: omv
|
2023-09-18 16:16:59 +02:00
|
|
|
name: Enable WOL
|
2023-09-18 17:07:10 +02:00
|
|
|
become: true
|
2023-09-18 16:16:59 +02:00
|
|
|
tasks:
|
2023-09-18 17:10:34 +02:00
|
|
|
- name: Display all interfaces name
|
|
|
|
debug:
|
2023-09-18 17:12:38 +02:00
|
|
|
var: "{{ ansible_interfaces | select('match','ens.*') | list | first }}"
|
2023-09-18 16:16:59 +02:00
|
|
|
- name: Creating config
|
2023-09-18 17:08:42 +02:00
|
|
|
become: yes
|
2023-09-18 16:16:59 +02:00
|
|
|
ansible.builtin.copy:
|
2023-09-18 17:08:42 +02:00
|
|
|
|
2023-09-18 16:16:59 +02:00
|
|
|
dest: "/etc/systemd/system/wol.service"
|
|
|
|
content: |
|
|
|
|
[Unit]
|
|
|
|
Description=Enable Wake On Lan
|
|
|
|
|
|
|
|
[Service]
|
|
|
|
Type=oneshot
|
2023-09-18 17:10:34 +02:00
|
|
|
ExecStart = /usr/sbin/ethtool --change enp2s0 wol g
|
2023-09-18 16:16:59 +02:00
|
|
|
|
|
|
|
[Install]
|
|
|
|
WantedBy=basic.target
|
|
|
|
owner: root
|
|
|
|
mode: '0744'
|