feat ✨: Add support for starting tcpdump with 'become: true' in wakeonlan module
Some checks failed
ansible-lint / Ansible Lint (push) Failing after 9s
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:
@@ -117,14 +117,15 @@
|
|||||||
|
|
||||||
|
|
||||||
- name: Start tcpdump to capture WOL packet
|
- name: Start tcpdump to capture WOL packet
|
||||||
|
become: true
|
||||||
ansible.builtin.shell: |
|
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
|
register: tcpdump_result
|
||||||
async: 12
|
async: 12
|
||||||
poll: 0
|
poll: 0
|
||||||
|
|
||||||
- name: Send Wake-on-LAN packet from localhost
|
- name: Send Wake-on-LAN packet from localhost
|
||||||
ansible.builtin.wakeonlan:
|
community.general.wakeonlan:
|
||||||
mac: "{{ wol_mac_addresses[0] }}"
|
mac: "{{ wol_mac_addresses[0] }}"
|
||||||
port: "{{ wol_port }}"
|
port: "{{ wol_port }}"
|
||||||
broadcast: 255.255.255.255
|
broadcast: 255.255.255.255
|
||||||
|
|||||||
Reference in New Issue
Block a user