Use rax module to create a server with extra_create_args / build_config

55 views
Skip to first unread message

Dan Rough

unread,
Apr 14, 2015, 6:45:27 AM4/14/15
to ansible...@googlegroups.com
Hello,

I'd like to be able to create servers at Rackspace which are free from any packages other than the ones installed by default as part of a Debian installation. In response to the support ticket I raised, I was pointed to this article in Rackspace's documentation: http://www.rackspace.com/knowledge_center/article/post-build-options-for-servers.

The section "Build options for configuration management software (Chef, Puppet, Ansible, Salt)" in that article suggests to achieve the above, I need to provide additional information via the build_config parameter:

--meta build_config=core

I assumed that using the rax module, I could use the extra_create_args attribute to supply this information. I've tested that, and I haven't been able to get it working. I've copied my code below, I'd like to know whether I'm not using the module correctly, or if I've discovered a problem in the implementation (the docs suggest extra_create_args has only recently been added):

---
 - name: Create base image
   hosts: localhost
   tasks:
     - name: 1 GB General Purpose v1
       local_action:
         module: rax
         credentials: ~/.rackspace_cloud_credentials
         region: "LON"
         name: "base-image"
         files:
           /root/.ssh/authorized_keys: "./id-rsa.pub"
         flavor: general1-1
         image: 04399432-ac55-4e0b-bcd1-6c90fa568a0f
         extra_create_args:
           build_config: "core,monitoring"

Thanks, Dan.

Matt Martz

unread,
Apr 15, 2015, 12:44:47 PM4/15/15
to ansible...@googlegroups.com
Per that article, it looks like you need to add metadata and not options to extra_create_args.  extra_create_args are passed to the novaclient create method.

Something like:

     - name: 1 GB General Purpose v1
       local_action:
         module: rax
         [snip]
         meta:
             build_config: "core,monitoring"

--
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 ansible-proje...@googlegroups.com.
To post to this group, send email to ansible...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/96fab471-0b40-455a-9ee1-e596ac054a9f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
Matt Martz
@sivel
sivel.net

Philip Schwartz

unread,
Apr 15, 2015, 12:48:46 PM4/15/15
to ansible...@googlegroups.com
Matt is correct with his comment.

As long as you set the var in the meta section of the call to the Rax module it will be set in the request to the Cloud Servers API to create the instance.

Dan Rough

unread,
Apr 15, 2015, 12:59:45 PM4/15/15
to ansible...@googlegroups.com, ansible...@googlegroups.com
Thanks both - I had thought of using the meta attribute instead but hadn’t got round to testing it. Good to know that’s where I should be heading.


Sent from Mailbox


You received this message because you are subscribed to a topic in the Google Groups "Ansible Project" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/ansible-project/kiJGPtXz120/unsubscribe.
To unsubscribe from this group and all its topics, send an email to ansible-proje...@googlegroups.com.

To post to this group, send email to ansible...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages