41 lines
934 B
YAML
Raw Normal View History

2024-11-26 19:37:53 +01:00
- name: Install ethtool
ansible.builtin.apt:
name: ethtool
state: present
2024-12-10 13:19:35 +01:00
become: true
2024-11-26 19:37:53 +01:00
- name: Display all interfaces name
debug:
var: ansible_facts.interfaces
- name: Get wifi adapter
set_fact:
2024-12-11 23:10:40 +01:00
active_adapter: '{{ item }}'
2024-11-26 19:37:53 +01:00
loop: '{{ ansible_facts.interfaces }}'
when: 'item.startswith("eno")'
2024-12-11 23:10:40 +01:00
- name: Display all interfaces name
debug:
msg: "{{ ansible_default_ipv4.interface }}"
2024-11-26 19:37:53 +01:00
- name: Creating config
become: true
ansible.builtin.copy:
dest: "/etc/systemd/system/wol.service"
content: |
[Unit]
Description=Enable Wake On Lan
[Service]
Type=oneshot
2024-12-11 23:10:40 +01:00
ExecStart = /usr/sbin/ethtool --change {{ ansible_default_ipv4.interface }} wol g
2024-11-26 19:37:53 +01:00
[Install]
WantedBy=basic.target
owner: root
mode: '0744'
- name: Restart service wol, in all cases
ansible.builtin.service:
name: wol
state: restarted
enabled: true
become: true