Changes between Version 9 and Version 10 of GENIExperimenter/Tutorials/GENI-SAVI/Execute


Ignore:
Timestamp:
06/16/15 13:06:22 (9 years ago)
Author:
Vic Thomas
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • GENIExperimenter/Tutorials/GENI-SAVI/Execute

    v9 v10  
    4242}}}
    4343
     44'''Before you run this playbook, replace <GENI-Username> at the end of the script (the curl command) with your GENI username'''
     45
    4446The ansible playbook:
    4547{{{
    4648---
    4749- hosts: nodes
     50  sudo: yes
    4851  remote_user: "{{ ansible_ssh_user }}"
    49   sudo: yes
    5052  tasks:
    5153
     
    6769  ### (d): Get the host's public IP address ###
    6870  - name: Get my public IP
    69     shell: dig +short {{ ansible_ssh_host }}
     71    ###shell: dig +short {{ ansible_hostname }}
     72    shell: curl ipecho.net/plain
    7073    register: public_ip
    7174
     
    7477
    7578
    76   ### (e): Get the latitude and longitude for each node ###
    77   - name: Download GeoLiteCity DB
    78     get_url: url=http://geolite.maxmind.com/download/geoip/database/GeoLiteCity.dat.gz
    79       dest=/tmp
    80 
    81   - name: Unzip GeoLiteCity.dat.gz
    82     shell: gunzip -f /tmp/GeoLiteCity.dat.gz
    83       creates=GeoLiteCity.dat
    84 
    8579  - 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/,.*$//"
    8782    register: lat
    8883
     
    9186
    9287  - 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/^.*,//"
    9490    register: long
    9591
     
    9995
    10096  ### (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 }}"
    10297
    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
    104102}}}
    105103