feat ✨: Enable Wake-on-LAN persistently
This commit introduces persistent Wake-on-LAN support for Proxmox VE via Ansible. It includes YAML configuration options for the interface, verification, and systemd service management, ensuring reliable functionality after Ansible role execution. The changes also address ignoring outputs and temporary files for a cleaner setup.
This commit is contained in:
32
tasks/main.yml
Normal file
32
tasks/main.yml
Normal file
@@ -0,0 +1,32 @@
|
||||
---
|
||||
- name: Install required packages
|
||||
apt:
|
||||
name: ethtool
|
||||
state: present
|
||||
update_cache: yes
|
||||
|
||||
- name: Create systemd service for Wake-on-LAN
|
||||
template:
|
||||
src: wol.service.j2
|
||||
dest: /etc/systemd/system/wol.service
|
||||
owner: root
|
||||
group: root
|
||||
mode: '0644'
|
||||
notify:
|
||||
- Reload systemd
|
||||
- Enable and start WOL service
|
||||
|
||||
- name: Enable WOL immediately (without reboot)
|
||||
command: ethtool -s {{ wol_interface }} wol {{ wol_mode }}
|
||||
changed_when: false
|
||||
|
||||
- name: Verify Wake-on-LAN status
|
||||
command: ethtool {{ wol_interface }}
|
||||
register: wol_status
|
||||
changed_when: false
|
||||
when: wol_verify
|
||||
|
||||
- name: Show WOL status
|
||||
debug:
|
||||
msg: "{{ wol_status.stdout_lines }}"
|
||||
when: wol_verify
|
||||
Reference in New Issue
Block a user