97 | | === (b) Get the container name === |
98 | | |
99 | | Look at the variables collected by Ansible's setup module (step 1(c) above). Find one that holds the container name. Add a debug task to your playbook, like the one in the starter playbook, to print out its value. Complete the following task and add it to your playbook. |
100 | | |
101 | | {{{ |
102 | | - name: Print container name variable |
103 | | debug: var= |
104 | | }}} |
| 97 | Here is an Ansible playbook skeleton that you can use to complete the tutorial. |
| 98 | |
| 99 | {{{ |
| 100 | --- |
| 101 | - hosts: nodes |
| 102 | remote_user: root |
| 103 | tasks: |
| 104 | - name: Update apt cache |
| 105 | shell: apt-get update |
| 106 | |
| 107 | - name: Install python-apt (to work around an Ansible bug) |
| 108 | shell: apt-get -y install python-apt |
| 109 | |
| 110 | - name: 2(a): Dump container FQDN |
| 111 | debug: # INSERT ARGUMENTS HERE |
| 112 | |
| 113 | - name: 2(b): Dump container IP address |
| 114 | debug: # INSERT ARGUMENTS HERE |
| 115 | |
| 116 | - name: 2(c): Dump control host name |
| 117 | debug: # INSERT ARGUMENTS HERE |
| 118 | |
| 119 | - name: 2(d): Install dnsutils (for dig) |
| 120 | apt: # INSERT ARGUMENTS HERE |
| 121 | |
| 122 | - name: 2(d): Get my public IP using 'dig +short' |
| 123 | shell: # INSERT ARGUMENTS HERE |
| 124 | register: public_ip |
| 125 | |
| 126 | - name: 2(d): Dump public_ip variable |
| 127 | debug: var=public_ip |
| 128 | |
| 129 | - name: 2(e): Install geoip-bin (for geoiplookup) |
| 130 | apt: # INSERT ARGUMENTS HERE |
| 131 | |
| 132 | - name: 2(e): Download GeoLiteCity DB |
| 133 | get_url: # INSERT ARGUMENTS HERE |
| 134 | |
| 135 | - name: 2(e): Unzip GeoLiteCity.dat.gz |
| 136 | shell: gunzip -f GeoLiteCity.dat.gz |
| 137 | |
| 138 | - name: 2(e): Run geoiplookup to get latitude |
| 139 | shell: # INSERT ARGUMENTS HERE |
| 140 | register: lat |
| 141 | |
| 142 | - name: 2(e): Dump lat variable |
| 143 | debug: var=lat |
| 144 | |
| 145 | - name: 2(e): Run geoiplookup to get longitude |
| 146 | shell: # INSERT ARGUMENTS HERE |
| 147 | register: long |
| 148 | |
| 149 | - name: 2(e): Dump long variable |
| 150 | debug: var=long |
| 151 | |
| 152 | - name: Dump the full URL |
| 153 | - debug: msg="http://www.lively-web.org/nodejs/GEETutorial/helloWorld?slice=# INSERT ARGUMENTS HERE" |
| 154 | |
| 155 | - shell: curl "http://www.lively-web.org/nodejs/GEETutorial/helloWorld?slice=# INSERT ARGUMENTS HERE" |
| 156 | }}} |
| 157 | |
| 158 | |
| 159 | |
| 160 | === (b) Get the container's FQDN === |
| 161 | |
| 162 | Look at the variables collected by Ansible's setup module (step 1(c) above). Find one that holds the container's fully-qualified domain name (e.g., slice347.pcvm1-1.instageni.iu.edu). |