Skip to content

Instantly share code, notes, and snippets.

@ohadlevy
Created April 10, 2019 11:03
Show Gist options
  • Save ohadlevy/74e6b351869baf2f9b5a0dc09846cd23 to your computer and use it in GitHub Desktop.
Save ohadlevy/74e6b351869baf2f9b5a0dc09846cd23 to your computer and use it in GitHub Desktop.
## usage
#./nmap-ansible-facts.sh 192.168.0.0/24
#! /bin/bash -x
NETWORK=$1
tmpfile=$(mktemp /tmp/foreman-ansible-import.XXXXXX)
nmap -p 22 -Pn -R -oG - $1 | awk '/open/{print $2}' > $tmpfile
ansible -u root -k -i $tmpfile all -m setup
\rm -rf $tmpfile%
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment