Changes between Version 15 and Version 16 of GENIExperimenter/Tutorials/GENIExperimentEngine/Execute


Ignore:
Timestamp:
03/16/15 12:19:33 (5 years ago)
Author:
acb@cs.princeton.edu
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • GENIExperimenter/Tutorials/GENIExperimentEngine/Execute

    v15 v16  
    3434== 1. Experiment with various Ansible modules: ping, shell, setup ==
    3535
    36 We will first get familiar with some basic Ansible commands using the command-line interface. 
     36We will first get familiar with some basic Ansible tasks using the command-line interface. 
    3737
    3838=== (a) The ping module ===
     
    9494=== (b) Get the container name ===
    9595
    96 Look at the variables collected by Ansible's setup module (step 1(c) above).  Find one that holds the container name.  Add a debug statement to your playbook, like the one in the starter playbook, to print out its value.
     96Look 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.
    9797
    9898=== (c) Get the container IP address ===
    9999
    100 Look at the variables collected by Ansible's setup module (step 1(c) above).  Find one that holds the container IP address.  Add a debug statement to your playbook, like the one in the starter playbook, to print out its value.
     100Look at the variables collected by Ansible's setup module (step 1(c) above).  Find one that holds the container IP address.  Add a debug task to your playbook, like the one in the starter playbook, to print out its value.
    101101
    102102=== (d) Get the host's public IP address ===
     
    104104This is a bit trickier: how to get the host's IP address? The IP address visible inside the slicelet (as reported in the variable ''ansible_eth0.ipv4.address'') is a private address -- it is not the control address of the host.  There are a number of ways that you could discover the control address, including running '''dig +short''' on the host’s name (see if you can find a variable that contains the host's name; HINT: you need it to SSH into the slicelet) or by running '''curl''' against a webserver that reports the client’s externally visible address.
    105105
    106 || [[Image(wiki:GENIExperimenter/Tutorials/Graphics:tip.png, nolink, 50px, bottom)]] || '''Pro Tip:''' The '''ansible''' command-line tool is a good way to try out Ansible commands before putting them in your playbook.  Look at the examples in part 1 above. ||
     106|| [[Image(wiki:GENIExperimenter/Tutorials/Graphics:tip.png, nolink, 50px, bottom)]] || '''Pro Tip:''' The '''ansible''' command-line tool is a good way to try out Ansible tasks before putting them in your playbook.  Look at the examples in part 1 above. ||
    107107
    108 || [[Image(wiki:GENIExperimenter/Tutorials/Graphics:tip.png, nolink, 50px, bottom)]] || '''Pro Tip:''' Usually in an Ansible playbook you reference a variable by surrounding it in double curly brackets: ''{{ ansible_eth0.ipv4.address }}'' ||
     108|| [[Image(wiki:GENIExperimenter/Tutorials/Graphics:tip.png, nolink, 50px, bottom)]] || '''Pro Tip:''' Usually in an Ansible playbook you reference a variable by surrounding it in double curly brackets: ''{{ ansible_eth0.ipv4.address }}''.  You can see a couple of examples of how variables are referenced in tasks in [https://github.com/ansible/ansible-examples/blob/master/language_features/get_url.yml this playbook]. ||
    109109
    110 || [[Image(wiki:GENIExperimenter/Tutorials/Graphics:tip.png, nolink, 50px, bottom)]] || '''Pro Tip:''' When you run an Ansible command in a playbook, you can save the output into a new variable using '''register: varname'''  Then you can retrieve the value later in the playbook using ''{{ varname }}'' or, for shell command output, ''{{ varname.stdout }}'' ||
     110|| [[Image(wiki:GENIExperimenter/Tutorials/Graphics:tip.png, nolink, 50px, bottom)]] || '''Pro Tip:''' When you run an Ansible command in a playbook, you can save the output into a new variable using '''register: varname'''  Then you can retrieve the value later in the playbook using ''{{ varname }}'' or, for shell command output, ''{{ varname.stdout }}''.  You can see an example of how to register a variable in [https://github.com/ansible/ansible-examples/blob/master/language_features/register_logic.yml this playbook]. ||
    111111
    112112=== (e) Get the latitude and longitude for each node ===