# add\_host with Rackspace Provisioning Multiple Servers

**URL:** <https://forum.ansible.com/t/add-host-with-rackspace-provisioning-multiple-servers/13634>\
**Category:** Ansible Project\
**Created:** [October 8, 2013, 4:48pm UTC](https://forum.ansible.com/t/add-host-with-rackspace-provisioning-multiple-servers/13634 "2013-10-08T16:48:33Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Phillip\_Verheyden](https://avatars.discourse-cdn.com/v4/letter/p/c6cbf5/32.png) [@Phillip\_Verheyden](https://forum.ansible.com/u/Phillip_Verheyden)\
**Post date:** [October 8, 2013, 4:48pm UTC](https://forum.ansible.com/t/add-host-with-rackspace-provisioning-multiple-servers/13634/1 "2013-10-08T16:48:33Z")

</div>

Sorry if this got double-sent; it didn’t seem to work from my other email address. I’m running into some trouble with Rackspace provisioning. I am attempting to provision a new host and then add it to the in-memory host to continue with the rest of the plays.

The provisioning looks like this:

- name: “Ensure {{ num\_tomcat\_servers }} Tomcat servers exist”

local\_action:  
module: rax  
api\_key:   
username:   
region:   
service: cloudservers  
state: active  
wait: yes  
wait\_timeout: 600  
flavor:   
image:   
name: ‘identifier-tomcat-{{ item }}’  
meta:  
group: tomcat  
with\_sequence: count={{ num\_tomcat\_servers }}  
register: tomcat\_hosts  
notify:

- Register tomcat instances
- Group tomcat instances

Then, I have these handlers invoked:

handlers:

- name: Register tomcat instances  
local\_action: add\_host name={{ item.accessIPv4 }} groups={{ [item.name](http://item.name/) }}  
with\_items: tomcat\_hosts.instances

- name: Group tomcat instances  
local\_action: add\_host name={{ item.accessIPv4 }} groups=tomcat  
with\_items: tomcat\_hosts.instances

The idea here is that I will add all of the instances to their respective name group (identifer-tomcat-1, identifier-tomcat-2, etc) as well as a more generic group called ‘tomcat’. This is the only way that I could figure out how to do that (using 2 handlers)

The issue that I get is in the handler. It seems to bomb out on the add\_host line:

---

<div class="post-metadata">

**Author:** ![Michael\_DeHaan2](https://avatars.discourse-cdn.com/v4/letter/m/da6949/32.png) [@Michael\_DeHaan2](https://forum.ansible.com/u/Michael_DeHaan2)\
**Post date:** [October 9, 2013, 12:09am UTC](https://forum.ansible.com/t/add-host-with-rackspace-provisioning-multiple-servers/13634/2 "2013-10-09T00:09:16Z")

</div>

you can do a -v on the playbook run to see what the provisioning step returns.

paste that, and you may get some insight into what values are coming back.

I will note there’s some active development on the rax modules right now to bring them more in line with standardization, but let’s see what you get back from -v.
