Created
March 21, 2018 10:35
-
-
Save lgaggini/cacdc4c8649bdacecd751bb08f251b19 to your computer and use it in GitHub Desktop.
Get cluster / host info by ansible and ansible-cmdb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /bin/bash | |
# Author: Lorenzo Gaggini | |
# Version: 0.1 | |
# | |
# Get cluster info by ansible and ansible-cmdb | |
#check input | |
if [ "$#" -ne 1 ]; then | |
echo "usage: cluster_info.sh group | host" | |
exit 1 | |
fi | |
# create tmp dir | |
tmp_dest=/tmp/${1}_cluster_info | |
mkdir -p ${tmp_dest} | |
# get facts and pretty print by ansible cmdb | |
ansible ${1} -m setup --tree ${tmp_dest} -a 'gather_subset=min,network,virtual,hardware' > /dev/null 2>&1 | |
ansible-cmdb ${tmp_dest} --template txt_table |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment