Commit graph

16020 commits

Author SHA1 Message Date
Justin Menga
8dae2ea869 Cast CloudFormation parameter values to string - fixes #23593 (#24182) 2017-05-15 13:10:29 -04:00
Abhijeet Kasurde
e9672748cc Add archive option in git plugin (#23332)
* Add archive option in git plugin

This fix will add archive option in git plugin

Fixes https://github.com/ansible/ansible/issues/22943

Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>

* Update code as per code review comments

Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
2017-05-15 10:46:25 -04:00
Monty Taylor
91969b8c67 Actually protect against use_default_subnetpool
We have a protection against a user setting use_default_subnetpool in
their playbook - but then we sure do pass the kwarg anyway. Maybe let's
not do that.
2017-05-15 09:41:38 -04:00
Abhijeet Kasurde
764b4b20ec Fix UnboundLocalError in basic.py
* Fix for UnboundLocalError while accessing deprecations
  in result
* Add Unit test

Fixes #24592

Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
2017-05-15 09:32:17 -04:00
Ryan S. Brown
6141818110 [cloud] Document stage option on serverless module 2017-05-15 07:15:01 -04:00
René Moser
3ca3163af1 cloudstack: add new module cs_network_acl (#24609) 2017-05-15 10:57:38 +02:00
Jonathan Davila
6410e13903 Fix bug in iam_role (#22618) 2017-05-14 17:29:44 -04:00
Mohammed Naser
f9b4499082 Set facts type to dict
With newer versions of ansible, module arguments are assumed to
be strings unless otherwise specified.  Our 'facts' argument is
expected to be a dictionary, so tell ansible that.

Without this, the argument will arrive as a string and be written
to the facter file inside string quotes.  Facter will produce the
following error:

  undefined method `each' for #<String:0x000000016ee640>

This was originally fixed and found in the Ansible Puppet role which
is maintained by the OpenStack infrastructure team.

8d0f0bfd0a
2017-05-14 14:10:38 -04:00
René Moser
19e7abb971 cloudstack: return known used resources in fail_json (#24575) 2017-05-13 14:31:51 +02:00
Toshio Kuratomi
84a59e472b Be explicit about pickle protocol and encoding (#24454)
On Python3 and Python2 use pickle slightly differently so we need to be
explicit about some things.

If pickles could be shared between python2 and python3, as in
ansible-connection and the pickle cache, we need to specify the protocol
to use when dumping and the encoding to use for byte strings when
loading.

The dumping protocol needs to be no higher than 2 as python-2 only
supports up to protocol 2.  The encoding should usually be 'bytes' so
that python2 str type becomes python3 bytes type.  However, doing this
means that we must make sure that the objects being serialized properly
make their strings into text strings except when they're supposed to be
bytes.  If strings are improperly byte strings, they may cause
tracebacks on the receiving end
2017-05-12 18:04:48 -07:00
Sloane Hertel
822fcc566e [cloud] Stop ec2_group module from authorizing duplicate rules (#24528) 2017-05-12 14:54:25 -04:00
Kevin Howell
65f0668475 Add pool_ids option to redhat_subscription (#23266) 2017-05-12 14:10:41 -04:00
Chris Alfonso
8c0faa2ebf Revert "[WIP]Fortios address group" (#24549)
* Revert "Add check for processor_core value"

This reverts commit 8ad182059d.

* Revert "Fix for persistent connection plugin on Python3 (#24431)"

This reverts commit d834412ead.

* Revert "removing folded style formatting for synopsis (#22746)"

This reverts commit e539726543.

* Revert "[WIP]Fortios address group (#21831)"

This reverts commit f2dbf512cb.
2017-05-12 10:56:39 -06:00
Abhijeet Kasurde
8ad182059d Add check for processor_core value
Fixes #21893

Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
2017-05-12 12:30:05 -04:00
Toshio Kuratomi
d834412ead Fix for persistent connection plugin on Python3 (#24431)
Fix for persistent connection plugin on Python3.  Note that fixes are also needed to each terminal plugin.  This PR only fixes the ios terminal (as proof that this approach is workable.)  Future PRs can address the other terminal types.

* On Python3, pickle needs to work with byte strings, not text strings.
* Set the pickle protocol version to 0 because we're using a pty to feed data to the connection plugin.  A pty can't have control characters.  So we have to send ascii only.  That means
only using protocol=0 for pickling the data.
* ansible-connection isn't being used with py3 in the bug but it needs
several changes to work with python3.
* In python3, closing the pty too early causes no data to be sent.  So
leave stdin open until after we finish with the ansible-connection
process.
* Fix typo using traceback.format_exc()
* Cleanup unnecessary StringIO, BytesIO, and to_bytes calls
* Modify the network_cli and terminal plugins for py3 compat.  Lots of mixing of text and byte strings that needs to be straightened out to be compatible with python3
* Documentation for the bytes<=>text strategy for terminal plugins
* Update unittests for more bytes-oriented internals

Fixes #24355
2017-05-12 09:13:51 -07:00
Eric Beahan
e539726543 removing folded style formatting for synopsis (#22746) 2017-05-12 10:00:19 -06:00
Benjamin Jolivot
f2dbf512cb [WIP]Fortios address group (#21831)
* New module fortios_address_group

* Fix issue when fortigate don't contain any address group

* Add alias & change member from str to list type

* Fix pep8

* Fix aliases format in doc

* Fix pep8

* Remove duplicate arg spec with module_utils/fortios.py

* Change string format for better compat + better exception catching + cosmetic changes

* Use set, specify exception, RE pattern one time...

* fix pep8
2017-05-12 09:54:58 -06:00
Ilya Drey
62b8813873 Improving nxos_ip_interface module (#21353)
* Improving of nxos_ip_interface module

Added features:

  * Route tags for an IP address at interface level with 'tag' option
  * Support of IPv4 secondary addresses if option 'allow_secondary' is
true (false by default). If option 'allow_secondary' is true primary
IPv4 address will be replaced

All features support NXAPI and CLI transport, but only with text/raw
output. Currently not possible to get route tags for secondary IPv4/IPv6
addresses from JSON output.

Other changes:
  * Module return state 'changed' only when configuration commands were
executed
  * Module result includes multiple prefixes if IPv4 addresses were
found

* Fix PEP8 issues

* Addition fix of PEP8 issues

* Remove unused variable from main()

* Fix "proposed" sample in RETURN variable

* Fix "existing" sample in RETURN variable

* Update RETURN variable

Add 'secondary' for every element of 'addresses' list.

* Restore old version number

* Added exception when ipaddress module is imported

* DOCUMENTATION string was updated

  * Added 'version_added' for new features
  * Added 'requirements' for module

* Added compatibility with latest commit in devel branch

* DOCUMENTATION was fixed
* Improve changes of route tag for existing ip addresses
* Added compatibility with core code

* Fixed mistypes in the DOCUMENTATION variable

* argument_spec fixed

allow_secondary argument type was changed according to allowed choices.
2017-05-12 11:45:44 -04:00
Gabriele
78ed0cadea Fixing nxos_ntp (#20651)
* Fixing nxos_ntp

* Fixing style issues
2017-05-12 11:36:44 -04:00
Jan-Piet Mens
0e0e5097a9 Optionally return raw data from URL lookup using split_lines=False 2017-05-12 11:02:49 -04:00
Sloane Hertel
91b87d4cbb dict.values() was a list python2 but in python3 it's a view (#24504) 2017-05-12 08:48:16 -04:00
Kai Xia(夏恺)
97b0448f0b fix typo. (#24531)
Signed-off-by: Kai Xia(夏恺) <xiaket@gmail.com>
2017-05-12 08:42:52 -04:00
Toshio Kuratomi
548cacdf6a Fix template not showing a diff with a directory
Template can take a directory as the destination.  When that's the case,
we need to diff between the source and the file inside of the directory.
That happened when the directory was specified with a trailing slash but
not when it was specified on its own.  This change fixes that.

Fixes #24413
2017-05-11 20:37:31 -07:00
Toshio Kuratomi
16325f6f15 Fix pam_limits writing text to a file opened in binary mode
Fixes #24392
2017-05-11 17:17:12 -07:00
rodolfojcj
a47fbba8ae Little documentation fix (#24522)
Added the 'reset_connection' option to the available choices
2017-05-11 15:10:20 -07:00
James Cammarata
78478e80ea Avoid default serialization of classes in dump_attrs
For playbook base objects, when dumping attributes via dump_attrs() an
attribute like loop_control is a class. Using the default serialization
for these is slow and consumes a lot of memory. Since LoopControl is also
based on the Base class, we can use serialize() instead and save a lot of
resources.

This also adds a from_attrs() complimentary method to nicely turn the
dumped attrs back into proper field attributes.

Fixes #23579
2017-05-11 16:28:07 -05:00
taksekine
b04df23da2 fix #24429 (#24491) 2017-05-11 13:59:39 -07:00
Brian Coca
c50cf22d52 deal with null/none connections
fixes #23621
pushed 'connection resolution' to play_context
override fieldattribute getter
2017-05-11 15:46:14 -04:00
Tom Melendez
4a5cf0b5c1 [GCE] [GCP] UrlMap module (#24422)
* [GCP] UrlMap module

This module provides support for UrlMaps on Google Cloud Platform.  UrlMaps allow users to segment requests by hostname and path and direct those requests to Backend Services.

UrlMaps are a powerful and necessary part of HTTP(S) Global Load Balancing on Google Cloud Platform.

UrlMap takes advantage of the python-api so the appropriate infrastructure has been added to module_utils.

More about UrlMaps can be found at:
https://cloud.google.com/compute/docs/load-balancing/http/url-map

UrlMap API:
https://cloud.google.com/compute/docs/reference/latest/

Google Cloud Platform HTTP(S) Cross-Region Load Balancer:
https://cloud.google.com/compute/docs/load-balancing/http/

* updated documentation, remmoved parens

* fixed tabs
2017-05-11 13:02:32 -04:00
Abhijeet Kasurde
728d3e6c84 Pep8 fixes for web_infra/ansible_tower (#24479)
Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
2017-05-11 11:26:36 -05:00
Dylan Silva
fc3cc73b73 Downgrading module from core to community (#24463) 2017-05-11 08:05:49 -07:00
wiso
bb90f5d220 netconf_config: support new src attribute (new Action Plugin) (#24337)
* Create netconf_config.py

To support new attribute 'src' for the netconf_config module.
Cross-check with #24323

* Update netconf_config.py

* Update netconf_config.py
2017-05-11 18:43:44 +05:30
Jon Hadfield
eb4cc31ae5 [cloud] migrate ec2_asg to boto3 and support application ELB target groups. (#19667)
* switch to boto3 and add support for application ELBs with target groups.

* use py23 compatible dict iterator.

* removing commented out fail_json calls

utilize sets to simplify logic

remove setting a redundant variable

add bounds checking in two places

add AWSRetry decorator - do we want this for other functions too?

change xrange to range so python3 doesn't fail

remove sorting lists of dicts; in python2 this returns None, in python3 this fails

* remove error variable from traceback.format_exc

* Remove boto2-style calls brought in by rebase

Old boto-style calls to `as_group` attributes break in boto3

Also remove module from legacy-PEP8 list

* Add  parameter to target_group_arn option

* Fix HAS_BOTO3 check

* use tags.items() instead of iteritems

* import botocore

* Fixed bugs in deleting autoscaling groups

* make changes in deleting autoscaling groups pep8

* more pep8

* fix version

* fix bugs so local integration tests run

* fix launch config check

* reflect changed status for ASG updates

* Fix existing exception handling and use traceback.

Fix imports

* line length

* Fix notification setup

* Fix mutually exclusive arguments
Only one of the AvailabilityZones and VPCZoneIdentifier arguments should be provided to the CreateAutoScalingGroup call.

* Allow desired_capacity, min_size, max_size, launch_config_name to be derived from the existing ASG if not specified

Remove code updating dict after ASG already uses it
2017-05-11 09:08:19 -04:00
Abhijeet Kasurde
3d51081a59 Refactor nxos_reboot module (#24484)
Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
2017-05-11 13:14:31 +05:30
Rob
fd1debb869 Feature/aws helper function for tags (#23387)
* Add new helper function for comparing AWS tag key pair dicts. Also modify boto3_tag_list_to_ansible_dict function to be more generic when looking for key names because AWS sometimes uses 'Key', sometimes 'TagKey' and who knows what the future holds! Fixed modules to work with changes.

* Review changes

* Add some more doc to GUIDELINES for tags and fix var name for snaked values in ec2_group_facts
2017-05-11 07:39:51 +01:00
Trishna Guha
b2a2f69a6e nxos_vrf_af fix and unit test (#24399)
* nxos_vrf_af fix and unit test

Signed-off-by: Trishna Guha <trishnaguha17@gmail.com>

* ansibot told me to do this

* use sorted() as the test list elements differ in order for python2.x and 3.x
2017-05-11 10:54:47 +05:30
Trishna Guha
62eafa8837 fixes nxos_evpn_vni and unittest (#24372)
* fixes nxos_evpn_vni

Signed-off-by: Trishna Guha <trishnaguha17@gmail.com>

* fixes pep8 issue and syntax error

* ansibot tole me to do this

* Unit test
2017-05-11 10:54:05 +05:30
Dag Wieers
748f27e597 expect: Add a pointer to the shell/script modules
This PR also includes:
- DOCUMENTATION and EXAMPLES cleanup

This fixes #21335
2017-05-10 20:37:36 -07:00
Dag Wieers
e855274dc8 win_psexec: Enable -nobanner option by default (#23422)
* win_psexec: Enable -nobanner option by default

PR also includes:
- Option `nobanner:` to remove this flag
- Improvements to Examples
- Improvement to Return Value
- Add types to all parameters now
- Add (limited) integration tests

* Move sysinternals into C:\Windows\Temp
2017-05-10 16:10:33 -07:00
Nathaniel Case
09b2964dee nxos_bgp_af updates (#24171)
* update docs
* clean up nxos-bgp_af
* Remove useless params from bgp_af
* Add bgp_af tests
2017-05-10 16:12:00 -04:00
Abhijeet Kasurde
2f26c5285a Refactor nxos_file_copy module (#24314)
Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
2017-05-10 22:15:42 +05:30
Ondra Machacek
a5020a40e5 Minor fixes for oVirt modules (#23452)
* cloud: ovirt: only image disk can be sparsified

* cloud: ovirt: add post-copy scheduling policy
2017-05-10 09:15:47 -04:00
René Moser
2ef6713abb cloudstack: new module cs_vpn_gateway (#23954)
* cloudstack: new module cs_vpn_gateway
* add integration tests for cs_vpn_gateway
2017-05-10 14:55:14 +02:00
Matt Martz
3324d0a4b0 Support auto_remove in docker_container (#22929)
* Support auto_remove in docker_container

* Fail if not docker>=2 and auto_remove=True, don't set auto_remove in host_config if not docker>=2

* Make quoting more readable in ansible errors
2017-05-09 16:19:27 -04:00
wiso
0a22dbd9d8 Update netconf_config.py (#24323)
* Update netconf_config.py

Implementation proposal for feature request #24220

* Update netconf_config.py

fixed pep8
added code proposal for #24221

* Update netconf_config.py

correct more pep8 related things
add some cosmetic changes
2017-05-09 16:04:59 -04:00
Sloane Hertel
2618e6d516 ec2_elb_lb: allow elb scheme to be updated by restarting the resource - fixes #19116 (#22916)
* allow elb scheme to be updated by restarting the resource

use ensure_gone and require wait option

* fix pep8

* fix yaml

* requested changes

* fix fail_json
2017-05-09 14:01:37 -04:00
Dag Wieers
bc806ff479 Windows: Small fix to Add-Warning and Add-DeprecationWarning (#23520)
Simplified the logic, and fix the issue of having a nested list as
entry.

Also indicate that we deliberately want to retain $null values
(and i.e. do not want them to be turned into a boolean).
2017-05-09 09:18:37 -07:00
Ganesh Nalawade
5b3ea6562b Add junos integration test (#24404) 2017-05-09 18:41:48 +05:30
Feike Steenbergen
c5adf08c40 Reference correct variable and key for role expiry (#23397)
Previously, this module could throw the following error message:
    NameError: global name 'current_roles_attrs' is not defined

The referencing key should also match the name of the column, which is
rolvaliduntil, not rol_valid_until
2017-05-09 14:03:22 +01:00
Abhijeet Kasurde
a255cfd22a Check login_token for user before any operations (#23600)
Fix adds extra check if user is authorized or not while
using login_token.

Fixes https://github.com/ansible/ansible/issues/23033

Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
2017-05-09 13:52:13 +01:00