Commit graph

38 commits

Author SHA1 Message Date
Monty Taylor
aa351e010f Specify nova image and flavor by name
Putting uuid and numberic identifies in playbooks is fragile, especially
with cloud providers who change them out from under you. Asking for
Ubuntu 14.04 is consistent, the UUID associated with that is not. Add
mutually exclusive parameters to allow for specifying images by name and
flavors by RAM amount.
2014-08-02 18:51:27 -07:00
Monty Taylor
e45119f2d0 Use mutually exclusive on nova floating ip params
ansible knows how to deal with mutually exclusive parameters, so
instead of coding that ourselves, use it.
2014-08-02 18:26:23 -07:00
Monty Taylor
724ed2713c Add common auth handling across openstack modules
Taking a page out of the ec2 config, make sure that all of the
OpenStack modules handle the inbound auth config in the same way.
The one outlier is keystone wrt auth_url.
2014-08-02 17:39:19 -07:00
Monty Taylor
967efdd451 Consume standard OpenStack environment settings
The OpenStack client utilities consume a set of input environment
variables for things like username and auth_url, so it's very
common for OpenStack users to have such settings set in their
environment. Indeed, things like devstack also output a shell file
to be sourced to set them. Although in a playbook it's entirely
expected that variables should be used to pass in system settings
like api passwords, for ad-hoc command line usage, needing to pass
in five parameters which are almost certainly in the environment
already reduces the utility.

Grab the environment variables and inject them as default. Special care
is taken to ensure that in the case where the values are not found, the
behavior of which parameters are required is not altered.
2014-08-02 17:39:19 -07:00
Monty Taylor
5fa9439df8 Cleanup in nova after a failed floating ip
There is a potential leak of resources if there is somehow a failure
adding a floating ip to a server. Clean up after ourselves.
2014-08-02 17:39:19 -07:00
Monty Taylor
5783a4e183 Find IPs on OpenStack clouds without floating-ips
The floating-ip extension, while pretty ubiquitous, is not a
foregone conclusion. Specifically, Rackspace, while also
served by the rax module, is a valid OpenStack cloud and can
be interacted with directly via nova interfaces.

Add support for determining public and private IPs for
OpenStack clouds that don't use floating ips by reading
the public and private keys from the addresses dict.
2014-08-02 17:39:15 -07:00
Monty Taylor
88c7027246 Add support for nova availability zones
If a cloud has availability zone support, it's possible to specify
an availability zone via the nova client. Add that as a config param.
2014-08-02 17:15:15 -07:00
Monty Taylor
e001fcb574 Pass through nova region name
If the region name is specified in the config, we need to pass it
in to the nova client constructor. Since key_name is similarly optional,
go ahead and handle both parameters the same.
2014-08-02 17:15:15 -07:00
Monty Taylor
ef33af1e22 Split nova floating-ip pool logic
The desires around getting a floating ip associated with a pool and
getting a floating ip not associated with a pool is just different
enough that following it as one set of nested ifs is tricky. Split
the function into two, one for the pool and one for the non-pool logic.
2014-08-02 17:15:15 -07:00
CaptTofu
d4688477e2 Added floating IP functionality to nova_compute 2014-08-02 17:15:15 -07:00
Oleg Bulatov
e8e42fc500 Respect region_name in nova_compute
Signed-off-by: Oleg Bulatov <oleg@bulatov.me>
2014-03-20 17:07:49 +04:00
Richard C Isaacson
154bfca787 nova_compute: Adding the version_added flag to user_data.
Per note in GH-5916.
2014-03-11 13:45:04 -05:00
Michael DeHaan
7e4793e808 Merge pull request #5916 from tidzo/issue4992
Fix for #4992 - Add userdata to cloud/nova_compute
2014-03-11 10:45:40 -05:00
Michael DeHaan
e68f1a0273 Merge pull request #6230 from joshuaconner/bugfix_nova_computer_partial_server_name_match
nova_compute: fix for partial match b/w params['name'] and an existing name
2014-03-11 10:20:02 -05:00
Michael Scherer
fb16c9615d Fix wrong module name for exception in nova compute
failed: [127.0.0.1] => {"failed": true, "parsed": false}
  invalid output was: Traceback (most recent call last):
    File "/tmp/ansible-tmp-1393950384.39-102240090845592/nova_compute", line 1328, in <module>
      main()
    File "/tmp/ansible-tmp-1393950384.39-102240090845592/nova_compute", line 241, in main
      except exc.Unauthorized, e:
  NameError: global name 'exc' is not defined
