| 49 | |
| 50 | |
| 51 | == 4. Configure and Initialize == |
| 52 | |
| 53 | `omni` comes with a script, `readyToLogin` which finds the login information for nodes in your slice. As of `omni` version 2.8, `readyToLogin` has an `--ansible-inventory` flag which generates the Ansible inventory, which is a flat file which tells Ansible the name and login information for your nodes. |
| 54 | |
| 55 | a. Create your Ansible inventory file: |
| 56 | {{{ |
| 57 | #!div style="background: #ffd; border: 3px ridge; width: 800px;" |
| 58 | On your local machine: |
| 59 | |
| 60 | {{{ |
| 61 | #!sh |
| 62 | $ readyToLogin MYSLICE --useSliceAggregates --ansible-inventory -o |
| 63 | $ cat inventory |
| 64 | }}} |
| 65 | |
| 66 | Example output of running these commands: |
| 67 | {{{ |
| 68 | #!sh |
| 69 | $ readyToLogin MYSLICE --useSliceAggregates --ansible-inventory -o |
| 70 | Host info saved in inventory file: /Users/jdoe/projects/GENI/hellogeni/inventory |
| 71 | |
| 72 | $ cat inventory |
| 73 | client ansible_ssh_host=pc3.instageni.clemson.edu ansible_ssh_port=33850 |
| 74 | server ansible_ssh_host=pcvm3-6.instageni.clemson.edu |
| 75 | }}} |
| 76 | |
| 77 | {{{ |
| 78 | #!html |
| 79 | |
| 80 | <table id="Table_03" border="0" cellpadding="5" cellspacing="0"> |
| 81 | <tr> |
| 82 | <td> |
| 83 | <img src="http://groups.geni.net/geni/attachment/wiki/GENIExperimenter/Tutorials/Graphics/Symbols-Tips-icon.png?format=raw" width="50" height="50" alt="Tip"> |
| 84 | </td> |
| 85 | <td> |
| 86 | If your GENI Username is different than your username on your local machine, append the following information to each line of the `inventory` file: |
| 87 | <pre> |
| 88 | ansible_ssh_user = GENIUSERNAME |
| 89 | </pre> |
| 90 | Your GENIUSERNAME is shown in the header of the GENI Portal in the upper right hand corner. |
| 91 | </td> |
| 92 | </tr> |
| 93 | </table> |
| 94 | }}} |
| 95 | }}} |
| 96 | {{{ |
| 97 | #!div style="background: #fdd; border: 3px ridge; width: 800px;" |
| 98 | |
| 99 | {{{ |
| 100 | #!html |
| 101 | |
| 102 | <table id="Table_03" border="0" cellpadding="5" cellspacing="0"> |
| 103 | <tr> |
| 104 | <td> |
| 105 | <img src="http://groups.geni.net/geni/attachment/wiki/GENIExperimenter/Tutorials/Graphics/Symbols-Tips-icon.png?format=raw" width="50" height="50" alt="Tip"> |
| 106 | </td> |
| 107 | <td> |
| 108 | Windows users should copy their 'inventory' file onto their node running the ansible client. |
| 109 | </td> |
| 110 | </tr> |
| 111 | </table> |
| 112 | }}} |
| 113 | }}} |
| 114 | b. Be sure your private key has been added to your SSH agent: |
| 115 | {{{ |
| 116 | #!div style="background: #ffd; border: 3px ridge; width: 800px;" |
| 117 | {{{ |
| 118 | ssh-add /path/to/your/private/key |
| 119 | }}} |
| 120 | }}} |
| 121 | c. Check to see if your nodes are up and ready. |
| 122 | {{{ |
| 123 | #!div style="background: #ffd; border: 3px ridge; width: 800px;" |
| 124 | This command uses the `ping` module to ping the specified nodes (in this case `all`) listed in the inventory file: |
| 125 | {{{ |
| 126 | #!sh |
| 127 | $ ansible -i inventory all -m ping |
| 128 | }}} |
| 129 | |
| 130 | Example output showing all of the nodes responding to ping: |
| 131 | {{{ |
| 132 | #!sh |
| 133 | $ ansible -i inventory all -m ping |
| 134 | client | success >> { |
| 135 | "changed": false, |
| 136 | "ping": "pong" |
| 137 | } |
| 138 | |
| 139 | server | success >> { |
| 140 | "changed": false, |
| 141 | "ping": "pong" |
| 142 | } |
| 143 | }}} |
| 144 | }}} |
| 145 | c. Try using the ping module in Ansible to only ping `server` or `client` by replacing `all` in the above with `server` or `client`. |