Unless, you specify an 'exact_count: yes' when using 'group', this is the
expected behavior.
If you omit 'group', it will not continue creating new servers.
Also, the way that I would recommend using the module for what you are
attempting is:
- name: Server build request
rax:
credentials: "{{ bamboo_build_working_directory }}/.rackconnect"
name: "q-helios-test-web%02d"
flavor: performance1-1
image: ubuntu-1204-lts-precise-pangolin
wait: yes
state: present
wait_timeout: 600
networks:
- private
- public
group: web
exact_count: yes
count: 2
This will create 2 servers, named q-helios-test-web01 and q-helios-test-web02,
with group=web. It will always ensure a count of 2.
This will also be faster to build than your previous method, as it creates the
servers in parallel, instead of serially. It also utilizes printf style
formatting to define the name of the servers, which alleviates you having to
manually increment the number in the host name.
Also, if you are indeed utilizing rackconnect, you may want to look at my
example playbooks, that appropriately wait for RackConnect and Managed Cloud
automation to complete before configuring the servers:
https://github.com/sivel/ansible-samples/tree/master/rackconnect
Those examples will be added to the Rackspace Guide in the Ansible docs in the
near future.
--
Matt Martz
[email protected]
On May 2, 2014 at 9:29:14 AM, David Neudorfer ([email protected])
wrote:
When using the rax module everytime I run it it creates a new server with the
same name. Shouldn't it just say "ok" if the server name already exists?
- name: Server build request
rax:
credentials: "{{ bamboo_build_working_directory }}/.rackconnect"
name: "q-helios-test-{{ item.name }}"
flavor: performance1-1
image: ubuntu-1204-lts-precise-pangolin
wait: yes
state: present
auto_increment: False
wait_timeout: 600
networks:
- private
- public
group: "{{ item.groups }}"
with_items:
- { name: 'web01', groups: 'web' }
- { name: 'web02', groups: 'web' }
If this is how its supposed to work how can I change my task so it only creates
the server if it hasn't already been created?
--
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/9e9e0d96-c7b2-4f84-bc3e-b20afccb58cb%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--
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/etPan.5363b19d.6b8b4567.11502%40mobiletuvix.rackspace.corp.
For more options, visit https://groups.google.com/d/optout.