# Ansible support to RackSpace

**URL:** <https://forum.ansible.com/t/ansible-support-to-rackspace/11839>\
**Category:** Ansible Project\
**Created:** [August 28, 2012, 8:34pm UTC](https://forum.ansible.com/t/ansible-support-to-rackspace/11839 "2012-08-28T20:34:03Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Marco\_Vito\_Moscarito](https://avatars.discourse-cdn.com/v4/letter/m/97f17d/32.png) [@Marco\_Vito\_Moscarito](https://forum.ansible.com/u/Marco_Vito_Moscarito)\
**Post date:** [August 28, 2012, 8:34pm UTC](https://forum.ansible.com/t/ansible-support-to-rackspace/11839/1 "2012-08-28T20:34:03Z")

</div>

I start to work on ansible inventory for RackSpace (using OpenCloud  
API, so i think can be portable, but I'm not able to test on other  
environment for now).  
You can see the first relase at:

\* [https://github.com/mavimo/ansible-plugins/tree/master/inventory](https://github.com/mavimo/ansible-plugins/tree/master/inventory)

#### Setup ####

Install python-novaclient python library (see README on  
[https://github.com/openstack/python-novaclient](https://github.com/openstack/python-novaclient) )

Change data in nova.ini file using:  
\* data from RackSpace control panel (username / api\_key)  
\* Set entrypoint for service (RackSpace use:  
[https://identity.api.rackspacecloud.com/v2.0/](https://identity.api.rackspacecloud.com/v2.0/) for US datacenter)

Set permission to nova.py to make sure it is executable. You can test  
it work fine with:

&nbsp;&nbsp;./nova.py --list

NB: nova.ini must be in the same directory of nova.py.

#### Usage ####

Specify the complete path of inventory to ansible:

&nbsp;&nbsp;ansible -i /path/to/nova.py all -m ping

This inventory use metadata on server instance to ad machine to  
appropriate group, eg:

&nbsp;&nbsp;nova 11aaa11a-1a11-111a-a11a-11aaa1111aa1 meta set group=frontend  
&nbsp;&nbsp;nova 11aaa11a-1a11-111a-a11a-11aaa1111aa2 meta set group=frontend  
&nbsp;&nbsp;nova 11aaa11a-1a11-111a-a11a-11aaa1111aa3 meta set group=database  
&nbsp;&nbsp;nova 11aaa11a-1a11-111a-a11a-11aaa1111aa4 meta set group=database  
&nbsp;&nbsp;nova 11aaa11a-1a11-111a-a11a-11aaa1111aa5 meta set group=monitor  
&nbsp;&nbsp;nova 11aaa11a-1a11-111a-a11a-11aaa1111aa6 meta set group=backup

and information list will be:

&nbsp;&nbsp;./nova.py --list

{  
&nbsp;&nbsp;'frontend' : ['192.168.0.1', '192.168.0.2'],  
&nbsp;&nbsp;'database' : ['192.168.0.3', '192.168.0.4'],  
&nbsp;&nbsp;'monitor' : ['192.168.0.5'],  
&nbsp;&nbsp;'backup' : ['192.168.0.6'],  
}

NB: this is just a first step, some other improvement will be add, if  
you have suggestion please reply to this mail or send an issue in  
github.

Bye  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Marco
