Skip to content

Instantly share code, notes, and snippets.

@li-ch
Created December 17, 2016 02:46
Show Gist options
  • Save li-ch/8406c52a5b9fba305045cc6c2927daf9 to your computer and use it in GitHub Desktop.
Save li-ch/8406c52a5b9fba305045cc6c2927daf9 to your computer and use it in GitHub Desktop.

Sample playbook for getting shell output from stdout at distributed clients.

---
-
  hosts: all
  gather_facts: no
  tasks:
    - shell: nmap 192.168.101.0/24 -n -sP | grep report | awk '{print $5}'
      register: regnmap
    
    - debug: var=regnmap.stdout_lines 
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment