mirror of
https://gitlab.sectorq.eu/jaydee/ansible.git
synced 2025-01-23 20:39:26 +00:00
36 lines
806 B
YAML
36 lines
806 B
YAML
|
- name: Install ethtool
|
||
|
ansible.builtin.apt:
|
||
|
name: ethtool
|
||
|
state: present
|
||
|
- name: Display all interfaces name
|
||
|
debug:
|
||
|
var: ansible_facts.interfaces
|
||
|
- name: Get wifi adapter
|
||
|
set_fact:
|
||
|
wifi_adapter: '{{ item }}'
|
||
|
loop: '{{ ansible_facts.interfaces }}'
|
||
|
when: 'item.startswith("eno")'
|
||
|
|
||
|
- name: Creating config
|
||
|
become: true
|
||
|
ansible.builtin.copy:
|
||
|
|
||
|
dest: "/etc/systemd/system/wol.service"
|
||
|
content: |
|
||
|
[Unit]
|
||
|
Description=Enable Wake On Lan
|
||
|
|
||
|
[Service]
|
||
|
Type=oneshot
|
||
|
ExecStart = /usr/sbin/ethtool --change {{ wifi_adapter }} wol g
|
||
|
|
||
|
[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
|