Hi there,

I'd like to understand how I can access a set of newly created rackspace 
servers using the group names that I specified at the point of creation.

At the moment, parts of my playbook are being ignored because the groups 
the new servers are added to at the point of creation are not being 
retrieved, even when I explicitly force a gather_facts.

If I run the play book a second time, the inventory correctly returns the 
group information for the servers that were previously created. I can see 
because of this that there is no error in the way they're being created. 
Note: we're using pyrax to give us a dynamic inventory.

This gist shows the playbook file, and also the infrastructure role which 
is called: https://gist.github.com/danrough/e0c8627dbc7b2153d983

In playbook.yml, the infrastructure role (the other file included in the 
Gist) is called and the servers are created. When they're created, the 
servers are added to host groups using a defined naming pattern, so that 
they can be referred to later.

After the servers have been created, a post-creation role is run against 
them which essentially adds some users and locks down SSH. All is well up 
until this point.

At line 14 in the playbook.yml file, I want to be able to access the 
servers using the group information I specified when the servers were 
created. This doesn't work. On subsequent runs of the playbook, it does. I 
assume that this is because the facts for the servers haven't been 
re-cached.

If I split the playbook into two separate files, the facts are gathered and 
I can access the servers. However, I need to keep this playbook as one 
complete file, as there as some plays (lines 103 onwards in playbook.yml) 
that I only want to run if the relevant servers have been created.

I've tried adding in a play which explicitly forces ansible to gather facts 
after the current line 12, by doing the following:

- hosts: "{{ target_environment }}"
  gather_facts: true

but this still isn't helping. What am I missing here?

Thanks!

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/e6aa32fd-c7a7-484a-9c7f-1c0cc4e50584%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to