add_host with Rackspace Provisioning Multiple Servers

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 }}
    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:

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.