feat : Add support for starting tcpdump with 'become: true' in wakeonlan module
Some checks failed
ansible-lint / Ansible Lint (push) Failing after 9s

This commit introduces the functionality to start tcpdump using elevated privileges by setting 'become: true' in the wakeonlan module. This enhancement ensures that tcpdump can capture network traffic even when run as a non-root user.
This commit is contained in:
2026-01-25 08:23:32 +01:00
parent a0db41cb81
commit 21ec247569

View File

@@ -117,14 +117,15 @@
- name: Start tcpdump to capture WOL packet
become: true
ansible.builtin.shell: |
timeout 10 tcpdump -i {{ en_interfaces[0] }} -nn -c 1 udp port {{ wol_port }}
tcpdump -i {{ en_interfaces[0] }} -nn -c 1 udp port {{ wol_port }}
register: tcpdump_result
async: 12
poll: 0
- name: Send Wake-on-LAN packet from localhost
ansible.builtin.wakeonlan:
community.general.wakeonlan:
mac: "{{ wol_mac_addresses[0] }}"
port: "{{ wol_port }}"
broadcast: 255.255.255.255