Changes between Version 7 and Version 8 of GENIExperimenter/Tutorials/GENI-SAVI/Execute
- Timestamp:
- 06/16/15 09:38:38 (9 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
GENIExperimenter/Tutorials/GENI-SAVI/Execute
v7 v8 37 37 the variables you'll need. You then need to fetch a custom URL containing this information from each host. 38 38 39 Below is the [attachment:gee-tutorial.yaml skeletonAnsible playbook] that you will need. To download this playbook to your client machine:39 Below is the [attachment:gee-tutorial.yaml Ansible playbook] that you will need. To download this playbook to your client machine: 40 40 {{{ 41 41 wget http://groups.geni.net/geni/attachment/wiki/GENIExperimenter/Tutorials/GENI-SAVI/Execute/gee-tutorial-solution.yaml 42 42 }}} 43 43 44 44 The ansible playbook: 45 45 {{{ 46 46 --- 47 47 - hosts: nodes 48 remote_user: root 48 remote_user: "{{ ansible_ssh_user }}" 49 sudo: yes 49 50 tasks: 50 51 51 52 53 ### (a): Get the control host name ### 54 - name: Dump control host name 55 debug: # INSERT ARGUMENTS HERE 52 ### (a): Get the container's FQDN ### 53 - name: Dump container name 54 debug: var=ansible_fqdn 56 55 57 56 58 ### (b): Get the host's public IP address ### 59 - name: Get my public IP using 'dig +short' 60 shell: # INSERT ARGUMENTS HERE 57 ### (b): Get the container IP address ### 58 - name: Dump container IP address 59 debug: var=ansible_eth0.ipv4.address 60 61 62 ### (c): Get the control host name ### 63 - name: Dump control host name 64 debug: var=ansible_ssh_host 65 66 67 ### (d): Get the host's public IP address ### 68 - name: Get my public IP 69 shell: dig +short {{ ansible_ssh_host }} 61 70 register: public_ip 62 71 … … 65 74 66 75 67 ### ( c): Get the latitude and longitude for each node ###76 ### (e): Get the latitude and longitude for each node ### 68 77 - name: Download GeoLiteCity DB 69 get_url: # INSERT ARGUMENTS HERE 78 get_url: url=http://geolite.maxmind.com/download/geoip/database/GeoLiteCity.dat.gz 79 dest=/tmp 70 80 71 81 - name: Unzip GeoLiteCity.dat.gz 72 shell: gunzip -f GeoLiteCity.dat.gz 82 shell: gunzip -f /tmp/GeoLiteCity.dat.gz 83 creates=GeoLiteCity.dat 73 84 74 85 - name: Run geoiplookup to get latitude 75 shell: # INSERT ARGUMENTS HERE76 register: lat itude86 shell: geoiplookup -f /tmp/GeoLiteCity.dat {{ public_ip.stdout }} | awk -F ', ' '{print $7}' 87 register: lat 77 88 78 - name: Dump lat itudevariable79 debug: var=lat itude89 - name: Dump lat variable 90 debug: var=lat 80 91 81 92 - name: Run geoiplookup to get longitude 82 shell: # INSERT ARGUMENTS HERE83 register: long itude93 shell: geoiplookup -f /tmp/GeoLiteCity.dat {{ public_ip.stdout }} | awk -F ', ' '{print $8}' 94 register: long 84 95 85 - name: Dump long itudevariable86 debug: var=long itude96 - name: Dump long variable 97 debug: var=long 87 98 88 99 89 ### (d): Fetch the parameterized URL ### 90 - name: Dump the full URL, to make sure it looks OK 91 debug: msg="http://www.lively-web.org/nodejs/GEETutorial/helloWorld?slice=# INSERT ARGUMENTS HERE" 100 ### (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 }}" 92 102 93 - name: Fetch the full URL 94 shell: curl "http://www.lively-web.org/nodejs/GEETutorial/helloWorld?slice=# INSERT ARGUMENTS HERE" 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 }}" 95 104 }}} 96 105