Browse Source

add cloud info

master
zeus 3 years ago
parent
commit
0d46045e26
  1. 59
      CloudComputing_Lab/modules/ROOT/pages/ansible.adoc

59
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]

Loading…
Cancel
Save