You've already forked ansible-role-common
Support ipv6, default off in role
This commit is contained in:
@@ -34,3 +34,5 @@ win_packages:
|
||||
- 7zip.install
|
||||
|
||||
apply_win_updates: false
|
||||
|
||||
common_show_ipv6: false|bool
|
||||
@@ -18,6 +18,7 @@
|
||||
USER=`/usr/bin/whoami`
|
||||
HOSTNAME=`/usr/bin/uname -n | /usr/bin/cut -d. -f1`
|
||||
IP=`/usr/sbin/ip route get 1 | grep -Po '(?<=src.)[\w\d.]+'`
|
||||
IP6=`/sbin/ip -6 addr | awk -F '[ \t]+|/' '$3 == "::1" { next;} $3 ~ /^fe80::/ { next ; } /inet6/ {print $3} '`
|
||||
NUM_CPU=`/usr/bin/lscpu | /usr/bin/grep "CPU(s):" | /usr/bin/head -n 1 | /usr/bin/awk '{print $2}'`
|
||||
ROOT=`/usr/bin/df / -x fuse.gvfs-fuse-daemon -Ph | /usr/bin/egrep -i 'root|logvol|vda' | awk '{print $4}' | tr -d '\n'`
|
||||
HOME=`/usr/bin/df /home -x fuse.gvfs-fuse-daemon -Ph | grep home | awk '{print $4}' | tr -d '\n'`
|
||||
@@ -62,7 +63,12 @@ RESET_COLORS="\e[0m"
|
||||
echo -e "
|
||||
===========================================================================
|
||||
$COLOR_COLUMN- Hostname$RESET_COLORS............: $COLOR_VALUE $HOSTNAME $RESET_COLORS
|
||||
{% if common_show_ipv6 %}
|
||||
$COLOR_COLUMN- IP Address (Main v4)$RESET_COLORS: $COLOR_VALUE $IP $RESET_COLORS
|
||||
$COLOR_COLUMN- IP Address (Main v6)$RESET_COLORS: $COLOR_VALUE $IP6 $RESET_COLORS
|
||||
{% else %}
|
||||
$COLOR_COLUMN- IP Address (Default)$RESET_COLORS: $COLOR_VALUE $IP $RESET_COLORS
|
||||
{% endif %}
|
||||
$COLOR_COLUMN- Release$RESET_COLORS.............: $COLOR_VALUE `cat {{ ansible_distribution_file_path }}` $RESET_COLORS
|
||||
$COLOR_COLUMN- Users$RESET_COLORS...............: $COLOR_VALUE Currently `users | wc -w` user(s) logged on $RESET_COLORS
|
||||
=========================================================================== $RESET_COLORS
|
||||
|
||||
Reference in New Issue
Block a user