Changes between Version 9 and Version 10 of GENIExperimenter/Tutorials/GENI-SAVI/Execute
- Timestamp:
- 06/16/15 13:06:22 (9 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
GENIExperimenter/Tutorials/GENI-SAVI/Execute
v9 v10 42 42 }}} 43 43 44 '''Before you run this playbook, replace <GENI-Username> at the end of the script (the curl command) with your GENI username''' 45 44 46 The ansible playbook: 45 47 {{{ 46 48 --- 47 49 - hosts: nodes 50 sudo: yes 48 51 remote_user: "{{ ansible_ssh_user }}" 49 sudo: yes50 52 tasks: 51 53 … … 67 69 ### (d): Get the host's public IP address ### 68 70 - name: Get my public IP 69 shell: dig +short {{ ansible_ssh_host }} 71 ###shell: dig +short {{ ansible_hostname }} 72 shell: curl ipecho.net/plain 70 73 register: public_ip 71 74 … … 74 77 75 78 76 ### (e): Get the latitude and longitude for each node ###77 - name: Download GeoLiteCity DB78 get_url: url=http://geolite.maxmind.com/download/geoip/database/GeoLiteCity.dat.gz79 dest=/tmp80 81 - name: Unzip GeoLiteCity.dat.gz82 shell: gunzip -f /tmp/GeoLiteCity.dat.gz83 creates=GeoLiteCity.dat84 85 79 - name: Run geoiplookup to get latitude 86 shell: geoiplookup -f /tmp/GeoLiteCity.dat {{ public_ip.stdout }} | awk -F ', ' '{print $7}' 80 #shell: geoiplookup -f GeoLiteCity.dat {{ public_ip.stdout }} | awk -F ', ' '{print $7}' 81 shell: curl -s ipinfo.io | grep loc | sed "s/^.*loc..// " | sed "s/..$//" | sed "s/^.*\"//" | sed "s/,.*$//" 87 82 register: lat 88 83 … … 91 86 92 87 - name: Run geoiplookup to get longitude 93 shell: geoiplookup -f /tmp/GeoLiteCity.dat {{ public_ip.stdout }} | awk -F ', ' '{print $8}' 88 # shell: geoiplookup -f GeoLiteCity.dat {{ public_ip.stdout }} | awk -F ', ' '{print $8}' 89 shell: curl -s ipinfo.io | grep loc | sed "s/^.*loc..// " | sed "s/..$//" | sed "s/^.*,//" 94 90 register: long 95 91 … … 99 95 100 96 ### (f): Fetch the parameterized URL ### 101 - debug: msg="http://www.lively-web.org/nodejs/GEETutorial/helloWorld?slice={{ ansible_hostname }}&name={{ ansible_fqdn }}&ip={{ public_ip.stdout }}&local={{ ansible_eth0.ipv4.address }}&lat={{ lat.stdout }}&lng={{ long.stdout }}"102 97 103 - shell: curl "http://www.lively-web.org/nodejs/GEETutorial/helloWorld?slice={{ ansible_hostname }}&name={{ ansible_fqdn }}&ip={{ public_ip.stdout }}&local={{ ansible_eth0.ipv4.address }}&lat={{ lat.stdout }}&lng={{ long.stdout }}" 98 - shell: curl "http://www.lively-web.org/nodejs/GEETutorial/helloWorld?slice=<GENI-Username>&name={{ansible_fqdn}}&ip={{public_ip.stdout }}&local={{ansible_eth0.ipv4.address}}&lat={{lat.stdout}}&lng={{long.stdout}}" 99 register: hello 100 101 - debug: var=hello 104 102 }}} 105 103