Skip to content

Instantly share code, notes, and snippets.

(ENV)> ansible-playbook parallel-tcpdump.yml -i hosts
- name: remove files from server
file: path=/tmp/${cap_file}.gz state=absent
- name: compress capture file
command: gzip ${cap_file} chdir=/tmp
- name: copy logs to local boxes webroot
fetch: src=/tmp/${cap_file}.gz dest=/var/www/ flat=yes
- name: kill tcpdump
command: /usr/bin/pkill tcpdump
ignore_errors: yes
- pause: minutes=1 prompt="pause for 60 seconds or press Ctrl + c then c to continue"
tasks:
- name: start tcpdump
command: /usr/sbin/tcpdump -i eth0 -s 0 -w /tmp/${cap_file}
async: 60
poll: 0
- hosts: all
sudo: yes
vars:
cap_file: packet_capture_{{ ansible_hostname }}_{{ ansible_date_time['epoch'] }}.cap
^CTraceback (most recent call last):
File "fork.py", line 11, in
time.sleep(1)
KeyboardInterrupt
> ps -ef | grep 26556
lex 26556 26555 0 21:40 pts/3 00:00:00 [python] <defunct>