2014-03-04 17:30:15 +01:00
Joshua Conner
bb5afe97c4 nova_compute: remove ternary statement 2014-03-03 10:55:28 -08:00
Joshua Conner
b58fbd6eb0 nova_compute: fix for partial match b/w params['name'] and an existing name
When there is an Openstack instance that has a name that's a partial match
for module.params['name'], but a server with name module.params['name']
doesn't yet exist, this module would fail with a list index out of bounds
error. This fixes that by filtering by exact name and only then getting the
server from the list if the list is still not empty.
2014-02-28 18:05:52 -08:00
Matt Saunders
ca5fe48dd0 Added user_data parameter to nova_compute module - currently no file parsing just text - Re issue #4992 2014-02-08 22:47:03 +00:00
Timur Batyrshin
9ad52632c5 reword "except Error as e:" into "except Error, e:" to be compatible with Python 2.5 (#5852) 2014-02-03 13:00:40 -06:00
Michael DeHaan
0d3a74d905 ansible -> ansibleworks 2014-01-28 20:29:41 -05:00
jctanner
d3ad62320d Merge pull request #5028 from retr0h/correct-nova-api-auth-check
Nova doesn't attempt to auth on obj instantiation
2013-12-13 08:36:27 -08:00
James Tanner
38edad70ac Fixes #5023 Convert all modules to use new snippet import pattern 2013-12-02 15:11:23 -05:00
John Dewey
ef99a3c3fa Nova doesn't attempt to auth on obj instantiation
Need to call nova.authenticate() to validate credentials.
2013-11-22 21:57:02 -08:00
Michael DeHaan
08996d78d6 Add version_added to all modules missing version_added information, the docs formatter will now
raise errors when omitted, updated changelog with new modules.
2013-11-18 18:55:49 -05:00
Michael DeHaan
422bba7b4c Merge pull request #4740 from retr0h/return-server-object-not-list
Need to compare on server object not list
2013-10-31 14:51:08 -07:00
Sheldon Hearn
5e7be2041e Fix description of nova_compute:name option
It's the name of the instance, not of an image.
2013-10-31 12:34:04 +02:00
John Dewey
fdec31f200 Need to compare on server object not list
TASK: [create test controller 0] **********************************************
    failed: [127.0.0.1] => {"failed": true, "parsed": false}
    invalid output was: Traceback (most recent call last):
      File "/Users/jdewey/.ansible/tmp/ansible-1383197329.62-262790004573235/nova_compute", line 1203, in <module>
        main()
      File "/Users/jdewey/.ansible/tmp/ansible-1383197329.62-262790004573235/nova_compute", line 261, in main
        _get_server_state(module, nova)
      File "/Users/jdewey/.ansible/tmp/ansible-1383197329.62-262790004573235/nova_compute", line 197, in _get_server_state
        if server.status != 'ACTIVE':
    AttributeError: 'list' object has no attribute 'status'
2013-10-30 22:41:02 -07:00
bennojoy
118c59b385 nova compute fix regex in instance name 2013-10-10 11:44:30 +05:30
Charles Blonde
402320dd26 Fix wait_for default value to follow the documentation (documentation = 180, default value = 120) 2013-09-08 23:52:40 +02:00
Charles Blonde
ec3b67c7ec Fix wait_for conversion between String to int 2013-09-08 23:49:33 +02:00
Michael Scherer
ee6477a9b0 image_id is not required to delete a vm from openstack
Since deletion do not check the type of image or anything,
and since that's tedious to keep track of the image_id and
just adding noise to add image_id for nothing, this commit
just relax the requirement.
2013-08-17 17:56:19 +02:00
Michael Scherer
509d1c5381 Fix traceback when openstack do not have OS-EXT-IPS:type attached to address
failed: [127.0.0.1] => {"failed": true, "parsed": false}
    invalid output was: Traceback (most recent call last):
      File "/tmp/ansible-1376083321.99-111209413777779/nova_compute", line 1176, in <module>
        main()
      File "/tmp/ansible-1376083321.99-111209413777779/nova_compute", line 239, in main
        _get_server_state(module, nova)
      File "/tmp/ansible-1376083321.99-111209413777779/nova_compute", line 198, in _get_server_state
        private = [ x['addr'] for x in getattr(server, 'addresses').itervalues().next() if x['OS-EXT-IPS:type'] == 'fixed']
    KeyError: 'OS-EXT-IPS:type'

This extension was added less than 6 month ago, and so cannot be used on a release
older than Grizzly ( like Folsom ).

Commit of the extension : https://review.openstack.org/#/c/21453/

See https://wiki.openstack.org/wiki/ReleaseNotes/Grizzly#Key_New_Features_2
2013-08-09 23:26:12 +02:00
Jan-Piet Mens
3404a0fc16 DOCS: standardize on EXAMPLES (a.k.a. Docs-JumboPatch JetLag Edition)
Migrated all examples: in DOCUMENTATION=''' string to standalone EXAMPLES=''' string
  Added deprecation warning to moduledev.rst and remove deprecated example from it
  Fixed up a few typos and uppercased some acronyms.
  add consistency to how EXAMPLES are formatted
2013-06-15 20:54:25 +02:00
Michael DeHaan
38b5b0c241 Standarize docs 2013-06-01 11:52:28 -04:00
bennojoy
636f1ed794 bug fix nova_compute 2013-05-31 17:39:00 +05:30
Michael DeHaan
4105813ebe Lots of formatting fixes 2013-05-24 23:46:23 -04:00
Michael DeHaan
333577c944 Fix tabs and spaces in OpenStack modules. 2013-05-24 23:34:48 -04:00
bennojoy
2221c33b15 OpenStack Modules 2013-05-23 07:55:05 +05:30