From 0d46045e2645087161e662dda08e14f7eb2aa5e8 Mon Sep 17 00:00:00 2001 From: zeus Date: Fri, 4 Mar 2022 17:59:04 +0200 Subject: [PATCH] add cloud info --- .../modules/ROOT/pages/ansible.adoc | 59 +++++++++---------- 1 file changed, 29 insertions(+), 30 deletions(-) diff --git a/CloudComputing_Lab/modules/ROOT/pages/ansible.adoc b/CloudComputing_Lab/modules/ROOT/pages/ansible.adoc index d8ec7db..9439d60 100755 --- a/CloudComputing_Lab/modules/ROOT/pages/ansible.adoc +++ b/CloudComputing_Lab/modules/ROOT/pages/ansible.adoc @@ -214,36 +214,6 @@ == Playbook files -== inventory file (Stattic) - -[source,sh] ----- -[service] -172.31.0.3 -172.31.0.4 -172.31.0.5 -172.31.0.6 -172.31.0.2 ----- - -== inventory file (Auto) - -[source,sh] ----- -#!/bin/sh - -ip4=$(/sbin/ip -o -4 addr list eth0 | awk '{print $4}' | cut -d/ -f1) -ip6=$(/sbin/ip -o -6 addr list eth0 | awk '{print $4}' | cut -d/ -f1) - -ip=`nslookup $NODENAME | grep Addr | cut -d':' -f2 | grep -v 127.0.` -echo "[service]" > ./inventory.yml -nmap -sn -oG - $ip/24 | grep Up | grep $NODENETWORK | cut -d ' ' -f 2 >> ./inventory.yml - -# include ansible host or not -#echo $ip4 >> ./inventory.yml - - ----- @@ -825,6 +795,35 @@ host_key_checking = False # context = 3 ---- +== inventory file (Stattic) + +[source,sh] +---- +[service] +172.31.0.3 +172.31.0.4 +172.31.0.5 +172.31.0.6 +172.31.0.2 +---- + +== inventory file (Auto) + +[source,sh] +---- +#!/bin/sh + +ip4=$(/sbin/ip -o -4 addr list eth0 | awk '{print $4}' | cut -d/ -f1) +ip6=$(/sbin/ip -o -6 addr list eth0 | awk '{print $4}' | cut -d/ -f1) + +ip=`nslookup $NODENAME | grep Addr | cut -d':' -f2 | grep -v 127.0.` +echo "[service]" > ./inventory.yml +nmap -sn -oG - $ip/24 | grep Up | grep $NODENETWORK | cut -d ' ' -f 2 >> ./inventory.yml + +# include ansible host or not +#echo $ip4 >> ./inventory.yml +---- + == Run it! [source,sh]