Browse Source

add cloud info

master
zeus 3 years ago
parent
commit
fd23e0d2db
  1. 50
      CloudComputing_Lab/modules/ROOT/pages/ansible.adoc

50
CloudComputing_Lab/modules/ROOT/pages/ansible.adoc

@ -1,6 +1,9 @@
= CaaS - OS Admin = CaaS - OS Admin
== Playbook == Playbook
[source,sh] [source,sh]
@ -211,6 +214,42 @@
== Playbook files == 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
----
=== fluentd conf file === fluentd conf file
[source,sh] [source,sh]
@ -785,3 +824,14 @@ host_key_checking = False
# Set how many context lines to show in diff # Set how many context lines to show in diff
# context = 3 # context = 3
---- ----
== Run it!
[source,sh]
----
#!/bin/sh
ansible-playbook -u docker -i inventory.yml file.yml -f 5 --ask-pass --ask-become-pass
# run with keys
#ansible-playbook -u docker -i inventory.yml fluentd.yml -f 5 --private-key=/home/docker/.ssh/id_rsa
----

Loading…
Cancel
Save