Commit Graph

1465 Commits (de2b6469e9c8e26b9a08819f41c67f2896761b60)

Author SHA1 Message Date
Asara dddf810a19 Fixed typo in docker_image.py docs (#5764) 2016-12-08 11:25:34 -05:00
Ted Timmons 367f675420 use 'six' for urlparse compatability (#5777)
* use 'six' for urlparse compatability
2016-12-08 11:25:34 -05:00
Rob White 3f81a65e53 Fail if specifying an ENI as device but in_vpc is not true 2016-12-08 11:25:34 -05:00
Andrea Tartaglia 48d47a57d5 ported iterkeys to py3 syntax (#5657)
* ported iterkeys to py3 syntax

Addresses ansible/ansible#18507

* Use ansible.module_utils.six.moves iterkeys instead of dict.keys()

* Removed 'iterkeys'
2016-12-08 11:25:33 -05:00
tedder 78f8ef267c update formatted lines to use named identifiers 2016-12-08 11:25:32 -05:00
tedder c77f7af765 add .format indexes for 2.6 compatability
Fixes #5551; the "".format() style needs to have `{0}` instead of the implied `{}` version for compatability with 2.6.
2016-12-08 11:25:32 -05:00
Monty Taylor 509846e6d6 Add a few lines about testing (#5662) 2016-12-08 11:25:31 -05:00
Dag Wieers 54fdff16db Performance improvement using in-operator on dicts
Just a small cleanup for the existing occurrences.

Using the in-operator for hash lookups is faster than using .keys()
http://stackoverflow.com/questions/29314269/why-do-key-in-dict-and-key-in-dict-keys-have-the-same-output
2016-12-08 11:25:31 -05:00
Sam Doran 895179929c Examples syntax batch6 (#5623)
* Change example syntax on os_auth module

* Change example syntax on os_client_config module

* Change example syntax on os_image_facts module

* Change example syntax on os_networks_facts module

* Change example syntax on os_nova_flavor module

* Change example syntax on os_object module

* Change example syntax on os_server module

* Change example syntax on os_subnet_facts module

* Change example syntax on rax_files module

* Change example syntax on rax_files_objects module

* Change example syntax on mysql_db module

* Change example syntax on file module

* Change example syntax on uri module

* Change example syntax on cl_bond module

* Change example syntax on cl_bridge module

* Change example syntax on cl_img_install module

* Change example syntax on cl_interface module

* Change example syntax on cl_license module

* Change example syntax on cl_ports module

* Remove trailing colon
2016-12-08 11:25:31 -05:00
Jesse Keating 4c3f8cbd92 Do not require password when deleting os_user (#5601)
I broke backwards compat with the addition to define when a password
should be updated. It was requiring that a password value be passed when
deleting a user, which seems silly.

This moves the argument logic out of the argument spec and into when it
would be needed, when state is present.
2016-12-08 11:25:31 -05:00
Luc Charpentier be7af0193d error in docker_container example (#5631) 2016-12-08 11:25:31 -05:00
Abdul Anshad A 480c364afd fixes issue #5517 (#5519) 2016-12-08 11:25:31 -05:00
Sam Doran 38c0769abb Examples syntax batch5 (#5622)
* Change example syntax on supervisorctl module

* Change example syntax or _ec2_ami_search module

* Change example syntax on cloudformation module

* Change example syntax on ec2 module

* Change example syntax on ec2_facts module

* Change example syntax on ec2_eip module

* Change example syntax on rds module

* Change example syntax on route53 module

* Change example syntax on s3 module

* Change example syntax on digital_ocean module

* Change example syntax on docker_service module

* Change example syntax on cloudformation module

* Change example syntax on gc_storage module

* Change example syntax on gce module

* Change example syntax on gce_mig module

* Change example syntax on _glance_image module

* Change example syntax on _keystone_user module

* Change example syntax on _nova_keypair module

* Change example syntax on _quantum_floating module

* Change example syntax on _quantum_floating_ip_associate module

* Change example syntax on _quantum_network module

* Change example syntax on _quantum_router module

* Change example syntax on _quantum_router_gateway module

* Change example syntax on _quantum_router_interface module

* Change example syntax on _quantum_subnet module

* SQUASH _quantum_subnet

* Add missing quotes
2016-12-08 11:25:31 -05:00
Ben Tomasik 0de338824a Set suspend_processes version_added to 2.3 2016-12-08 11:25:29 -05:00
Ben Tomasik f2af5b8664 Add support for suspending scaling processes Ref: http://docs.aws.amazon.com/autoscaling/latest/userguide/as-suspend-resume-processes.html 2016-12-08 11:25:29 -05:00
einarc 22df46d168 Avoid `TypeError` when desired_capacity is not provided to `ec2_asg` module (#5501)
Moving the "check if min_size/max_size/desired_capacity..." code to execute BEFORE the desired_capacity code is used in the following operation:
num_new_inst_needed = desired_capacity - len(new_instances)

Otherwise the following exception occurs when desired_capacity is not specified and you're replacing instances:
    num_new_inst_needed = desired_capacity - len(new_instances)
TypeError: unsupported operand type(s) for -: 'NoneType' and 'int'

Stack Trace:

An exception occurred during task execution. The full traceback is:
Traceback (most recent call last):
  File "/var/lib/awx/.ansible/tmp/ansible-tmp-1478229985.74-62334493713074/ec2_asg", line 3044, in <module>
    main()
  File "/var/lib/awx/.ansible/tmp/ansible-tmp-1478229985.74-62334493713074/ec2_asg", line 3038, in main
    replace_changed, asg_properties=replace(connection, module)
  File "/var/lib/awx/.ansible/tmp/ansible-tmp-1478229985.74-62334493713074/ec2_asg", line 2778, in replace
    num_new_inst_needed = desired_capacity - len(new_instances)
TypeError: unsupported operand type(s) for -: 'NoneType' and 'int'

fatal: [localhost]: FAILED! => {"changed": false, "failed": true, "invocation": {"module_name": "ec2_asg"}, "module_stderr": "Traceback (most recent call last):\n  File \"/var/lib/awx/.ansible/tmp/ansible-tmp-1478229985.74-62334493713074/ec2_asg\", line 3044, in <module>\n    main()\n  File \"/var/lib/awx/.ansible/tmp/ansible-tmp-1478229985.74-62334493713074/ec2_asg\", line 3038, in main\n    replace_changed, asg_properties=replace(connection, module)\n  File \"/var/lib/awx/.ansible/tmp/ansible-tmp-1478229985.74-62334493713074/ec2_asg\", line 2778, in replace\n    num_new_inst_needed = desired_capacity - len(new_instances)\nTypeError: unsupported operand type(s) for -: 'NoneType' and 'int'\n", "module_stdout": "", "msg": "MODULE FAILURE", "parsed": false}
	to retry, use: --limit @
2016-12-08 11:25:28 -05:00
Patrick F. Marques dc4cff7350 Remove duplicated option from examples 2016-12-08 11:25:28 -05:00
Zaius Dr d8c21b153d Improve `ec2` module Python3 Support (#5497)
Imported six module from ansible module_utils for backwards compatibility.
2016-12-08 11:25:27 -05:00
Lars Van Casteren 0a435058a5 Docs update for `os_security_group` (#5531)
The example used equal characters and not colon characters.
2016-12-08 11:25:27 -05:00
Andrew Gaffney 2ef59561ba Fix bare variable references in docs (#5554) 2016-12-08 11:25:27 -05:00
Ryan Brown e45e25c257 Fix `cloudformation` error when stack-rollback fails (#5550)
In cases where a CFN stack could not complete (due to lack of
permissions or similar) but also failed to roll back, the gathering of
stack resources would fail because successfully deleted items in the
rollback would no longer have a `PhysicalResourceId` property.

This PR fixes that by soft-failing when there's no physical ID
associated to a resource.
2016-12-08 11:25:27 -05:00
Ryan S. Brown bf9077bfad Fix doc examples for `ec2_elb_lb` module
The examples had the listeners as a list item for each param, when they
really need to be their own objects.
2016-12-08 11:25:27 -05:00
Ryan S. Brown 5dd9372ff8 Fail gracefully in `ec2_asg` module when there are no matching launch configurations 2016-12-08 11:25:27 -05:00
jctanner 06e1141106 replace type() with isinstance() (#5541)
Replace all use of type() with isintance()

Addresses https://github.com/ansible/ansible/issues/18310
2016-12-08 11:25:27 -05:00
Ryan S. Brown 2744fde7c9 Fix link in `cloudformation` module docs 2016-12-08 11:25:27 -05:00
Sean Summers 59b11be65d added requires for botocore with RoleARN support
Added a requires for the minimum botocore version required to support RoleARN
2016-12-08 11:25:27 -05:00
Sean Summers 67934ac7db add role_arn to support Service Role
Add `role_arn` to support [AWS CloudFormation Service Role](http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-iam-servicerole.html)
2016-12-08 11:25:27 -05:00
Jason Cormie 9baca6ef3d Addition of InstanceUUID to facts (#4424)
The Instance UUID(refered to as PersistenceUUID in the API) is a the ID
vcenter uses to idenify VMs.
My use case for this is that I configure Zabbix using ansible and its
vmware module relies on using these to identify VMs.
2016-12-08 11:25:27 -05:00
Yair Fried 7eeb3445a4 Expose internal_network in os_floating_ip (#5510)
* Expose internal_network in os_floating_ip

Shade project has finally exposed this argument so now this module
matches old quantum_floatingip module's capabilities.

Use "nat_destination" term instead of "internal_network" to match shade
terminology.

* Add (private|internal)_network aliases to os_floating_ip

* Fix typo in os_floating_ip
2016-12-08 11:25:27 -05:00
mickael-ange 23eba8fd97 Added aws and ec2 extends_documentation_fragment to cloud/amazon/rds module. (#3951) 2016-12-08 11:25:26 -05:00
Abel Boldú 6077028560 Add uplink provider type (#5282) 2016-12-08 11:25:26 -05:00
Eduard Iskandarov 8ec5757789 Fixes: #4516 add placement_group argument for ec2_asg module 2016-12-08 11:25:26 -05:00
Tom Melendez b85bcb71c3 Support for named_ports in Managed Instance Groups. A libcloud guard has been implemented, as this feature will only be available in libcloud >= 1.3, or by using trunk. (#5167) 2016-12-08 11:25:26 -05:00
Jesse Keating 0ec56bb563 Add update_password argument to os_user (#5219)
There is a desire to not have this module always result in a change if a
password argument is supplied. The OpenStack API does not return a
password back when we get a user, so we've been assuming that if a
password argument was supplied, we should attempt to change the password
(even if nothing else is changing), and that results in a "changed"
state. Now we will only send along a password change attempt if the user
wants one (the default to match history).

Fixes #5217
2016-12-08 11:25:26 -05:00
Ricardo Carrillo Cruz 33d7745794 Add rebuild support to os_server_actions (#4289)
Fixes #2714
2016-12-08 11:25:25 -05:00
Jamie Dyer 4ac3b0c5d5 Make the RDS endpoint available if AWS returns it. Fixes #3865 (#4143) 2016-12-08 11:25:25 -05:00
Brian Coca ba6bc5382d corrected version added 2016-12-08 11:25:25 -05:00
Brian Coca 20f2fe4e91 added logout to docker_login
also cleaned up 'actions' and minor doc issues
2016-12-08 11:25:25 -05:00
Charles Paul f6676f4957 add id: back to documentation 2016-12-08 11:25:24 -05:00
John Baublitz 352b620665 GCE: Add support for 'number' parameter for manually provisioned Google Compute clusters (#4276)
* Add option for number parameter to generate manually provisioned clusters from a base name

* Refactor code to work with starting and stopped when number is specified

* Update docs

* Fix documentation error breaking Travis

* Fixes for async gce operations

* Fix documentation

* base_name from parameter to alias for name and fixes for renaming variables

* Fix breaking change on gce.py

* Fix bugs with name parameter

* Fix comments for Github build checks

* Add logic to set changed appropriately for cluster provisioning
2016-12-08 11:25:22 -05:00
Ryan S. Brown 422ec08649 Remove unused YAML import from cloudformation 2016-12-08 11:25:22 -05:00
Ryan Brown dfd57942f9 Support native YAML in CloudFormation module (#5327)
Support the new native YAML format in the CloudFormation API. This means
the existing `template_format` parameter is deprecated. This commit also
adds a warning for the deprecated parameter.
2016-12-08 11:25:22 -05:00
Daniel Andrei Minca ca36d232d5 fix unclear documentation for docker container
the docker container module's `exposed_ports` was slightly ambigous.

Use the official Docker documentation to define what an `exposed port`
is.

Resolves: ansible/ansible-modules-core#5303
Signed-off-by: Daniel Andrei Minca <mandrei17@gmail.com>
2016-12-08 11:25:22 -05:00
Ryan S. Brown 08b119df33 Fix cloudformation module return parameter documentation
Always return stack outputs, even if only an empty dict
2016-12-08 11:25:21 -05:00
tedder d01bfa6a72 Cloudformation module fix unintentional changed=true
- Don't rewrite the result; this is causing 'changed=true' on update
- Move AWSRetry import to top since it's a decorator, and is needed at definition-time
2016-12-08 11:25:21 -05:00
tedder 763399830d Boto3 rewrite of cloudformation module
- removed star-imports, which wasn't possible in Ansible 1.x
- boto doesn't have any of the modern features (most notably, changesets), so this rewrite goes all-in on boto3.
- tags are updateable, at least in boto3. Fix documentation.
- staying with "ansible yaml to json conversion" because I'm trying to keep this scoped properly. The next PR will have AWS-native yaml support.
- documented the output. Tried to leave it backwards-compatible but the changes to 'events' might break someone's flow. However, the existing data wasn't terribly useful so I don't assume it will hurt.
- split up the code into functions. This should make unit testing possible.
- added forward-facing code: 'six' for iterating, started using AWSRetry, common tag conversion.
- add todo list
- Pass `exception` parameter to fail_json
2016-12-08 11:25:21 -05:00
Ryan S. Brown adc56e52d8 Fix `fail_json` invocation in `cloudformation` module 2016-12-08 11:25:21 -05:00
Ricardo Carrillo Cruz 10d662ea1b Refactor domain/project handling on os_user module (#5212)
The keys returned by user objects for default domain and
default project are respectively default_domain_id and
default_project_id.
We need to gather those IDs in case the user passed names, so we
can then compare with the user object on the needs_update helper
function.
2016-12-08 11:25:21 -05:00
Davis Phillips 37008e1da1 vsphere_guest: Set extra config and powerstate after template deploy (#4266)
* Fixes #1381
* Fixes #2971
* Fixes #3056
2016-12-08 11:25:20 -05:00
Michael Scherer 8b7898e4ab Do not leak the password in log (#5203) 2016-12-08 11:25:20 -05:00
Michael Scherer 180977a727 Do not leak api_key or root password in log (#5201) 2016-12-08 11:25:20 -05:00
John R Barker 25b6492d37 Bulk spelling improvement to modules-core (#5225)
* Correct spelling mistakes

* Correct more spelling issues

* merge conflict

* Revert typo in parms
2016-12-08 11:25:20 -05:00
Tom Melendez a4077537e0 Added libcloud guard for Managed Instance Groups. (#4911) 2016-12-08 11:25:20 -05:00
Tom Melendez 72635db94d GCE module examples update. Correct syntax, demonstrate other options and creation of multiple instances. (#5192) 2016-12-08 11:25:20 -05:00
John Barker bca8bbe7c2 Correct functional typos 2016-12-08 11:25:19 -05:00
jjshoe 706bdbf284 Catch the rare condition where ami creation failed, this is critical when you have a 10-15 minute wait on ami creation. This rarely happens, and is tough to reproduce, but it does happen. (#5106) 2016-12-08 11:25:19 -05:00
adejongh a89992f70f Fixed incorrect usage of user_data variable (#5194) 2016-12-08 11:25:19 -05:00
Elena Washington 91e433594a Make is so that the params param truly isn't required (fix for #3860) 2016-12-08 11:25:19 -05:00
Toshio Kuratomi 0fe99f20d9 Emit an error message if six is not installed.
dopy 0.3.7 makes use of six but doesn't list it as a requirement.  This
means that people installing with pip won't get six installed, leading
to errors.  Upstream released dopy-0.3.7a to address that but pip thinks
that is an alpha release.  pip does not install alpha releases by
default so users aren't helped by that.

This change makes ansible emit a good error message in this case.

Fixes #4613
2016-12-08 11:25:19 -05:00
Toshio Kuratomi 064c381608 Fix exception hierarchy for digital ocean and some cleanups of pep8 style
Fixes #4613
2016-12-08 11:25:19 -05:00
Chris Houseknecht 8e9befa5ba Surface Compose stdout on failure
Signed-off-by: Chris Houseknecht <chouseknecht@ansible.com>
2016-12-08 11:25:18 -05:00
Chris Houseknecht 63b6672ea5 Improved enumeration of actions 2016-12-08 11:25:18 -05:00
Chris Houseknecht 1e4b8c13a3 Improved build and pull error handling 2016-12-08 11:25:18 -05:00
Ryan Brown b091d39baf Handle termination_protection parameter when restarting instances (#5076)
* Restart EC2 instances with multiple network interfaces

A previous bug, #3234, caused instances with multiple ENI's to fail when being
started or stopped because sourceDestCheck is a per-interface attribute, but we
use the boto global access to it (which only works when there's a single ENI).

This patch handles a variant of that bug that only surfaced when restarting an
instance, and catches the same type of exception.

* Default termination_protection to None instead of False

AWS defaults the value of termination_protection to False, so we don't
need to explicitly send `False` when the user hasn't specified a
termination protection level. Before this patch, the below pair of tasks
would:

1. Create an instance (enabling termination_protection)
2. Restart that instance (disabling termination_protection)

Now, the default None value would prevent the restart task from
disabling termination_protection.

```
- name: make an EC2 instance
  ec2:
    vpc_subnet_id: {{ subnet  }}
    instance_type: t2.micro
    termination_protection: yes
    exact_count: 1
    count_tag:
       Name: TestInstance
    instance_tags:
       Name: TestInstance
    group_id: {{ group }}
    image: ami-7172b611
    wait: yes
- name: restart a protected EC2 instance
  ec2:
    vpc_subnet_id: {{ subnet  }}
    state: restarted
    instance_tags:
       Name: TestInstance
    group_id: {{ group }}
    image: ami-7172b611
    wait: yes
```
2016-12-08 11:25:18 -05:00
Pradeep b405931e8b Typo Fix 2016-12-08 11:25:18 -05:00
Ryan Brown 135b92bf4e Check status of finished spot instance requests (#4990)
Per #3877, the code to wait for spot instance requests to finish would
hang for the full wait time if any spot request failed for any reason.
This commit introduces status checks for spot requests, so if the
request fails, finishes, or is cancelled the task will fail/succeed
accordingly.

One edge case introduced here is tha if a user terminates the instance
associated with the request manually it won't fail the play, under the
presumption that the user *wants* the instance terminated.
2016-12-08 11:25:15 -05:00
David Shrewsbury d0f7af4b09 Fix os_network's create_network() call for older shade versions (#5058)
A value for the project_id parameter to shade's create_network()
call was always being sent, even if no value for 'project' was
supplied. This was breaking folks with older versions of shade
(< 1.6).

Fixes PR https://github.com/ansible/ansible-modules-core/issues/3567
2016-12-08 11:25:14 -05:00
Chris Houseknecht 0e4b470ee2 Let docker-py handle decoding and JSON parsing of stream data. Fixes #4930. 2016-12-08 11:25:14 -05:00
Chris Houseknecht 9432adfaf7 Put requested devices in correct format to enable config comparison. Fixes #5000. 2016-12-08 11:25:14 -05:00
Aditya Marella c3f815a6f6 Docker module: add support for OomScoreAdj
* docker-py param name oom_score_adj
* translates to OomScoreAdj in the docker remote API
* setting version_added to "2.2"
2016-12-08 11:25:13 -05:00
shaung bcbeed244b Fix #4504 Respect timeout option when starting/stopping/restarting containers. 2016-12-08 11:25:13 -05:00
Denis Tiago c0c5b9a50a fix health instances count when we have more than one lb in asg 2016-12-08 11:25:13 -05:00
Ryan S. Brown 93737f819a Accept JSON type as the content of policy_json parameter on `iam_policy` module 2016-12-08 11:25:12 -05:00
David Shrewsbury 56211bd7ed Correct reuse_fips param to reuse_ips (#4939)
This new parameter was incorrectly named. Fixing to match the expected
name in the shade library.
2016-12-08 11:25:12 -05:00
René Moser cb9ec9f802 iam_cert: remove choice list for dup_ok type bool (#4940)
See 8879931f0cd727244587b6e58a7279d9125c96a2
2016-12-08 11:25:12 -05:00
Chris Houseknecht f33828e753 Cast scale value to int. Fixes #4592. 2016-12-08 11:25:11 -05:00
Chris Houseknecht b01af0d747 Make project start and stop error handling more resilient, and improve message text. 2016-12-08 11:25:11 -05:00
indispeq ecb05b03d4 Fix openstack security group rule vrrp choice apostrophe error (#4750)
Fixes #4444 that was erroneously closed and thought fixed
2016-12-08 11:25:11 -05:00
Matt Clay 6cdcf09984 Remove duplicate keys from module docs. (#4920) 2016-12-08 11:25:11 -05:00
Harnek Sidhu 422edfcbd4 Created digital_ocean_block_storage module (#4469) 2016-12-08 11:25:10 -05:00
Tom Melendez ea76dedadf Support for GCE Managed Instance Groups. (#4541)
Create, Delete, Resize and Recreate (of instances) supported.  Autoscalers are also supported.
2016-12-08 11:25:09 -05:00
Ryan S. Brown 10e0ec84fb Fix version_added for ec2_asg feature 2016-12-08 11:25:09 -05:00
Shawn Siefkas cff256b057 Adding SNS notification support to ec2_asg module
Addresses #1844
2016-12-08 11:25:07 -05:00
Ryan Brown 6dff21bd42 Stop sorting of termination_policies in `ec2_asg` (#4883)
The AWS API requires that any termination policy list that includes
`Default` must end with Default. The attribute sorting caused any list
of attributes to be lexically sorted, so a list like
`["OldestLaunchConfiguration", "Default"]` would be changed to
`["Default", "OldestLaunchConfiguration"]` because default is earlier
alphabetically. This caused calls to fail with BotoServerError per #4069

This commit also adds proper tracebacks to all botoservererror fail_json
calls.

Closes #4069
2016-12-08 11:25:06 -05:00
Tom Melendez 35acdec063 Document ability to disable external IP with 'none' setting. Closes #2562. (#4878) 2016-12-08 11:25:06 -05:00
Monty Taylor 7fe300bb29 Expose the reuse_fips flag on os_server (#4849)
* Expose the reuse_fips flag on os_server

* Remove useless line
2016-12-08 11:25:06 -05:00
mzizzi eaef333215 cloudformation stack events itertools.imap bugfix (#4868) 2016-12-08 11:25:05 -05:00
Christopher Kotfila f916dae700 Unpack AWS reservations while waiting to terminate (#4012)
Previously calculation of the number of instances that have been
terminated assumed all instances were in the first reservation returned
by AWS.  If this is not the case the calculated number of instances
terminated never reaches the number of instances and the module always
times out. By unpacking the instances we get an accurate number and the
module correctly exits.
2016-12-08 11:25:05 -05:00
Ryan Brown 1a02005b8d Handle EC2 instances with multiple network interfaces (#4766)
Currently instances with multiple ENI's can't be started or stopped
because sourceDestCheck is a per-interface attribute, but we use the
boto global access to it (which only works when there's a single ENI).

This patch handles multiple ENI's and applies the sourcedestcheck across
all interfaces the same way.

Fixes #3234
2016-12-08 11:25:05 -05:00
Chris Houseknecht e95f773d96 Set default log_driver to None to prevent config comparison when a log_driver is not specified. Fixes #4600. 2016-12-08 11:25:03 -05:00
Chris Houseknecht 05303a974d Purge networks using network name rather than ID. Fixes 4596. 2016-12-08 11:25:03 -05:00
Chris Houseknecht 890c2d04e2 Default restart_retries to None rather than 0. Fixes #4534. 2016-12-08 11:25:03 -05:00
Ryan Brown 6ae4e50e47 Fix failure when powering on/off EC2 instances by tag only. (#4767)
If you apply `wait=yes` and use `instance_tags` as your filter for
stopping/starting EC2 instances, this stack trace happens:

```
An exception occurred during task execution. The full traceback is:                                                                          │~
Traceback (most recent call last):                                                                                                           │~
  File "/tmp/ryansb/ansible_FwE8VR/ansible_module_ec2.py", line 1540, in <module>                                                            │~
    main()                                                                                                                                   │~
  File "/tmp/ryansb/ansible_FwE8VR/ansible_module_ec2.py", line 1514, in main                                                                │~
    (changed, instance_dict_array, new_instance_ids) = startstop_instances(module, ec2, instance_ids, state, instance_tags)                  │~
  File "/tmp/ryansb/ansible_FwE8VR/ansible_module_ec2.py", line 1343, in startstop_instances                                                 │~
    if len(matched_instances) < len(instance_ids):                                                                                           │~
TypeError: object of type 'NoneType' has no len()                                                                                            │~
                                                                                                                                             │~
fatal: [localhost -> localhost]: FAILED! => {"changed": false, "failed": true, "invocation": {"module_name": "ec2"}, "module_stderr": "Traceb│~
ack (most recent call last):\n  File \"/tmp/ryansb/ansible_FwE8VR/ansible_module_ec2.py\", line 1540, in <module>\n    main()\n  File \"/tmp/│~
ryansb/ansible_FwE8VR/ansible_module_ec2.py\", line 1514, in main\n    (changed, instance_dict_array, new_instance_ids) = startstop_instances│~
(module, ec2, instance_ids, state, instance_tags)\n  File \"/tmp/ryansb/ansible_FwE8VR/ansible_module_ec2.py\", line 1343, in startstop_insta│~
nces\n    if len(matched_instances) < len(instance_ids):\nTypeError: object of type 'NoneType' has no len()\n", "module_stdout": "", "msg": "│~
MODULE FAILURE", "parsed": false}
```

That's because the `instance_ids` variable is None if not supplied
in the task. That means the instances that result from the instance_tags
query aren't going to be included in the wait loop. To fix this, a list
needs to be kept of instances with matching tags and that list needs to
be added to `instance_ids` before the wait loop.
2016-12-08 11:25:03 -05:00
Abhijit Menon-Sen 841ceb808d Fix spot instance creation by ignoring instance_initiated_shutdown_behavior (#4741)
Before this, all spot instance requests would fail because the code
_always_ called module.fail_json when the parameter was set (which it
always was, because the module parameter's default was set to 'stop').

As the comment said, this parameter doesn't make sense for spot
instances at all, so the error message was also misleading.
2016-12-08 11:25:02 -05:00
Florian Dambrine 2adc325ef6 Fix ec2 module source_dest_check when running on non VPC instances (EC2 Classic) (#3243) 2016-12-08 11:25:02 -05:00
Matt Ferrante d88f5f6808 Properly support tag updates on CloudFormation stack-update actions (#3638) 2016-12-08 11:25:02 -05:00
David J Peacock 14fb0e4136 description expanded for 112, AKA VRRP protocol) (#4645)
* description expanded for 112, AKA VRRP protocol)

* corrected syntax for description for IP protocols
2016-12-08 11:25:02 -05:00
Kenny Woodson 3cb42fc5dd Fix for validate rule. Ensure rule is a dict. (#4640) 2016-12-08 11:24:59 -05:00
Kenny Woodson f1db594e9f Getting rid of a None type error when no resource tags are defined. (#4638) 2016-12-08 11:24:59 -05:00
John R Barker 89529366bf digital_ocean_tag name is a required field
Spotted during final review of https://github.com/ansible/ansible-modules-core/pull/4218/files
Simple to change, so fixing post merge
2016-12-08 11:24:55 -05:00
Victor Volle 6a20e6649d Digitalocean tags (replaces #4209) (#4218)
* Fixes #4117: Add DigitalOcean Tag support

* Add GPLv3 license header and RETURN documentation

* ansible.module_utils.urls instead of "requests"
2016-12-08 11:24:55 -05:00
Arun prasath 7a7ac2ee83 Fixes bug #4546 - Made password optional (#4574) 2016-12-08 11:24:55 -05:00
David J Peacock bcc738bd0d Fix #4412: os_security_group_rule support numbered protocols (#4444) 2016-12-08 11:24:55 -05:00
Ryan Brown c85d854c84 Remove spurious `changed` state on iam_policy module (#4381)
Due to a mixup of the group/role/user and policy names, policies with
the same name as the group/role/user they are attached to would never be
updated after creation. To fix that, we needed two changes to the logic
of policy comparison:

- Compare the new policy name to *all* matching policies, not just the
  first in lexicographical order
- Compare the new policy name to the matching ones, not to the IAM
  object the policy is attached to
2016-12-08 11:24:55 -05:00
Rick Mendes 503c2b6158 Fixes #3144 (#4305) 2016-12-08 11:24:55 -05:00
Matías Pizarro c1dae481e8 Use named parameters in new_droplet method call (#4483)
This mirrors the original method signature and guards against any
change in order parameter
2016-12-08 11:24:54 -05:00
Ilja Bauer 729486809e Replaced use of bare variables with full variable syntax (#4149) 2016-12-08 11:24:54 -05:00
chouseknecht 964b7ecffa Fix container labels expected vs actual comparison. 2016-12-08 11:24:54 -05:00
Patrick Marques 697a328124 ssh_public_keys on Azure virtual machine is a list (#4350)
The ssh_public_keys must be a list otherwise will give the error:
"argument ssh_public_keys is of type <type 'dict'> and we were unable to convert to list"
2016-12-08 11:24:53 -05:00
Richard Adams b0135fadea Add parameter to `ec2` module to control instance shutdown behavior (stop|terminate) 2016-12-08 11:24:52 -05:00
Karthik Suresh 4d7d3cdbb1 Removing duplicate name: parameter possible typo (#4525)
Removed name:parameter in documentation. Possible typo.
2016-12-08 11:24:52 -05:00
chouseknecht 1b4a3dbc86 Fix doc strings. Use of > was breaking HTML generation on docs site module page. 2016-12-08 11:24:52 -05:00
nishiokay fc79615e38 Add ipv6 paramater to digital_ocean module (#4447) 2016-12-08 11:24:51 -05:00
Linus Arver 8da17b750d docker_service: fix files/project_files typo
The original decision to rename from `project_files' to `files' was in
3a5dd0007634c9d4e379f20cac77c8fd64b67f42.
2016-12-08 11:24:51 -05:00
chouseknecht fb99277066 Exposing tcp and udp for same port fails. Fixes issue #4354. 2016-12-08 11:24:51 -05:00
PikachuEXE fc87dd9650 Allow specifying human readable value for option `memory_limit` again (#4049) 2016-12-08 11:24:50 -05:00
chouseknecht 76260d3aa8 Fix network alias and network link comparison. - Using set based comparison was not working consistently - With != operator worked locally but consistently failed on Travis - With 'not in' operator failed locally and on Travis 2016-12-08 11:24:50 -05:00
chouseknecht 433b5e187f If debug true, include actions and differences in output. 2016-12-08 11:24:50 -05:00
Chris Houseknecht a8111adcd6 Some post merge clean up: (#4406)
- Removed required_if.
  - Fixed doc strings.
  - Removed debug output being appended to actions.
  - Put import of basics at bottom to be consistent with other docker modules
  - Added 'containers' alias to 'connected' param
  - Put facts in ansible_facts.ansible_docker_network
2016-12-08 11:24:50 -05:00
Brian Coca 94486c5c77 doc fix 2016-12-08 11:24:50 -05:00
Chris Houseknecht af3884f558 Adding docker_network module. (#4404) 2016-12-08 11:24:50 -05:00
muxator 16db1d54d1 typo in the documentation of the "state" parameter (#4353) 2016-12-08 11:24:48 -05:00
Chris Houseknecht 2514ec5056 Add buildargs parameter to support Dockerfile ARG directive. (#4349)
* Add buildargs parameter to support Dockerfile ARG directive.

* Fix doc_strings. Doc string for load_path was completely missing.
2016-12-08 11:24:48 -05:00
chouseknecht f6b126d412 Default repository tag value to tag parameter value or 'latest'. 2016-12-08 11:24:48 -05:00
chouseknecht 3dab1785ba Always returns changed when state present and name includes :tag. 2016-12-08 11:24:48 -05:00
Chris Houseknecht 1cf9d3e68e Add *build* to state parameter choices. Updated deprecation message. Will be deprecated in release 2.3. Removed (#4342)
mention of *tagged* state in the force parameter doc strings. There is no *tagged* state.
2016-12-08 11:24:48 -05:00
chouseknecht 2ea29fee3f Fix image tag operation. Allows repository in form of repo:tag. If no tag value, defaults to 'latest'. 2016-12-08 11:24:48 -05:00
chouseknecht 0c4da5d3a0 Added implementation of ignore_image, which prevents recreation of containers on image change. 2016-12-08 11:24:47 -05:00
chouseknecht 5992c21c9c Fix #3670 host IP defaults to 0.0.0.0 ignoriing bridge Host IP option. 2016-12-08 11:24:47 -05:00
chouseknecht a6bfeea1c4 Improved documentation for returned actions. 2016-12-08 11:24:47 -05:00
chouseknecht cd7b34547d When build true call docker-compose build, and add nocache option. 2016-12-08 11:24:47 -05:00
chouseknecht df09b4f668 Set version_added 2016-12-08 11:24:47 -05:00
chouseknecht 1670d9b030 Add pull option to pull images prior to evaluating service state. 2016-12-08 11:24:47 -05:00
Shawn Siefkas e9bf046c26 Check mode fixes for ec2_vpc_net module (#2179)
* Check mode fixes for ec2_vpc_net module

Returns VPC object information

Detects state change for VPC, DHCP options, and tags in check mode

* Early exit on VPC creation in check mode
2016-12-08 11:24:47 -05:00
Shawn Siefkas 0b95051039 Fix #2526 (#2527)
Fail on unhandled exception in ec2_asg rather than raise
2016-12-08 11:24:47 -05:00
Shawn Siefkas 66f1f6d537 Check mode fix for ec2_group module (#2184)
The default VPC egress rules was being left in the egress rules for
purging in check mode.  This ensures that the module returns the correct
change state during check mode.
2016-12-08 11:24:47 -05:00
Rick Mendes be33879152 Fixes #4227: just changing messaging 2016-12-08 11:24:46 -05:00
Rick Mendes eae75cf727 Fix #3549, failure to reference `module` in `ec2_eip` module 2016-12-08 11:24:46 -05:00
Lyle Mantooth f57ece661f Remove file extension from policy names (#3805)
Fixes #3804.

Prevents `__file__` from contributing ".", which is an illegal character in ELB policy names.
2016-12-08 11:24:46 -05:00
Julien Vey 7ba3ba2da9 Fix Typo in docker_image_facts module 2016-12-08 11:24:46 -05:00
Monty Taylor f441e2c1a9 Rename a confusing variable
I had to read the two lines in question twice. That might just make me
dumb, but if I'm dumb, someone else might be too.
2016-12-08 11:24:46 -05:00
Rick Mendes 4fad93561a please remove me as maintainer 2016-12-08 11:24:46 -05:00
Rick Mendes d6cc007380 Fixes #4227 2016-12-08 11:24:46 -05:00
Jasmine Hegman f5c3f4dd6b Update docs to indicate ec2_asg state defaults to present (#4046)
* Update docs to indicate ec2_asg state defaults to present

Hopefully fixes Issue #4016

* Forgot to flip required to false
2016-12-08 11:24:46 -05:00
Shaun Brady 7b8d625546 Make ec2_elb_lb respect VPCs when resolving groups
AWS security groups are unique by name only by VPC (Restated, the VPC
and group name form a unique key).

When attaching security groups to an ELB, the ec2_elb_lb module would
erroneously find security groups of the same name in other VPCs thus
causing an error stating as such.

To eliminate the error, we check that we are attaching subnets (implying
that we are in a VPC), grab the vpc_id of the 0th subnet, and filtering
the list of security groups on this VPC.  In other cases, no such filter
is applied (filters=None).
2016-12-08 11:24:46 -05:00
Shaun Brady 3b32b60338 Remove trailing white space 2016-12-08 11:24:46 -05:00
Shaun Brady 04199140c5 Make group_name resolution VPC aware
EC2 Security Group names are unique given a VPC.  When a group_name
value is specified in a rule, if the group_name does not exist in the
provided vpc_id it should create the group as per the documentation.

The groups dictionary uses group_names as keys, so it is possible to
find a group in another VPC with the name that is desired.  This causes
an error as the security group being acted on, and the security group
referenced in the rule are in two different VPCs.

To prevent this issue, we check to see if vpc_id is defined and if so
check that VPCs match, else we treat the group as new.
2016-12-08 11:24:46 -05:00
John Baublitz fe09641476 Doc update 2016-12-08 11:24:45 -05:00
John Baublitz c8dc0bf5c9 Fix exception handling to be compatible with Python 3 2016-12-08 11:24:45 -05:00
John Baublitz 4b11312737 Additional error handling for corner cases like deleting networks with active subnetworks 2016-12-08 11:24:45 -05:00
John Baublitz e4697c3780 Documentation 2016-12-08 11:24:45 -05:00
John Baublitz 96599a5963 Logic to allow subnet creation 2016-12-08 11:24:45 -05:00
John Baublitz 5591e6bb0b Add error handling for specifying 'mode' with insufficiently recent libcloud 2016-12-08 11:24:45 -05:00
John Baublitz 9c9b22dc8f Changes to allow 'auto' mode which does not allow IP address specification 2016-12-08 11:24:45 -05:00
John Baublitz 839871d87b Support for newer networking modes in GCE 2016-12-08 11:24:45 -05:00
Ryan 8b582cceaa fix typo in azure_rm_storageaccount (#4236) 2016-12-08 11:24:45 -05:00
chrisweaver 531954e2f6 Enforce boolean type for dup_ok
Stop "choices" from being interpreted as strings.
2016-12-08 11:24:45 -05:00
Matthew Martin 4d952d6e6e Add CAPABILITY_NAMED_IAM to cloudformation capabilities
While from the documentation[1] one would assume that replacing
CAPABILITY_IAM with CAPABILITY_NAMED_IAM; this as empirically been shown
to not be the case.

1: "If you have IAM resources, you can specify either capability. If you
have IAM resources with custom names, you must specify
CAPABILITY_NAMED_IAM."
http://docs.aws.amazon.com/AWSCloudFormation/latest/APIReference/API_CreateStack.html
2016-12-08 11:24:45 -05:00
Michael Baydoun 3818cc2b95 fixes issues where iam_policy incorrected reported changed 2016-12-08 11:24:45 -05:00
John Baublitz 906b457bf1 Collapse boilerplate code into change_instance_state function 2016-12-08 11:24:45 -05:00
John Baublitz eb97165acc Add states for stopping and starting machines 2016-12-08 11:24:44 -05:00
Tom Melendez 067bb6ec01 Added helper function and logic to sort attributes before comparing. 2016-12-08 11:24:44 -05:00
Kai Kousa 4a8a052e2e Improve documentation on security_groups-option 2016-12-08 11:24:44 -05:00
Tom Melendez 8becd9a14d Allow GCE firewall rules to be updated when attributes changes. Fixes #2111.
Previously, when the attributes of a GCE firewall change, they were ignored.  This PR changes that behavior and now updates them.

Note that the "update" also removes attributes that are not specified.

An overview of the firewall rule behavior is as follows:

1. firewall name in GCP, state=absent in PLAYBOOK: Delete from GCP
2. firewall name in PLAYBOOK, not in GCP: Add to GCP.
3. firewall name in GCP, name not in PLAYBOOK: No change.
4. firewall names exist in both GCP and PLAYBOOK, attributes differ: Update GCP to match attributes from PLAYBOOK.
2016-12-08 11:24:44 -05:00
yfried-redhat b1ee47f358 Make os_floating_ip module idempotent
Current module fails when tries to assign floating-ips to server that
already have them and either fails or reports "changed=True" when no
ip was added

Removing floating-ip doesn't require address

Server name/id is enough to remove a floating ip.
2016-12-08 11:24:44 -05:00
Andrei Lukovenko 436ff356e7 Bug: repeatable invocation with state=present leads to (#3052)
[localhost]: FAILED! => {"changed": false, "failed": true, "msg":
"'Domain' object has no attribute 'id'"}

How to reproduce:

- name: create domain
  digital_ocean_domain: state=present name=DOMAIN_NAME ip=DROPLET_IP

- name: create domain
  digital_ocean_domain: state=present name=DOMAIN_NAME ip=DROPLET_IP

Problem: DigitalOcean API changed API
(https://developers.digitalocean.com/documentation/v2/#list-all-domain-records)
2016-12-08 11:24:44 -05:00
Toshio Kuratomi 0364831c22 Remove version-added on name field.
This parameter was actually added in 2.0.  It's just that the
documentation in previous versions of the module were wrong (it said the
name was  "network" rather than "name.)  I've renamed the parameter in
the documentation of prior versions so ansible-module-validate should no
longer think that this is a new parameter.
2016-12-08 11:24:44 -05:00
h-hirokawa 57921c0b4d Fix azure_rm_virtualmachine (#4174). 2016-12-08 11:24:43 -05:00
Chris Houseknecht c91de38322 Entrypoint fails with 'command not found' error. 2016-12-08 11:24:43 -05:00
Chris Houseknecht 7ffa6a43c5 Add push parameter. Let API handle registry authentication check. 2016-12-08 11:24:43 -05:00
Chris Houseknecht 4002caf60e Fix module failing when no ports are exposed 2016-12-08 11:24:43 -05:00
jjshoe d8b752b3cf Fixed a typo (#4168) 2016-12-08 11:24:43 -05:00
Chris Houseknecht 030dcccad4 Fix multi-interface port binding. 2016-12-08 11:24:43 -05:00
Chris Houseknecht bd3e1c77fe Add cleanup parameter. (#4144) 2016-12-08 11:24:43 -05:00
Chris Houseknecht 7515b2d563 Fix 'all' option for published_ports parameter. 2016-12-08 11:24:43 -05:00
David Shrewsbury 37edf33955 Fix bug in os_router.py when router is not actually updated. (#4107)
The shade update_router() call will return None if the router is
not actually updated. This will cause the module to fail if we
do not protect against that.
2016-12-08 11:24:43 -05:00
Chris Houseknecht dc496ffeb4 Fix purge_networks 2016-12-08 11:24:43 -05:00
Qi Luo b86a229b61 Fix getting actual_stdin_open 2016-12-08 11:24:42 -05:00
Rene Moser 5e3249b244 os_server, doc: add version added for delete_fip
Also see #3509
2016-12-08 11:24:42 -05:00
David Shrewsbury 530fd1365a Allow os_server to delete FIP (#3509)
The os_server module could automatically generate a floating IP for
the user with auto_ip=true, but we didn't allow for this FIP to be
automatically deleted when deleting the instance, which is a bug.
Add a new option called delete_fip that enables this.
2016-12-08 11:24:42 -05:00
Andrei Lukovenko 85bd975238 Bug: invocation with state=absent always leads to (#3051)
[localhost]: FAILED! => {"changed": false, "failed": true, "msg":
"'Domain' object has no attribute 'id'"}

How to reproduce:

- name: create domain
  digital_ocean_domain: state=present name=DOMAIN_NAME ip=DROPLET_IP

- name: destroy domain
  digital_ocean_domain: state=absent name=DOMAIN_NAME

Problem: DigitalOcean API accepts domain name, not record ID
(https://developers.digitalocean.com/documentation/v2/#delete-a-domain)
2016-12-08 11:24:42 -05:00
Adrian Moisey 28716f565c Add default port for aurora (#4102)
If a port isn't specified, it's looked up. The lookup breaks without
this.

Related: https://github.com/ansible/ansible-modules-core/pull/3414
2016-12-08 11:24:42 -05:00
Chris Houseknecht a8059c68d0 Remove object name validation. 2016-12-08 11:24:41 -05:00
Patrick Uiterwijk 6b4359080e nova_compute: indicate argument type (#4070)
Without this, ansible 2.1 will convert some arguments that are
meant to be dict or list type to their str representation.

Signed-off-by: Patrick Uiterwijk <puiterwijk@redhat.com>
2016-12-08 11:24:41 -05:00
Ryan Brown d4cec5ccc1 Remove double-assignment of EC2 parameters (#4081)
The `source_dest_check` and `termination_protection` variables are being
assigned twice in ec2.py, likely due to an incorrect merge somewhere
along the line.
2016-12-08 11:24:40 -05:00
Hrishikesh Barua cf9bfc3459 Fix for #16518 - added missing regions 2016-12-08 11:24:40 -05:00
chouseknecht 9c6da9194a Update and pin to azure-2.0.0rc5 2016-12-08 11:24:40 -05:00
Rodríguez, Jorge 82c26ad2d7 Do not forcibly push when building, either. 2016-12-08 11:24:39 -05:00
Rodríguez, Jorge 89e8787d65 Don't forcibly push loaded images to registry. Fixes #3763 2016-12-08 11:24:39 -05:00
Ryan S. Brown a2e6ac6ca8 IAM group modules need `module` passed
The IAM group modules were not receiving the `module` object, but they
use `module.fail_json()` in their exception handlers. This patch passes
through the module object so the real errors from boto are exposed,
rather than errors about "NoneType has no method `fail_json`".
2016-12-08 11:24:39 -05:00
Graham Goldstein 9632b47a85 Change documented options for os_networks_facts (#3970)
* Change documented options for os_networks_facts

os_network_facts currently lists 'network' as an available option, taking the Name or ID. In Ansible 2.0.2 to 2.2.0, this is not valid. Options 'name' and 'id' should be used instead.

* Update os_networks_facts.py

* Update os_networks_facts.py

Set version_added to the only accepted value

* Update os_networks_facts.py

Removed inappropriate 'ID' parameter
2016-12-08 11:24:39 -05:00
chouseknecht 3d5f84c528 Fix compose_version error. Check has compose before checking version. 2016-12-08 11:24:38 -05:00
chouseknecht 1e9590ab65 Fix index 2016-12-08 11:24:38 -05:00
chouseknecht cc053c45ce Fix ulimit comparison 2016-12-08 11:24:38 -05:00
Mario David 88e4e1af18 add project to os_router (#3869)
* add project to os_router

* version_added fix

* correct place of version_added

* remove extraneous else

* * add shade version dependency check
* option project only on router creation

* * fix shade minimal version
* remove pop of option project

* * fix square brackets
* delete router by router_id
2016-12-08 11:24:38 -05:00
Javier M. Mellid 49f9404cd2 Add s3_url requirement in doc when rgw support is enabled in s3.py
Signed-off-by: Javier M. Mellid <jmunhoz@igalia.com>
2016-12-08 11:24:38 -05:00
Javier M. Mellid 6346cad9d0 Add proper version_added for rgw option in s3.py
Signed-off-by: Javier M. Mellid <jmunhoz@igalia.com>
2016-12-08 11:24:38 -05:00
Javier M. Mellid 0b156aae16 Add Ceph RGW S3 compatibility
Ceph Object Gateway (Ceph RGW) is an object storage interface built on top of
librados to provide applications with a RESTful gateway to Ceph Storage
Clusters:

http://docs.ceph.com/docs/master/radosgw/

This patch adds the required bits to use the RGW S3 RESTful API properly.

Signed-off-by: Javier M. Mellid <jmunhoz@igalia.com>
2016-12-08 11:24:38 -05:00
Adam Butler 0c7ec1e860 Fixes incorrect key name protocols -> protocol (#3963) 2016-12-08 11:24:38 -05:00
Hagen Kuehn 320aea77c6 fixed unknown type <type 'list'> error (#3959) 2016-12-08 11:24:37 -05:00
chouseknecht 16e7dc4e2e Remove dns from container create parameters. 2016-12-08 11:24:37 -05:00
chouseknecht 4d51a51ac3 Fix #3945 docker_container detach not waiting on container to execute. 2016-12-08 11:24:37 -05:00
Toshio Kuratomi 53a22ce93a Finish python3 syntax compilation fixing for core repo 2016-12-08 11:24:37 -05:00
chouseknecht 82436d5519 Fix #3941 2016-12-08 11:24:37 -05:00
Stefan Hajnoczi 7c4a469174 docker_service: make PyYAML requirement explicit
The "Developing Modules" documentation states:

  Include a minimum of dependencies if possible. If there are
  dependencies, document them at the top of the module file, and have
  the module raise JSON error messages when the import fails.

When docker_service runs on a remote host without PyYAML it crashes with
ImportError.

This patch raises a JSON error message when import fails, but only if
the PyYAML module is actually used.  It's only needed when the
"definition" parameter is given.

Signed-off-by: Stefan Hajnoczi <stefanha@gmail.com>
2016-12-08 11:24:37 -05:00
chouseknecht 617c230b62 Fix #16211 - only stop/kill running containers 2016-12-08 11:24:36 -05:00
Chris Houseknecht b5820c7398 Fix #3906 - Enforce required minimum compose version. (#3925)
* Fix #3906 - Require minimum compose version.

* Fix typo in message text.
2016-12-08 11:24:36 -05:00
Bradley Phipps 17985f9917 added missing colons to documentation (#3913) 2016-12-08 11:24:36 -05:00
Stefan Hajnoczi 38013de366 Stream image data in load_image() to avoid out-of-memory
Reading the entire tar file into memory can result in out-of-memory
conditions such as this traceback:

Traceback (most recent call last):
  File "/tmp/ansible_YELTSu/ansible_module_docker_image.py", line 486, in load_image
    self.client.load_image(image_data)
  File "/usr/local/lib/python2.7/dist-packages/docker/api/image.py", line 147, in load_image
    res = self._post(self._url("/images/load"), data=data)
  ...
  File "/usr/lib/python2.7/httplib.py", line 997, in endheaders
    self._send_output(message_body)
  File "/usr/lib/python2.7/httplib.py", line 848, in _send_output
    msg += message_body
MemoryError

Luckily docker-py's load_image(), which calls requests post(), accepts a
file-like object instead of a string.  Pass in the file object to avoid
reading the full file into memory.  This allows larger tar files to load
succesfully.

Signed-off-by: Stefan Hajnoczi <stefanha@gmail.com>
2016-12-08 11:24:36 -05:00
Vince v. Oosten 42a38f9141 move environment variable gathering to end of __init__() (#3890)
* This moves the lines in the code that parse the `env` and `env_file` options for docker to the end of the `__init__()` function.
This is needed because the `_check_capabilites` function needs both a working `self.client` and a proper `self.docker_py_versioninfo`.
`_check_capabilities` is used by `ensure_capabilities` which is, in turn, used by `get_environment`

This means that before this commit, the environment variables could not be loaded because both `self.client` and `self.docker_py_versioninfo` were not set at that time.

This commit fixes that by putting the environment variable parsing after those two.

* This moves the lines in the code that parse the `env` and `env_file` options for docker to the end of the `__init__()` function.
This is needed because the `_check_capabilites` function needs both a working `self.client` and a proper `self.docker_py_versioninfo`.
`_check_capabilities` is used by `ensure_capabilities` which is, in turn, used by `get_environment`

This means that before this commit, the environment variables could not be loaded because both `self.client` and `self.docker_py_versioninfo` were not set at that time.

This commit fixes that by putting the environment variable parsing after those two.
2016-12-08 11:24:36 -05:00
Matt Davis 81e7720f62 Iam trust policy (#3885)
* added support for trust policies

* added version_added to new params in DOC string

* update version_added on new iam args to 2.2
2016-12-08 11:24:36 -05:00
mansunkuo be6ce922a6 Add an example to delete Route53 alias record set (#3834) 2016-12-08 11:24:35 -05:00
chouseknecht fc486824b8 Fix issue #3866 2016-12-08 11:24:35 -05:00
nitzmahone 570defc6d8 correct gs_storage docs to match reality 2016-12-08 11:24:35 -05:00
Elena Washington cf31b4d8b5 Add support for PostgreSQL 9.5 in rds_param_group (fix for #3846) 2016-12-08 11:24:35 -05:00
Gilles Gagniard bbfea348df better error message if libcloud is not recent enough to use gce subnetworks 2016-12-08 11:24:34 -05:00
Jonathan A. Sternberg 97917121a6 Paginate the results from `boto.iam`
The default pagination is every 100 items with a maximum of 1000 from
Amazon. This properly uses the marker returned by Amazon to concatenate
the various pages from the results.

This fixes #2440.
2016-12-08 11:24:34 -05:00
Gilles Gagniard 152a713fd3 fix documentation to reflect subnetwork option is new in ansible 2.2 2016-12-08 11:24:34 -05:00
Gilles Gagniard 3404c0891b Initial support for specifying in which subnetwork a gce instance should be created. This is required for non-legacy networks. 2016-12-08 11:24:34 -05:00
pic 8494b0af4b fix #3528 : dns type 2016-12-08 11:24:34 -05:00
Michael Pappas 585003c546 Prevent ec2group from deleting sgs during check_mode runs 2016-12-08 11:24:34 -05:00
@ 7e4b1ebff5 Fixing Rackspace compile time errors irt exception handling for Python 3 (#3849) 2016-12-08 11:24:34 -05:00
@ 7960e99310 Fixing open stack compile time errors irt exception handling for Python 3 (#3848) 2016-12-08 11:24:34 -05:00
@ 13bebda244 Fixing gce compile time errors irt exception handling for Python 3 (#3845) 2016-12-08 11:24:34 -05:00
chouseknecht 950931144f Fix 3857 name regex 2016-12-08 11:24:34 -05:00
chouseknecht 9549c66a56 Fix #147 automatically expose published ports 2016-12-08 11:24:34 -05:00
chouseknecht 17fc0f11db Remove unused method in ContainerManager 2016-12-08 11:24:34 -05:00
@ c3aab8ddcf Fixing compile time error exception handling for python 3. (#3843) 2016-12-08 11:24:34 -05:00
Mike Mars e2dbd0f445 Fixing Docker compile time errors irt exception handling for Python 3 2016-12-08 11:24:34 -05:00
@ 3fa745eef9 Fixing error exception handling for python3. Does not need to be compa… (#3840)
* Fixing error exception handling for python. Does not need to be compatible with Python2.4 b/c boto is Python 2.6 and above.

* Fixing error exception handling for python. Does not need to be compatible with Python2.4 b/c boto is Python 2.6 and above.

* Fixing compile time errors IRT error exception handling for Python 3.5.
This does not need to be compatible with Python2.4 b/c Boto is Python 2.6 and above.
2016-12-08 11:24:34 -05:00
@ 1573066ec1 Fixing error exception handling for python. Does not need to be compatible with Python2.4 b/c boto is Python 2.6 and above. (#3839) 2016-12-08 11:24:33 -05:00
chouseknecht ec9f56d8e0 Fix #3822 stop container 2016-12-08 11:24:33 -05:00
chouseknecht c9e4955d38 Remove registery option per #3824. 2016-12-08 11:24:33 -05:00
chouseknecht be2d32f04d Fix upate typo and expected volume compare. 2016-12-08 11:24:33 -05:00
chouseknecht 9dd95efe76 Fixed binds and volumes. Now recognizes bound vs unbound as well as named volumes. 2016-12-08 11:24:33 -05:00
chouseknecht abbddbde49 Fix missing ansible_facts. 2016-12-08 11:24:33 -05:00
Jirayut 'Dear' Nimsaeng d373e0a7c4 Fix volume to support not binding volumes to host 2016-12-08 11:24:33 -05:00
Anton Simernia 1aa1b617f5 Update gc_storage.py (#3802) 2016-12-08 11:24:33 -05:00
chouseknecht 96192ead02 Remove debug/register from examples. 2016-12-08 11:24:33 -05:00
chouseknecht 3d0d14c5ff Fix network comparison. Fix handling of links. Updated doc strings. Added more examples. 2016-12-08 11:24:33 -05:00
chouseknecht a4bd558240 Set version added to 2.2 so that tests pass 2016-12-08 11:24:32 -05:00
chouseknecht e398efb04f For new options move vesion_added to 2.1.1 2016-12-08 11:24:32 -05:00
chouseknecht c8f63e867a Fixed bug in _get_network_id 2016-12-08 11:24:32 -05:00
chouseknecht a9ddb5023d Fix doc strings. 2016-12-08 11:24:32 -05:00
chouseknecht 1d327a23cd Fixed issues post testing. 2016-12-08 11:24:32 -05:00
chouseknecht 39bfb136a7 First pass at implementing networks parameter. Also added purge_networks option to remove container from networks not included in networks param. 2016-12-08 11:24:32 -05:00
chouseknecht f3c33ee35f Fix for 3768 - adding support for env_file 2016-12-08 11:24:32 -05:00
chouseknecht 2016911e64 Check self.parameters.env exists. 2016-12-08 11:24:32 -05:00
chouseknecht bc665fca9c Fix for issue #3775 - env config comparison 2016-12-08 11:24:32 -05:00
chouseknecht 65e71d8960 Update restart_policy doc strings. 2016-12-08 11:24:32 -05:00