Commit graph

15197 commits

Author SHA1 Message Date
Sloane Hertel
f775996209 add 'version_added' field for environment_variables option in lambda.py (#21500)
* Add 'version_added' field for environment_variables option (version_added: "2.3")
2017-02-15 18:52:48 -05:00
Abdoul Bah
c22fbdc831 resolve #21056 - Add support for full cloning a Qemu VM. Fix some issues. Update doc (#21225)
* resolve #21056 - Add support for full cloning. Fix some issues. Update doc

* Fix condition and update doc. Fixes #28585

* Using built-in helper for argspec, revert ansible metadata, add more control and remove type in documentation

* PEP8 style compliance
2017-02-15 22:51:46 +00:00
Tim Rupp
7869b543fa Changes attribute to be public (#21490)
eom
2017-02-15 22:48:31 +00:00
Benjamin JOLIVOT
9baf95bcc4 Add status_code & failed:false when status==200 (#21457)
* Add status_code & failed:false when status==200

* remove failed=false, it's broking tests
2017-02-15 14:30:06 -08:00
James Cammarata
eec88b63c2 Fix bug introduced in 0df3767 regarding undefined entries in HostVars
Fixes #21084
2017-02-15 16:22:31 -06:00
Matt Martz
78a000502e YAML fixes for examples in additional modules 2017-02-15 13:01:43 -08:00
Matt Martz
7c00346714 Validate EXAMPLES as YAML 2017-02-15 13:01:43 -08:00
Michael Scherer
6fae1d2bbf Make password lookup treat /dev/null as a special case
I have from time to time a need of random password without
wanting to write them down (one example is mailman list creation,
that requires a password to be given to be sent to the list owner).

But using /dev/null do not return null, but the empty string, which
doesn't generate a password at all and so do not achieve my use case.
2017-02-15 12:15:09 -08:00
Will Thames
103ede26df Ensure ssh hostkey checks respect server port (#20840)
* Add tests for `get_fqdn_and_port` method.

Currently tests verify original behavior - returning default `ssh-keyscan` port
Add test around `add_host_key` to verify underlying command arguments
Add some new expectations for `get_fqdn_and_port`
Test that non-standard port is passed to `ssh-keyscan` command

* Ensure ssh hostkey checks respect server port

ssh-keyscan will default to getting the host key for port 22.
If the ssh service is running on a different port, ssh-keyscan
will need to know this.

Tidy up minor flake8 issues

* Update known_hosts tests for port being None

Ensure that git urls don't try and set port when a path
is specified

Update known_hosts tests to meet flake8

* Fix stdin swap context for test_known_hosts

Move test_known_hosts from under basic, as it is its own library.
Remove module_utils.known_hosts from pep8 legacy files list
2017-02-15 11:47:57 -08:00
Matt Clay
09f4242ce4 Fix junit callback handling of surrogate escapes. 2017-02-15 10:51:55 -08:00
Toshio Kuratomi
99fd2328af Fix hash filter for non-ascii strings and Python3
hashlib hashes operate on byte strings.  When given a text string on
Python3, hashlib backtraces.  When given a text string on Python2,
hashlib will backtrace if the string contains non-ascii characters.
Encode the text string to utf-8 prior to hashing to avoid this problem.

Fixes #21452
2017-02-15 10:50:10 -08:00
Wilfrido Vidana
e89259dbd0 Fixes #19835: enable role attribute change when not changing password (#19834)
Fixes #19835
2017-02-15 13:47:15 -05:00
Adrian Likins
106439e470 Handle sysctl.conf files that use ';' for comments (#20576)
'#' and ';' are both valid comment chars for sysctl.conf files
according to the 'man sysctl.conf':

  "Lines which begin with a # or ; are considered comments and ignored."

Fixes #20569
2017-02-15 13:37:09 -05:00
Daniel O'Brien
320c791cfb Adding more functionality for Linode cloud module 2017-02-15 10:26:40 -08:00
Peter Sprygada
48b02336ab code clean of old code from network modules updates (#21469)
* removes unused code
* removes module_utils/local.py
* removes plugins/action/network.py
* removes action_handler from connection plugins
* removes code to use action_handler in task_executor
* updates action plugins to subclass from normal
2017-02-15 12:46:30 -05:00
Peter Sprygada
2d14cdc5ac fixes broken run_commands() method (#21478) 2017-02-15 12:12:59 -05:00
Wayne Witzel III
f98d41c121 Ansible Tower user and credential module (#21020)
* rename tower config module parameters to avoid conflicts

* add Ansible Tower user module

* add Ansible Tower credential module

* remove errant hash from interpreter line

* friendlier error messages

* Update tower_verify_ssl defaults and module examples

* Update tower_verify_ssl default documentation

* Tower expects satellite6 not foreman
2017-02-15 16:59:03 +00:00
Tim Rupp
2a9778e320 Change the f5 modules to use f5_utils file (#21466)
The f5 module utils were using a file name that appeared to
conflict with the f5 python SDK's namespace. This patch just changes
the name of the included class to be f5_utils to avoid the issue
of namespace collisions
2017-02-15 16:51:13 +00:00
Peter Sprygada
21d993a4b8 refactors nxos module to use persistent connections (#21470)
This completes the refactor of the nxos modules to use the persistent
connection.  It also updates all of the nxos modules to use the
new connection module and preserves use of nxapi as well.
2017-02-15 11:43:09 -05:00
Peter Sprygada
eb1453a366 updates iosxr modules to support socket (#21231)
* updates all iosxr modules to support persistent socket
* adds iosxr action plugin to connect to device
* adds exec_command() to iosxr shared module
* fixes iosxr_config and iosxr_template local action
* update all unit test cases
* adds base test module for iosxr module testing
2017-02-15 10:47:02 -05:00
Will Thames
635e3fe9ee [cloud] ec2_vpc_peer should remove peering connections (#20113)
Don't try to create tags on a vpc that you've just removed.

Avoids

```
 "msg": "An error occurred (InvalidParameterValue) when calling the CreateTags operation: You must specify one or more tags to create"
```

Although not quite sure why the `create_tags` was being called
as `module.params.get('tags')` *should* have returned `None`.
2017-02-15 10:21:47 -05:00
Dag Wieers
39a8638ec0 Advanced example using shell with other executable (#21462)
The shell module is quite versatile in its use.
2017-02-15 14:52:31 +00:00
Ondra Machacek
34da024e06 cloud: ovirt: add requirments to ovirt_auth module (#21460) 2017-02-15 13:59:27 +00:00
Peter Sprygada
381a045089 updates network local actions to check for connection=local (#21437)
* updates vyos local action
* updates ios local action
2017-02-15 11:27:54 +00:00
John R Barker
86e2feffc1 archive docs formatting (#21454) 2017-02-15 11:24:05 +00:00
Alexander Turner
dc5d92eac2 Added Ordnance Module (#21447)
* Added Ordnance network module.

* Tidied up code base as per PR20436

* Whitespace blocking PEP8 test

* Removed acciental addition to VERSION

* Removed acciental addition to VERSION

* Documentation YAML issues

* removed force arg (depreciated)

* rectified broken import

* Ordnance module init

* added ordnance helper
2017-02-15 10:30:45 +00:00
Peter Sprygada
47141b8426 fixes minor issue with strict diff of network config (#21436)
strips leading and trailing spaces for line comparision to prevent
fails positiives
2017-02-14 20:12:49 -05:00
Peter Sprygada
8e4f0ec162 checks connection type is local and fails if not in eos (#21429) 2017-02-14 18:42:15 -05:00
Tim Rupp
6fc989a902 Adds a factory function for getting REST api tools (#21423)
I plan on converting most all f5 modules to use the rest api, so
this is part of that conversion. it adds a factory method to get
the various rest management root apis provided in the f5 sdk
2017-02-14 22:31:11 +00:00
Gabriele
db786fc211 Fixing nxos_portchannel bug caused by wrong regex (#20850) 2017-02-14 16:08:43 -05:00
Sumit Kumar
f3fe1eef03 Add NetApp ONTAP aggregate module (#20712)
* Add NetApp ONTAP Aggregate module

* Update fail_json message

* Make changes to adhere to community guidelines
2017-02-14 16:01:35 -05:00
Sumit Kumar
2c81e05baa Add NetApp ONTAP user module (#20723)
* Add NetApp ONTAP user module

* Make changes to adhere to community guidelines

* Fix PEP8 issue
2017-02-14 16:01:16 -05:00
Sumit Kumar
97b238b6c6 Add NetApp ONTAP license module (#20715)
* Add NetApp ONTAP license module

* Make changes to adhere to community guidelines
2017-02-14 16:01:07 -05:00
Sumit Kumar
774277ceb7 Add NetApp ONTAP SVM module (#20670)
* Add NetApp ONTAP SVM module

* Update fail_json message

* Make changes to adhere to community guidelines
2017-02-14 16:00:14 -05:00
Sumit Kumar
236db1cf66 Add NetApp ONTAP LUN module (#20716)
* Add NetApp ONTAP LUN module

* Make changes to adhere to community guidelines
2017-02-14 15:57:14 -05:00
Sumit Kumar
3de8419261 Add NetApp ONTAP qtree module (#20719)
* Add NetApp ONTAP tree module

* Make changes to adhere to community guidelines
2017-02-14 15:55:54 -05:00
Sumit Kumar
c50e286ab8 Add NetApp ONTAP user-role module (#20722)
* Add NetApp ONTAP user-role module

* Make changes to adhere to community guidelines
2017-02-14 15:55:24 -05:00
Michael Price
56dd5a702d Refactor E-Series AMG module to use module_utils (#20871)
* Refactor E-Series AMG module to use module_utils

Refactor the NetApp E-Series module to utlize the common module_utils
and doc_fragments.

* Resolve a PEP8 issue with a missing newline

* Resolve compatibility issue with json import
2017-02-14 15:53:18 -05:00
Dylan Silva
53c73ae836 Modified openswitch module metadata from core to community (#21355) 2017-02-14 15:51:51 -05:00
Sumit Kumar
026e2f3d50 Add NetApp ONTAP volume module (#20668)
* Add NetApp ONTAP volume module
* Update fail_json message
* Make changes to adhere to community guidelines.
* Make requested changes
2017-02-14 15:46:09 -05:00
Tim Rupp
22926088a0 Removes expanduser in favor of type 'path'
Removes the usage of expanduser because it is automatically handed
by specifying a type of 'path'. Related to #12263
2017-02-14 15:43:53 -05:00
s-hertel
c5446d95cc [cloud] New module: AWS elasticache_parameter_group for modifying Elasticache cluster settings (#21023)
Added a new module for ElastiCache. Allows users to create/modify/delete/reset cache parameter groups.
2017-02-14 15:32:42 -05:00
Brian Coca
258316ca72 user older functions as getres* are >=2.7 2017-02-14 15:05:25 -05:00
Peter Sprygada
b0c01bbb82 updates network_common lib (#21306)
* removes connection functions refactored into connection
* updates ComplexDict and ComplexList objects to use with AnsibleModule
* updates modules to add new argument to ComplexList & ComplexDict
2017-02-14 14:38:30 -05:00
Brian Coca
009ac075b7 expanded user facts to effective/real/saved 2017-02-14 14:37:31 -05:00
caio2k
2505d56401 removed deprecated HEADER_* from examples (#21395)
Even though the documentation says that HEADER_* parameter is deprecated, the examples still show its usage.
2017-02-14 14:31:12 -05:00
Tim Rupp
5f01cd4402 [cloud][serverless] Removes manual expanduser call in favor of type path (#21418)
Removes the usage of expanduser because it is handled automatically
by type 'path'. Related to #12263
2017-02-14 14:29:43 -05:00
Peter Sprygada
e1a2c6e1d3 roll up of fixes for eos modules (#21406)
* fixes issue with load_provider() not checking for an existing key
* adds updates to eos_config results key
* lots of minor syntax fixes in eos shared module
* adds eos_argument_spec to eos_eapi

fixes #21402
2017-02-14 18:47:29 +00:00
Adrián López
e1761d7724 yum: improve disk usage when update_cache used (#21098)
* Marks metadata files as outdated

Eliminates time records of the metadata and mirrorlists download
for each repository. This forces yum to revalidate the cache for
each repository the next time it is used.

* Command arguments in two separate strings to be compatible if run_command implementation changes. Doc explains a little better what is that parameter doing
2017-02-14 18:53:14 +01:00
Gabriele
5fbe64a324 Fixing nxos modules when interface is loopback (#20645)
* Fixing modules when interface is loopback

* Remove capitalize
2017-02-14 12:10:46 -05:00
Jiri Tyr
9008e8017b Fixing mounting of multiple sources to the same dest (#21413) 2017-02-14 09:09:48 -08:00
Scott Buchanan
8c6606aeee fix non-zero exit code on missing role file (#19002) 2017-02-14 17:57:06 +01:00
Jiri Tyr
d94b2d802e Fixing broken bind mount on CentOS 7 (#20703)
* Fixing broken bind mount on CentOS 7
* Fixing remount
2017-02-14 08:17:21 -08:00
Patrick Deelman
65cd21e9a8 passwordstore (pass) lookup module (#21314)
* passwordstore (pass) lookup module

* removed shebang
changed licensing
2017-02-14 11:12:39 -05:00
Sergey
8cb57f0b1d [cloud] New module: PubNub BLOCKS management module (#20200)
* Added PubNub BLOCKS management module.

* . increased block start/stop wait to 30 seconds

* . fixed multi-line documentation

* . fixed YAML formatting in documentation section

* . removed multi-line commits
. fixed YAML format in description section

* . updated test script to upload event handler sources if non-local connection used for tests
. changed module configuration parameter from 'block' to 'name' (represent target block name)
. updated module docs regarding 'chanes' configuration parameter. Only block 'name' can be changed using this parameter ('description' can be changed directly in module call configuration)
. changed module configuration parameter from 'pwd' tp 'password'
. migrated 'urlencode' import from try..catch to six module imported from Ansible module utils
. removed custom method which is used to verify whether value is empty

* ^ fixed value for key-path function usage with names of application/keyset/block and handlers.
. reduced unnecessary requests (better pre-procesing of previous results)
. event handler name change won't trigger block restart

* ^ fixed too long documentation lines

* . moved PubNub BLOCKS client code into separate package under PyPi
. updated module code to utilize new package
. changed block start stop state to: started and started

* . small changes in documentation format
2017-02-14 10:53:31 -05:00
s-hertel
0123ec786d [cloud] New module: AWS elasticache_snapshot (#21135)
* Adding an elasticache snapshot module.

Allows user to create, copy, or delete a snapshot.

* Removing unnecessary function

* Make indentation uniform.

* Making requested changes.

Fixing PEP8

Adding a more graceful fail for delete() if the snapshot's state valid (such as when it is in the process of being created).

* PEP8

* Fixing some formatting

move imports

fix parameter alignment

* move imports to the top of the file below documentation
2017-02-14 10:41:07 -05:00
Ondra Machacek
fd899c0339 [cloud][ovirt] Fix waiting to down state of stateless VM (#21246)
This patch enhances waiting operation of stateless VM to be down.
Because stateless VM creates a snapshot and removes it after the
VM is shutdown, we must wait until the VM is really prepared to
start again.
2017-02-14 10:40:21 -05:00
John R Barker
80c3087977 Revert "Added Ordnance network module." (#21408) 2017-02-14 15:33:19 +00:00
Stepan Stipl
86ed4b116c [cloud] add ec2_vpc_route_table purge_routes and purge_subnets options (#19334)
* Added purge_routes option to ec2_vpc_route_table module

* Added purge_subnets option to ec2_vpc_route_table module
2017-02-14 10:08:51 -05:00
Peter Sprygada
d43eac93bc ios local action creates circular reference (#21404)
When loading the params in the local action, the provider key was
inadvertently being loaded as well.  This created the circular
reference.  The load_provider() method will now check for the provider
key and skip it when encountered.

fixes #21399
2017-02-14 09:56:52 -05:00
Alexander Turner
f1a6d14d8e Added Ordnance network module. (#20436)
* Added Ordnance network module.

* Tidied up code base as per PR20436

* Whitespace blocking PEP8 test

* Removed acciental addition to VERSION

* Removed acciental addition to VERSION

* Documentation YAML issues

* removed force arg (depreciated)
2017-02-14 12:50:59 +00:00
Loïc Blot
acda9e9c85 nsupdate: rename rc(_str) to dns_rc(_str) (#21341)
This prevent module to fail when removing a removed record which returned RC 8 (NXRRSET)
2017-02-14 11:45:44 +00:00
Benjamin JOLIVOT
e3328e847b Ansible Mattermost Module (#21247)
* Ansible Mattermost Module v0.9

* __future__ not in top of file

* python3 ready

* trailing whitespace problem

* Bad metadata

* check mode + explicit imports + standardization

* bad false check

* move imports after documentation

* Add notes in doc explaining checkmode

* Remove default=false in doc + remove default values in doc

* rewrite default values in documentation

* trailing whitesapces

* Update description
2017-02-14 10:52:20 +00:00
Tim Rupp
09edc00008 Adds f5-sdk import check to all F5 modules (#21354)
Including this check in module utils so that it can be done
automatically in all F5 modules. This includes the ones that
do not yet use the f5-sdk because those modules too will move
to the SDK in the future
2017-02-14 08:42:07 +00:00
Pilou
f2c22109fb Don't mix deprecations messages with warnings messages (#21337)
* Remove unused attribute '_passthrough'

* Don't mix deprecations with warnings

* Return values: add 'deprecations' key used internally

* 'deprecations' and 'warnings' return values: add tests
2017-02-13 23:49:39 -05:00
René Moser
f2729f11c3 ios_config: fix "save" arg results in timeout (#21344)
* ios_config: fix "save" arg results in timeout

The command "copy running-config startup-config" prompts for a
destination filename, which was not handled.

~~~
testswitch#copy running-config startup-config
Destination filename [startup-config]?
Building configuration...
[OK]
0 bytes copied in 0.679 secs (0 bytes/sec)

[15:16]
ios: write memory
~~~

* test_ios_config: adjust test_ios_config_save
2017-02-13 21:12:54 -05:00
Peter Sprygada
14b942f3fb updates eos modules to use socket (#21197)
* updates eos modules to use persistent connection socket
* removes split eos shared module and combines into one
* adds singular eos doc frag (eos_local to be removed after module updates)
* updates unit test cases
2017-02-13 20:22:10 -05:00
Peter Sprygada
9937e604f5 fixes ios_facts that was returning no values (#21357)
* adds conversion to command dict into ios shared lib
* fixes hardware commands in ios_facts
* adds network_os value to play_context in ios action plugin

fixes #21190
2017-02-13 20:20:44 -05:00
Tim Rupp
bf836850a4 Replaces expanduser with type path
Replaces the usage of expanduser with the type 'path' for the
dest and object options as that functionality is available
in that type automatically.

patch related to #12263
2017-02-13 17:32:41 -05:00
Tim Rupp
f8cbfad5e6 Removes usage of expanduser due to type 'path'
Removes the usage of the expanduser function because it is
being performed automatically by the type 'path' of the
path option.
2017-02-13 17:24:24 -05:00
James Cammarata
8cc98b07c5 Fixing PEP8 errors in utils/vars.py 2017-02-13 16:13:40 -06:00
James Cammarata
a4b2b0a734 Small fix for 350a32bd to make it Py3 compliant 2017-02-13 15:54:25 -06:00
Tim Rupp
b49d39c5db Removes usage of expanduser because of type path
The usage of type 'path' for the path option makes the use
of expanduser redundant. This patch removes the expanduser
call because the path type is already used for the path
option
2017-02-13 15:02:05 -05:00
Brian Coca
2cb658925b fixed for chrrot as ignore error still has rc=0 2017-02-13 14:47:39 -05:00
James Cammarata
350a32bd95 Tweaking the new unique id generate to be uuid compliant 2017-02-13 13:34:53 -06:00
Ondra Machacek
c8c4a73e14 Fix compatibility of affinity groups in oVirt 4.0 and 4.1 (#21308)
* cloud: ovirt: exit if incompatible API/SDK version

* cloud: ovirt: fix affinity groups compatibility for oVirt 4.1
2017-02-13 12:43:35 -05:00
Robin Roth
82eaa9735c Add try/except around xml parsing in zypper
Zypper sometimes produces invalid XML. Catch that in a nicer way.

Potential future improvement: Work around broken XML by removing some
sections.
2017-02-13 12:28:22 -05:00
Tim Rupp
4900201c5b Remove expanduser and use type path
This patch removes the use of expanduser and replaces it with
type 'path'. This patch is related to #12263
2017-02-13 12:15:50 -05:00
Tim Rupp
c4d3bf3207 Adds path type and remove expanduser
Related to #12263, this patch removes the usage of expanduser
in favor of the path 'type' for the module options of src and
dest
2017-02-13 12:05:40 -05:00
Tim Rupp
1fb53e6aaf Remove expanduser usage because of path type
With the addition of the 'path' type, the usage of expanduser
is redundant. This patch  removes that extra usage.
2017-02-13 12:05:08 -05:00
Tim Rupp
0fcc6edf2b Replace expanduser with type path
This patch removes the use of expanduser and replaces it with
type 'path' for the option. This is related to #12263.
2017-02-13 11:15:13 -05:00
Peter Sprygada
8adb108aa9 updates vyos modules to use socket connection (#21228)
* updates all vyos modules to use socket connection
* adds vyos local action handler
* adds exec_command() to vyos
* updates vyos_config local action
* update unit test cases
* add base class for testing vyos modules
2017-02-13 10:41:22 -05:00
Brian Coca
85194234ba fixed bad copy/paste, deprecations should deprecate 2017-02-13 10:37:54 -05:00
Peter Sprygada
7f1c43e597 updates ios modules to support persistent socket (#21258)
* updates all ios modules to support persistent socket
* adds ios action plugin to connect to device
* adds exec_command() to ios shared module
* fixes ios_config and ios_template local action
* update all unit test cases
* adds base test module for ios module testing
2017-02-13 15:22:14 +00:00
jjlorenzo
3befc894e1 set no_log for url_password 2017-02-13 09:38:51 -05:00
Brian Coca
441ccd3a58 fixed typo 2017-02-13 09:37:13 -05:00
Brian Coca
18b062760c update shared services
added new daemonization function
documented existing functions
2017-02-13 09:37:13 -05:00
Willem van Ketwich
93a689958e [cloud] add summary feature and refactor AWS cloudfront_facts module (#20791)
* initial commit of cloudfront_facts.py

* modification as per review from @georgepsarakis

* fixed shippable build error

* fixed shippable build error

* removed wildcard imports and replaced with specific imports from ansible.module_utils.ec2 as advised by @georgepsarakis

* renamed all instances of cloud_front_origin_access_identity to origin_access_identity as advised by @georgepsarakis

* show facts based on alias and distribution id for easy referencing as advised by @ryansb. have done for both distribution and distribution_config

* fixed incorrect logic for default list_distributions, fixed list_distributions_by_web_acl - wasn't passing web_acl_id, fixed list_invalidations keyword args missing DistributionId

* fixed last fact added clobbering all previous facts for an alias or an id

* removed list_ prefix from list keys

* removed unnecessary boto fields. made list_distributions and list_streaming_distributions dictionaries with id/alias as key. fixed list_invalidations.

* initial commit of cloudfront_facts summary

* checks for empty list returned from boto, standardised list naming

* neatened up parameters

* added summary documentation

* refactoring of functions for modularity

* refactoring, neatening code, fix for if cname not present, added try-catch blocks

* more refactoring, cleaning

* more cleaning, allowed streaming distributions to be found by domain name alias

* removed unnecessary line

* fixed tabs

* fixed indentation

* removed trailing whitespace

* removed more whitespace

* more refactoring, modified where invalidations dict is set

* added ETag to summary

* refactored summary list

* moved list out of for loop

* trailing white space

* reverted line lengthening as advised by @willthames

* modified exceptions to multi line as advised by @willthames

* reverted variable spacing to be more pythonic'

* reverted spacing in YAML as advised by @ryansb

* reverted line spacing for parameters for correct blame attribution as advised by @ryansb

* removed white space

* more white space

* reverted line spacings for parameters as advised by @ryansb

* removed spaces between parameters as advised by @ryansb
2017-02-13 09:20:04 -05:00
Dag Wieers
f824b2ce8d Avoid having module documentation links to itself (#21329)
* Avoid having module documentation links to itself

A lot of modules use M(own_module) in their documentation causing a link
in the documentation to itself.

* Make note more clear now
2017-02-13 14:02:34 +00:00
Loïc Blot
fb32c19fea New module: nsupdate (#21099)
Add nsupdate module to manage DNS records on a DNS server

This uses dnspython library

It's greatly inspired by https://github.com/mskarbek/ansible-nsupdate with some rework, better feedbacks and documentation addition

Signed-off-by: nerzhul <loic.blot@unix-experience.fr>
2017-02-13 11:13:23 +00:00
Peter Sprygada
92aa92ebd2 updates netconf to use persistent socket (#21307) 2017-02-12 09:05:23 -05:00
Peter Sprygada
b8f138cabb adds connection module to module_utils (#21310)
* connection module connecting to persistent sockets
2017-02-12 07:52:50 -05:00
aperigault
1cdde216ec vmware_guest: Extend facts with vmware tools informations (#20860) 2017-02-11 22:50:59 -05:00
aperigault
98d841b324 vmware_guest: Fix undefine variable in rename feature (#20855)
* vmware_guest: Fix undefine variable in rename feature

* vmare_guest: We can't wait_for_task because MarkAsTemplate return None
2017-02-11 22:46:58 -05:00
Ted
65e32243b8 Make access_token type str, remove alias, and make validate_certs def… (#20811)
* Make access_token type str, remove alias, and make validate_certs default value true

* Remove extra white space and add end of file newline

* Remove comma

* Try removing that whitespace again
2017-02-11 15:41:24 +00:00
John R Barker
4ad91fc96b notes (not note) (#21287) 2017-02-11 15:38:06 +00:00
Ivan Bojer
5b9807dbac new module for private cert generation (#20889)
* new module for private cert generation

* - changes based on the reviewer's comments

* - changes based on the reviewer's comments

* extra documentation per request
2017-02-11 15:34:12 +00:00
Sumit Kumar
05c74cee47 Add NetApp SolidFire account manager module (#20728)
* Add NetApp SolidFire account manager module

* Minor fixes

* Set supports_check_mode to True

* Add Ansible Metadata

* Fix 'state' example argument

* Remove logger
2017-02-11 08:02:48 +00:00
Brian Coca
916a10c8ec delegate_to is a string 2017-02-10 20:07:49 -05:00
Brian Coca
fa93bf7096 allow more than .service, onus on user 2017-02-10 18:12:02 -05:00
Brian Coca
2f0070639f attempt to fix systemd in chroot env
fixes #21026
2017-02-10 18:12:02 -05:00
Tim Bielawa
1b1d58eb7e Fix incorrect wording in the 'find' module 'paths' parameter 2017-02-10 16:30:31 -05:00
James Cammarata
f82a2caa72 Forgot to include the utils/vars.py change with 4cbe610 2017-02-10 14:54:53 -06:00
James Cammarata
4cbe610263 Use a custom id generator over uuid4
>>> timeit.timeit("uuid.uuid4()", setup="import uuid")
9.518647909164429
>>> timeit.timeit("get_unique_id()", setup="from __main__ import get_unique_id")
0.40436601638793945

This will mainly be beneficial when a very large inventory is being
used, however it may also help with some very large playbooks.
2017-02-10 14:38:38 -06:00
s-hertel
84135ef7ad Removing cmp from ec2_vpc_net.py to be compatible with Python3 (#21202)
* Removing cmp to be compatible with Python3

* fix syntax

* Added an overlooked return

* Fixing making  things overly complicated

* Simplifying since tags will always be hashable. Don't need to use cmp at all.
2017-02-10 15:23:08 -05:00
s-hertel
2dc42fce80 [cloud] add tags parameter to ec2_vol & PEP8 fixes (#21254)
* Make ec2_vol pep8 and add tags parameter

* Remove ec2_vol.py from pep8 legacy-files
2017-02-10 15:22:38 -05:00
Brian Coca
74e8aa22af no log passwords (#21229)
* no log passwords

* removed unneeded no_log
2017-02-10 15:13:59 -05:00
Damien
2f6966965e Clean up doc, removed required: false, add hard stop etc .. (#21265) 2017-02-10 19:56:28 +00:00
Tim Rupp
cbfe15a315 Adds doc fragments for the available env vars (#21251)
For F5 modules, the options that are commonly specified can
also be specified in the environment variables. This patch
adds the doc fragments that describe which env var goes
with which module option.
2017-02-10 18:57:16 +00:00
Alberto Murillo
aba2b38b07 Add swupd plugin (#20834)
* Add swupd plugin

Add support for ClearLinux update manager (swupd)

Signed-off-by: Alberto Murillo Silva <alberto.murillo.silva@intel.com>

* swupd: Document RETURN values

Signed-off-by: Alberto Murillo Silva <alberto.murillo.silva@intel.com>

* swupd: Add a meaningful description for failures

Signed-off-by: Alberto Murillo Silva <alberto.murillo.silva@intel.com>

* swupd: Clarify documentation

Provide more information about the options supported by the module
since some concepts are new for people not used to clearlinux/swupd

Signed-off-by: Alberto Murillo Silva <alberto.murillo.silva@intel.com>
2017-02-10 13:55:27 -05:00
Sumit Kumar
512996b803 Add NetApp SolidFire volume access group module (#20733)
* Add NetApp SolidFire volume access group module

* Minor fixes

* Make requested changes

* Set supports_check_mode to True

* Add Ansible metadata

* Make requested changes

* Minor fix to documentation
2017-02-10 13:52:53 -05:00
Sumit Kumar
72cc5fed17 Add NetApp SolidFire check connections module (#20731)
* Add NetApp SolidFire check connections module

* Minor fixes

* Add Ansible metadata and remove Return section

* Minor documentation fix
2017-02-10 13:38:49 -05:00
Robin Miller
951994be5e use backoff/retry for conn.get_zones and conn.get_hosted_zone in route53 module (#20771) 2017-02-10 13:34:50 -05:00
James Cammarata
86beb55a90 Also clean template data even if marked unsafe
Fixes #20568
2017-02-10 10:08:55 -06:00
James Cammarata
b5bf525828 Call parent super() in RoleDefinition init before doing other stuff
This only impacts the use of RoleDefinition directly, but it was a tricky
bug to spot.
2017-02-10 08:27:26 -06:00
James Cammarata
0d418789a2 Revert "Fixing another corner case for security related to CVE-2016-9587"
This reverts commit bcceada5d9.
2017-02-10 08:27:26 -06:00
Brian Coca
e9b009510f added fixme note 2017-02-10 08:46:33 -05:00
Tim Rupp
5137244c3e Adds fallback env variables for F5 bigip modules (#21213)
These would be a convenience that could be used instead of having
to specify them for each module
2017-02-10 08:06:28 +00:00
Davis Phillips
239c6aee35 added default datacenter ha-datacenter and set wait_for_ip_address to… (#21076)
* added default datacenter ha-datacenter and set wait_for_ip_address to default False - closes 21074

* Updated docs to reflect changes
2017-02-09 22:43:31 -05:00
Toshio Kuratomi
98541b7c8b Fix to bytes surrogate and nonencodable chars (#21180)
* Add a surrogate_then_replace error strategy to keep to_bytes from tracebacking by default
* Port all code that explicitly used surrogate_or_replace to surrogate_then_replace
2017-02-09 17:13:40 -08:00
Ssawa
149dd9ca86 Update winrm to allow fetch_file to work on files in use by processes (#18174) 2017-02-09 16:43:52 -08:00
Peter Sprygada
39aaa32e40 adds socket usage to network common (#21196)
* updates network common the reconstruct the persistent connection socket
2017-02-09 19:42:06 -05:00
Dag Wieers
953ca38b67 Fix typo in example (#21227) 2017-02-09 16:40:07 -08:00
Andrea Tartaglia
2291163a7a Added DIFF_ALWAYS constant
When set to True, will always print the diff. Defaults to False.

Fixes #18416 #16073
2017-02-09 18:28:50 -05:00
Brian Coca
403e9d35df use regex vs list to weed out password fields
- also warn as module SHOULD have no_log
 - make password regex exportable for testing
 - avoids boolean fields
2017-02-09 18:18:30 -05:00
Jordan Borean
5cabe420ea Added win_reg_stat module (#19145) 2017-02-09 14:47:00 -08:00
Alexander Winkler
2ac57e0bc3 Usage of proper Solaris 11 Package Manager
The default Package Manager for Solaris 11 has been set to the module pkg, but there is no such module. Instead pkg5 exists and will be used from now on.
2017-02-09 17:43:11 -05:00
Damien
b71a62283c New Module : aos_ip_pool as part of network/aos (#21044)
* Initial version of aos_ip_pool module

* Add examples for IP Pool

* Break down ip_pool into smaller function

* Refactor do_load_resource

* Add get_display_name_from_file

* Add ‘src’ as an option to load ip pool from JSON file

* Rename directory network/apstra to network/aos

* Remove exception handling temporary

* Remove all ‘Exception as XX’ to be python 2.4 compatible

* Replace ‘== False’ with ‘is False’ for PEP8 Test

* Update documentation to be Yaml compatible

* Lisg all method imported from module_utils.aos

* Refactor to align with collection.find() changes

* Update examples by @gundalow’s  recommendations

* Update Documentation per @gundalow’s recommendations

* Change the license per @gundalow recommendation

* Add exception handling for get_aos_session

* Change Auth format and add check_aos_version() to check minimum version

* Add a check for minimum version

* Refactor ‘src’ into ‘content’ to allow more options
Remove get_display_name_from_file in aos.py
Add content_to_dict in aos.py

* Fix variable name in do_load_resource

* Add mention of aos.py in module_utilities doc

* Add try/except for import yaml

* Add try/Except around main block of code and function

* Refactor to auto detect content_format, update doc accordingly

* Change create_new_ip_pool inputs

* Remove unused import

* Remove in_use as it’s never used

* Fix doc format

* Add version number in requirement doc
2017-02-09 22:22:56 +00:00
s-hertel
22701806c3 Adding environment variable support for lambda.py in response to feat… (#20705)
* Adding environment variable support for lambda.py in response to feature idea #20479.

Plus a 1-character bug fix.

* fix yaml syntax

* Fixing option name, adding alias, and fixing a line to allow the user to delete environment variables by setting an empty dict.
2017-02-09 15:12:56 -05:00
Sumit Kumar
f21d57570e Add NetApp SolidFire snapshot schedule module (#20734)
* Fix NetApp doc_fragment

* Add NetApp SolidFire Snapshot schedule manager module

* Minor fixes

* Change supports_check_mode to True

* Fix PEP8 issue

* Make requested changes

* Change 'pause' to 'paused'

* Add schedule ID as a returned parameter

* Make requested changes
2017-02-09 19:39:44 +00:00
Peter Sprygada
21157aa1bc loads action handler for a group of network modules (#21194)
* loads action handler based on module group prefix for network modules
2017-02-09 14:26:09 -05:00
s-hertel
0e4f48d684 Merge pull request #20953 from surfuga/fix-20951-ec2_vpc_net-multi_ok
Fixes #20951 fixed multi_ok in ec2_vpc_net.py (var multi usage in vpc_exists function)
2017-02-09 14:24:51 -05:00
Peter Sprygada
138051540e updates the code path for network modules (#21193)
* replaces persistent connection digest with _create_control_path()
* adds _ansible_socket to _legal_inputs in basic.py
* adds connection_user to play_context
* maps remote_user to connection_user when connection is local
* maps ansible_socket in task_vars to module_args _ansible_socket if exists
2017-02-09 14:05:54 -05:00
Dag Wieers
35d97c1e6d Windows: Add-Warning() and Add-DeprecationWarning() (#20903)
* Windows: Add Warn() and Deprecate() mechanisms

Similar to what already exists for python modules.

* Turn deprecations from list of strings, to list of dicts

Since #20884 the internal representations of deprecation messages is
changed from a list of strings to a list of dicts.

* Rename to Add-Warning() and Add-DeprecationWarning()

Implemented as discussed.
2017-02-09 10:41:57 -08:00
Tatsuya Hoshino
41f3680dfd Mask login_password in log (#21199) 2017-02-09 10:16:54 -08:00
stigchristian
27d1286780 Fixed typo "tempalated" => "templated" (#21187) 2017-02-09 09:13:22 -08:00
Brian Coca
2f1ab29855 add url_password to 'cleanse' list 2017-02-09 08:53:04 -05:00
DavidVentura
c5a8b78956 fix merge conflicts (#19481) 2017-02-09 12:55:25 +00:00
Adam Friedman
1a28a48176 Refactor dimensiondata_network module (#21043)
* Refactor dimensiondata_network to use shared base class for common functionality.

* Experiment: remove the assignments in the "except ImportError:" block that keep PyCharm happy. If this fixes the build, then I reckon there's a bug in the validate-modules script (https://github.com/ansible/ansible/blob/devel/test/sanity/validate-modules/validate-modules#L322).

* Remove unused imports.

* Changes based on feedback from @gundalow for ansible/ansible#21043.

- Use no_log=True for mcp_password parameter.
- Collapse module parameter definitions.

* Use shared definitions and doc fragments for common module arguments (ansible/ansible#21043).

* Make default network plan "ESSENTIALS", rather than "ADVANCED" (this is consistent with our other tooling).
Tidy up module parameter documentation.

* Simplify dimensiondata module documentation fragments (didn't know you could include multiple fragments).

* Change 'verify_ssl_cert' module parameter to 'validate_certs'.
2017-02-09 11:30:31 +00:00
DavidVentura
b5811ccb8a proxmox: Add public key support: fix #19487 (#21142)
* fix #19487

* add 'version_added'

* Check for version compatibility, Ignore keys if incompatible

* add comment about version support

* remove 'type' as requested

* fix merge error
2017-02-09 09:45:41 +00:00
Tuomas-Matti Soikkeli
829f3bd019 Fix default value for remote_src (#21136)
Default value is clearly False, fixed it to correct value.
2017-02-09 00:25:27 -08:00
Jordan Borean
1c885cb848 Added fix for win_file with broken symlinks (#19146) 2017-02-08 18:49:49 -08:00
Matt Clay
4b90f9cf89 Remove obsolete test requirements file. 2017-02-08 15:40:18 -08:00
Jordan Borean
1ce5fcf061 Added win_find module (#19144) 2017-02-08 22:19:08 +00:00
Adrian Likins
df3e4cd7f4 Don't check for var._obj in template._clean_data (#20868)
* Don't check for var._obj in template._clean_data

AnsibleUnsafe or other unsafe vars used to have a
'_obj' slot but no longer do. This was causing attribute
errors if a object was 'unsafe' but not a string.

Add tests for AnsibleUnsafe, lookups, and AnsibleContext
2017-02-08 16:09:34 -05:00
Adrian Likins
e511326222 Fix 'yum skips updates' bug (#21113)
* Fix 'yum skips updates' bug

When the 'yum check-update' output is parsed, the regex used
to stitch wrapped lines together would fail on the first package.

It would fail because there is an empty line before the first
package, and this triggered the regex. To avoid a more complicated
regex, preprocess the check-update output to strip out any
empty lines.

The regex is also updated to include a group on the non whitespace
match to be used in the sub.

Add test cases based on info provided in the bug reports.

Fixes #20608
2017-02-08 16:07:43 -05:00
stephane
1b8c2a2b0b Restore "skipping: no hosts matched" message
In 159aa26b36
the result of _get_serialized_branches when no hosts were matched
changed from [[]] to []. Thus, the v2_playbook_on_no_hosts_matched
callback would not fire. Change the check so we get the error message
again. Fixes #17706
2017-02-08 16:03:29 -05:00
jerry
bd19a9e847 removing unwanted variables and using to_native instead of str()
(cherry picked from commit c4b09cbcb4)
2017-02-08 15:53:58 -05:00
jeronimog
4f85e4831d Adding self.log() on IOErrors and OSErrros
(cherry picked from commit ef1ecfd2c2)
2017-02-08 15:53:58 -05:00
Brian Coca
300718e811 use new 'warn' method
this also prevents warnings from being lost
2017-02-08 15:53:58 -05:00
Tim Rupp
43ae12757e Adds CLI classes for some F5 modules (#21119)
To support the _command module for F5 products, this class is needed.
2017-02-08 18:25:20 +00:00
Ralph Rodkey
b1f06f6555 [cloud] make ec2_asg honor 'wait_for_instances' on delete 2017-02-08 12:57:59 -05:00
Matt Martz
c3fb4c837b Fix module validation errors for avi_api_session (#21154) 2017-02-08 10:32:13 -06:00
Pilou
4e5c9c3d0d default and minimal callback: display warnings in a consistent manner (#21144)
* default/minimal callback: don't display warnings twice

* minimal callback: display warnings raised by MODULE_NO_JSON modules
2017-02-08 10:58:39 -05:00
Marius Gedminas
2efb692cc4 known_hosts: support --diff (#20349)
* known_hosts: support --diff

* known_hosts: support --diff also without --check

* Add unit tests and fix incorrect diff in one corner case

Tests are good!

* Refactor for readability

* Python 3 compat

* More Python 3 compat

* Add an integration test for known_hosts

* Handle ssh-keygen -HF returning non-zero exit code

AFAICT this is a bug in ssh-keygen in some newer OpenSSH versions
(>= 6.4 probably; see commit dd9d5cc670):
when you invoke ssh-keygen with -H and -F <host> options, it always
returns exit code 1.  This is because in ssh-keygen.c there's a function
do_known_hosts() which calls

  exit (find_host && !ctx.found_key);

at the end, and find_host is 1 (because we passed -F on the command line),
but ctx.found_key is always 0.  Why is found_key always 0?  Because the
callback passed to hostkeys_foreach(), which is known_hosts_hash(),
never bothers to set found_key to 1.

* This test does not need root

* Avoid ssh-ed25519 keys in sample known_hosts file

Older versions of OpenSSH do not like them and ssh-keygen -HF
aborts with an error when it sees such keys:

  line 5 invalid key: example.net...
  /root/ansible_testing/known_hosts is not a valid known_hosts file.

* Fix Python 3 errors

Specifically, the default mode of tempfile.NamedTemporaryFile is 'w+b',
which means Python 3 wants us to write bytes objects to it -- but the
keys we have are all unicode strings.
2017-02-08 09:56:03 -05:00
Brian Coca
d0bc98bddb added url and metadata 2017-02-08 09:48:59 -05:00
Brian Coca
82337cf52a remove warning/deprecation keys after usage 2017-02-08 09:47:10 -05:00
Gaurav Rastogi
798972c72a Avi Networks Ansible modules. (#20415)
* Avi Networks Ansible modules.
Avi Version: 16.3.4

* Fixed Review comments
1. Changed description to be full sentences
2. Fixed Pep8 warnings.
3. Fixed comments and descriptions.

* 1. Fixed descriptions and messages as per review comments.
2. Added descriptions for the missing parameters.

* Fixed the shippable break due to the incorrect description format

* Removed the extra modules so that there is a single module for the first commit

* Updated license to BSD based on review comments

* updated comments based on review feedback

* Refactored code to handle POST and PUT scenarios where playbook does not need to check whether object is present.
Moved ansible helper utilities to module_utils as now roles can be patched with module_utils as well.

* fixed pep8 warnings
2017-02-08 09:47:18 -05:00
Thomas Krahn
9f3870ddcd IPA: Remove duplicated code and fix a bug that occurs if empty lists were passed and IPA didn't know the value before (#19210)
* ipa: Add method get_diff and modify_if_diff to class IPAClient

* ipa_*: Use method get_diff and modify_if_diff from class IPAClient
2017-02-08 14:16:44 +00:00
Kevin Kuhls
534dbb094b adding support for no candidate config (#20821)
commit fails for devices with no candidate config, such as when configuraion is written to running-config store.  Commit is set to True in main's call of netconf_edit_config.  The simple edit is to add the additional logic around sending the commit.  Otherwise you could change commit could be set to (if ":candidate" in m.server_capabilities) in the call of netconf_edit_config.  Either way would work.  I'll defer for the decision of which.
2017-02-08 08:58:23 -05:00
Robert Simmons
b7e78656ac [cloud] gce_net fix for unsetting firewall rule properties in the project. (#20483) 2017-02-08 08:49:04 -05:00
Ricardo Carrillo Cruz
64ed9bcfd7 Add unit tests for ios_facts module (#21114) 2017-02-08 12:24:25 +01:00
René Moser
a6f887ce6e cloudstack: cs_portforward: implement vpc support (#19044)
* cloudstack: cs_portforward: implement vpc support

* cloudstack: cs_portforward: add vpc and network to returns

* cloudstack: cs_portforward: networkid must not be used for rule listing

* cloudstack: fail for get_network when vpc but no network name

This seem to be a global pattern for get_network, we want to enforce a
network name to be set if a vpn param is given.

This is used for cs_portforward.

* cloudstack: cs_portforward: doc: fix defaults for vpc, network
2017-02-08 07:57:36 +01:00
Marius Gedminas
577d0e43ba apt_repository: check for enabled repositories correctly
Fixes #20754.

Details: UbuntuSourcesList.add_source() had a quick check for PPAs being
already present in the source lists.  The check was looking for the PPAs
URL to be present in self.repo_urls, which should contain all valid and
enabled repositories.

The enabled check in repo_urls was incorrect.  It was checking the tuple's
2nd item (which means "valid") and ignoring the 3rd item (which means
"enabled").

self.files contains tuples (line_number, valid, enabled, source_line,
comment_text).  Ideally it would be using named tuples instead of
indexing, to avoid bugs like that, but Python 2.4 didn't have named
tuples, so we can't do that (yet).
2017-02-07 18:42:57 -08:00
Dag Wieers
4f96ee5e27 Add missing iteritems definition (#21106)
Also moved most imports out of try-except block.
2017-02-07 18:31:40 -05:00
Ryan S. Brown
d12e9f5748 Convert error to the native text type before writing to stderr
Fixes #20588
2017-02-07 18:01:58 -05:00
René Moser
c00604210c cs_instance: fix ssh keys not found in projects (#21104)
Follow up of 5475f3ee64
2017-02-07 22:14:43 +01:00
Adrian Likins
7278308ca2 Redhat subscription (#20729)
* Make unused redhat_subscriptions do something

rhsm_baseurl/server_insecure were module params that were
never used previously. Hook them up for register options.

* pep8/style cleanups
* Set a module scope SUBMAN_CMD before we ref it as a global
* move ansible imports to top, remove '*' imports
* remove redhat_subscriptions from pep8 legacy
2017-02-07 12:07:01 -05:00
Nathaniel Case
530701b398 Vyos system module (#21060)
* vyos_system tests

* Merge vyos_system fixture with vyos_config fixture
2017-02-07 12:04:14 -05:00
Abdul Anshad A
b30942787b Add guest shutdown/reboot (#20564) 2017-02-07 10:33:13 -05:00
Craig Francis
3e003b10fa Reminder that lookup(‘file’) can be used (#20649)
* Reminder that lookup(‘file’) can be used

Sometimes the block of text does not easily fit into a playbook, so this acts as a reminder (or a prompt for anyone who hasn't used this before) that the content could be stored in an separate file.

I've also included `backup: yes` as I think this is a good example of where a backup might be needed.

* Correct the not so "smart quotes"

* Update blockinfile.py

Replace – with an an ASCII -
2017-02-07 13:57:49 +00:00
Peter Sprygada
d8e57cc60a starts cli if root user login is used for junos terminal (#20761)
fixes #20131
2017-02-07 10:57:44 +00:00
Brian Coca
c86a17b7a0 refactoring async
- centralized skipping
- also fixed module name broken by previous refactor
- let action modules handle async processing
- moved async into base action class's module exec
- action plugins can now run final action as async
- actually skip copy if base skips
- fixed normal for new paths
- ensure internal stat is never async
- default poll to 10 as per docs
- added hint for callback fix on poll
- restructured late tmp, now a pipeline query
- moving action handler to connection as networking does
- fixed network assumption invocation is always passed
- centralized key cleanup, normalized internal var
- _supress_tmpdir_delete now in _ansible_xxx and gets removed from results
- delay internal key removal till after we use em
- nicer tmp removing, using existing methods
- moved cleanup tmp flag to mking tmp func
2017-02-06 19:32:00 -05:00
Daniel Brachmann
b9334f9f47 improve error message on conflicting actions. Fixes #21057 (#21059)
* this fixes #21057

outputs the conflicting action statements.

* reverting to old  % syntax for python 2.6 compatibility
2017-02-06 22:48:06 +00:00
Mike Rostermund
c6a5d9c8bf Fix indentation to match other examples (#21080) 2017-02-06 17:19:35 -05:00
Vincent Bernat
d94f9bdd8d cloudstack: ensure we select a template compatible with disksize (#21058)
When the user specify a root disk size, the template image must be
smaller than the specified root disk size.
2017-02-06 23:14:31 +01:00
Ricardo Carrillo Cruz
375846d764 Refactor iosxr_facts to use network_cli plugin (#20857) 2017-02-06 22:23:17 +01:00
Toshio Kuratomi
bfffd1952f Make sure that we're comparing text all the way through.
On Darwin, sys.platform returns byte strings on both python2 and
python3.  Turn it into a text string everywhere in order to remedy that.

Fixes #19845
2017-02-06 13:07:49 -08:00
Toshio Kuratomi
5c56e79a8f Cleanup imports 2017-02-06 13:04:54 -08:00
Eugene Krokhalev
d67cbaa274 fix urlparse usage in cloud.amazon module to be compatible with python3 (#20917)
* fix urlparse usage in cloud.amazon module to be compatible with python3

* make imports style compatible with six documentation
2017-02-06 12:55:11 -08:00
Brian Coca
8d17055831 error out if systemctl isn't present 2017-02-06 14:52:24 -05:00
Davis Phillips
65e55d47b1 fixes 20904 (#21068) 2017-02-06 14:37:42 -05:00
Evgeni Golov
827723db90 use require_if to check for username or AK instead of custom code (#20937)
the logical or parameter to require_if was introduced in #20220
2017-02-06 13:53:12 -05:00
Brian Coca
770fb03157 minor fixes to template docs 2017-02-06 13:05:18 -05:00
Imran Hussain
d7bf3749b7 Add Check Mode capability to kernel_blacklist module (#21007)
* Add Check Mode capability to kernel_blacklist module
* Add suggested changes from @tmshn
* Pass a bool into `Blacklist` that'll just be `module.check_mode`
* Move detection and creation of a file to a separate function within `Blacklist`
* If there's no file on the system and we are running under `Check Mode`, set `self.filename` to `os.devnull` AND mark a change, as the module would have created an empty file.
* Whenever a `self.filename` is being opened in a mode where changes can be made, replace with an if statement that checks `self.checkmode` and if true then open up `os.devnull` instead
2017-02-06 13:00:31 -05:00
Loïc Blot
b55d039f67 New modules: vmware_guest_facts & vmware_guest_snapshot (#20971)
* Move gather_facts action outside of vmware_guest module
* Move facts gathering method to vmware.py library
* vmware_guest use some vmware.py library methods
* vmware.py lib: fix some PEP 8 issues
* Move snapshot actions to vmware_guest_snapshot
* Move common snapshot facts to vmware.py library
2017-02-06 11:52:17 -05:00
Toshio Kuratomi
6227c6006b Fix typo when choosing KqueueSelector 2017-02-06 08:46:58 -08:00
Daniel Andrei Mincă
62434d9955 update vague description of only_upgrade (#21050)
* the `only_update` param description was kinda vague:
  * either install if not installed
  * or upgrade if installed
  * or both!?
    * as a result, remove the "install" statement from this sentence

Resolves:
Related:
Signed-off-by: Daniel Andrei Minca <mandrei17@gmail.com>
2017-02-06 09:50:43 +00:00
Peter Sprygada
39426a2207 fixes minor issues with shell (#21039)
* adds sendonly to command dict
* fixes setting timeout param
2017-02-04 09:40:40 -05:00
Peter Sprygada
3eb40d1272 adds netconf shared module (#20743)
New netconf shared lib added to module_utils for sending netconf
messages to remote devices over netconf connection plugin
2017-02-04 09:40:27 -05:00
Ganesh Nalawade
95a75e7c3a Fixes #20412 junos_config delete command fix (#20450)
If same config hierarchy is set and deleted in one playbook
for delete statement add support to check if the config is present
on device or in the playbook. If it is present add delete statement in
updated config list.
2017-02-04 09:16:16 -05:00
JimFicarra
46503c6d1f win_msi:Fixing Issue #20315 - shows changed even when msi not found (#20358)
* win_msi #20315 - shows changed even when msi not found

* make brace placement consistent
2017-02-04 09:32:06 +01:00
Scott Peshak
467fde5644 Correct typo in net_command docs (#20976) 2017-02-04 08:53:11 +01:00
Toshio Kuratomi
f75ffe46db Make configparser imports python3 ready
the ConfigParser module was renamed to configparser in Python3.  Use
six.moves to import it so that the modules will function on Python3.
2017-02-03 21:15:34 -08:00
Ryan S. Brown
bb9ee0cf6f [cloud][aws] Make s3_object_version truly optional in lambda module 2017-02-03 16:22:54 -05:00
Brian Coca
a2c38c47aa added docs for vault and made trigger shorter: !vault (#20985)
* added docs for vault and made trigger shorter: !vault

* added single var valuting

* Update playbooks_vault.rst

Edit pass for spelling and grammar. Ship it!

* Update playbooks_vault.rst

Typo fixes.
2017-02-03 15:28:50 -05:00
Davis Phillips
00fdec1d60 closes #21011 (#21015) 2017-02-03 13:57:19 -05:00
Toshio Kuratomi
d1a6b07fe1 Move ssh and local connection plugins from using raw select to selectors
At the moment, this change will use EPoll on Linux, KQueue on *BSDs,
etc, so it should alleviate problems with too many open file
descriptors.

* Bundle a copy of selectors2 so that we have the selectors API everywhere.
* Add licensing information to selectors2 file so it's clear what the
  licensing terms and conditions are.
* Exclude the bundled copy of selectors2 from our boilerplate code-smell test
* Rewrite ssh_run tests to attempt to work around problem with mocking
  select on shippable

Fixes #14143
2017-02-03 08:23:50 -08:00
jhawkesworth
2c70450e23 Fix 'touch' mode so it creates zero size files. (#20876) 2017-02-03 13:36:47 +01:00
Peter Sprygada
289fb8e895 remove unneeded eos_cli shared module (#20999) 2017-02-02 22:36:52 -05:00
Peter Sprygada
d226f31a0f fixes ios and eos command modules (#20989)
* returns support for prompt/response over cli
* now sends native dict instead of str command
* fixes issue with run_commands() in ios to jsonify request
* updates unit test cases
2017-02-02 22:10:14 -05:00
René Moser
62c97cdd3e ios_cli: fix load_config exec_command (#20994)
fixes AttributeError: 'AnsibleModule' object has no attribute 'exec_command'
2017-02-02 21:13:03 -05:00
Toshio Kuratomi
1df7d95cec Module utils default path (#20913)
* Make the module_utils path configurable
* Add a config value to define the path site module_utils files
* Handle module_utils that do not have source as an error
* Make an integration test for module_utils envvar working
* Add documentation for the ANSIBLE_MODULE_UTILS config option/envvar
* Add it to the sample ansible.cfg
* Add it to intro_configuration.
* Also modify intro_configuration to place envvars on equal footing with
  the config options (will need to document the envvar names in the
  future)
* Also add the ANSIBLE_LIBRARY use case from
  https://github.com/ansible/ansible/issues/15432 so we can close out
  that bug.
2017-02-02 17:48:53 -08:00
Peter Sprygada
bce0bd401e bug fixes for shell exec command (#20988)
* fixes up eos_local to call appropriate method
* fixes up ios_cli to call appropriate method
* moves json conversion to eos
2017-02-02 18:32:36 -05:00
Toshio Kuratomi
fee6e2953b Split on newlines when checking for prompt matches (#20945)
* Check for the prompt as a substring of the output

sudo sometimes spits out warnings to stdout before getting to the
password prompt.  Account for that when trying to match a password
prompt.

Fixes #20858
2017-02-02 14:31:11 -08:00
Toshio Kuratomi
62ba084003 Do not substitute ssh_exeuctable until we need to
We need to use ssh_executable instead of hardcoding ssh in the command
we run but we need to use "ssh" when we lookup the value of the
{command}_extra_args variable.  Do this by leaving binary as "ssh" and
only expanding when we place it into b_command.

Fixes #20862
2017-02-02 13:43:39 -08:00
Ondra Machacek
de2b6469e9 [cloud][ovirt] new module ovirt_snapshots & ovirt_snapshots_facts (#20936)
* cloud: ovirt: add snapshots module

* Move imports in ovirt_snapshots module to match style & pass CI

* Move ovirt_snapshot_facts imports to comply w/ CI
2017-02-02 16:34:54 -05:00
Ondra Machacek
684c766e20 cloud: ovirt: add host engine options to ovirt_hosts (#20967) 2017-02-02 16:24:24 -05:00
Matt Martz
829c0b8f62 Update validate-modules (#20932)
* Update validate-modules

* Validates ANSIBLE_METADATA
* Ensures imports happen after documentation vars
* Some pep8 cleanup

* Clean up some left over unneeded code

* Update modules for new module guidelines and validate-modules checks

* Update imports for ec2_vpc_route_table and ec2_vpc_nat_gateway
2017-02-02 11:45:22 -08:00
Nathaniel Case
1718719d77 vyos_facts 2.3 (#20939)
* Update vyos_facts documentation

* Replace runner for run_commands

* vyos_facts tests

* Update documentation

* vyos_facts is supported by core
2017-02-02 14:45:06 -05:00
Peter Sprygada
76ccfe4627 fixes handle_prompt in shell module (#20982)
* transforms command objects to dict
* transforms string commands to dict
2017-02-02 14:27:55 -05:00
Tobias Rüetschi
4f117df6ec univention udm_user: add parameter to control password update (#20699)
* univention udm_user: added support to set the password always

* module udm_user: added version 2.3 to update_password
2017-02-02 14:10:32 -05:00
Ondra Machacek
4269b12c9d Ovirt vms improve (#20882)
* cloud: ovirt: add function to get id by name

* cloud: ovirt: add instance type parameter

* cloud: ovirt: use param method instead of module.params

* cloud: ovirt: use 'and' at begging of next line

* cloud: ovirt: add description parameter to vms module

* cloud: ovirt: add comment parameter to vms module

* cloud: ovirt: add timezone parameter to vms module

* cloud: ovirt: add serial_policy parameter to vms module
2017-02-02 13:51:26 -05:00
Ondra Machacek
ee7f1cde0e ovirt: Add support to diff (#20698)
* cloud: ovirt: Add diff support to

* cloud: ovirt: Add ability to print nested list of objects

* cloud: ovirt: Fix waiting while reinstalling host

* cloud: ovirt: fix ovirt_vms 404 error

* cloud: ovirt: add check_mode support to ovirt_auth module
2017-02-02 13:50:52 -05:00
Brian Coca
6ca5fb49c3 allow debug to be 'changed' (#20957)
* allow debug to be 'changed'

fixes #14430

* removed test that checked against this
2017-02-02 13:46:16 -05:00
Nathaniel Case
d87fc9605f vyos_config 2.3 (#20577)
* Rename vyos2 over vyos

* Update vyos_config to LocalAnsibleModule

Change result key 'updates' -> 'commands'

vyos_config is supported by core

* vyos_config tests

* Enable bracket config use

* Sanitize config before use
2017-02-02 13:12:26 -05:00
Peter Sprygada
1e2afd57ae fix up eos doc frags (#20981)
* fix modules with invalid doc frags
* remove unneeded doc frags
2017-02-02 12:15:23 -05:00
s-hertel
0ed1e6a1f3 [cloud] rds module: handle parameters that are False, but also not the default value. Fixes #20370 (#20646)
Boolean options that default as `None` but are set to `False` by the user were ignored on update. This change checks to distinguish None & False so that options like multi_az can be turned off during an update. 

* Modifying how optional parameters are handled in rds.py. Fixes #20370

Allowing options to be set to false/no. Previously ignored unless set to true/yes.

Added a conditional for invalid parameters since the default is false instead of null for some options (e.g. force_failover, apply_immediately, upgrade).

* Making requested revision.
2017-02-02 09:49:19 -05:00
Stephane Maarek
c33812450e fixed type mapper and added tests (#20963) 2017-02-02 09:46:17 -05:00
Dag Wieers
3dbce15ccb win_shortcut: Add missing $check_mode definition + bugfix + tests (#20911)
* win_shortcut: Add missing $check_mode definition

For some reason this entry was missing, possible a merge-conflict gone
wrong :-(

* Added integration tests and bugfix

Add missing changes.
2017-02-02 10:29:56 +01:00
Will Thames
afe29977cb Revert "clean up unused doc fragments"
Those "unused" doc fragments are still referenced

lib/ansible/modules/network/eos/eos_config.py:extends_documentation_fragment: eapi
lib/ansible/modules/network/eos/eos_facts.py:extends_documentation_fragment: eos

This reverts commit 246cd041d8.
2017-02-01 23:40:35 -08:00
Peter Sprygada
e19c2f6a6d adds the cli transport back to the ios modules (#20949)
the cli transport was initially removed to aid in the transition to
network_cli.  This adds the function back to the provider can be
specified.
2017-02-01 23:06:42 -05:00
Peter Sprygada
246cd041d8 clean up unused doc fragments 2017-02-01 22:43:24 -05:00
Peter Sprygada
d8d0b007e3 adds support for eos_local connections to eos modules (#20961)
* updates modules to use eos_local
2017-02-01 22:37:57 -05:00
Peter Sprygada
1d7c71ce50 adds eos_local shared module to handle local connections (#20960)
* adds support for eapi
* adds support for cli
* adds doc fragement
2017-02-01 22:21:18 -05:00
Pau Rodriguez
cc240e3f2d fixed multi_ok(multi) usage in vpc_exists function 2017-02-02 00:28:38 +01:00
Peter Sprygada
67646a0771 fixes exec_command in shell (#20948)
transforms command to dict for processing by instance of Shell
2017-02-01 18:14:53 -05:00
Brian Coca
d4a8816f48 added back return false for when not debian 2017-02-01 15:58:32 -05:00
Will Thames
da1c13705d Disassociate EC2 VPC subnets from route tables before deletion (#20114)
* Disassociate subnets from route tables before deletion

If a route table still has subnets associated with it, it will fail
to delete:

```
"msg": "The routeTable 'rtb-abcd1234' has dependencies and cannot be deleted."
```

Avoid this by disassociating subnets before route table deletion

* Fix ec2_vpc_route_table flake8 complaints
2017-02-01 15:36:51 -05:00
Will Thames
950ff3f24a Fix EIP release in ec2_vpc_nat_gateway (#20167)
* Check if EIP exists before deleting it

After deleting the NAT gateway, the EIP sometimes seems to
cease to exist afterwards. Check if it exists before deleting it.

Otherwise you get:
```
Failed to release EIP eipalloc-abdc1234: An error occurred (InvalidAllocationID.NotFound) \
when calling the ReleaseAddress operation: The allocation ID 'eipalloc-abcd1234' does not \
exist", "success": false}
```

* Fix flake8 errors with ec2_vpc_nat_gateway
2017-02-01 15:32:03 -05:00
Maxime Deravet
0d2d25b515 Fix for #20473 - If there is no instance in the ASG, we initialize an empty array for properties['instances'] (#20475) 2017-02-01 15:29:18 -05:00
Brian Coca
86db15b105 last ditch debian release data (#20571)
fixes #10445
2017-02-01 13:15:02 -05:00
Brian Coca
91b363ea9e allow device to be list for multidev fs (#20655)
* allow device to be list for multidev fs

fixes #20551

* reverted command to string
2017-02-01 13:13:12 -05:00
René Moser
541a51ddf7 module_utils: implement deprecation warning for params (#20884)
* module_utils: implement deprecation warning for params

* rename deprecated_version to removed_in_version

* fix pep8 E121
2017-02-01 13:00:22 -05:00
Ganesh Nalawade
511f2b7907 Fix update check issue (#20915)
Add one of condition in required_if
to ensure configuration statements are
present if update value in provided in
playbook.
2017-02-01 10:48:17 -05:00
jctanner
ac78347f2b Use a -short- custom hash for controlpersist path by default (#20843)
* A method to validate and alter the ssh control path automatically.
* First tries %C to use the shortened hash
* On further failure, it removes section by section from the original path
* Fix hostname
* Implement bcoca's suggested changes
* Remove unused option
* Remove unused class var
* Use to_string to avoid unicode error
* Switch from to_text to to_bytes
* Update the example config for the new controlpath feature
2017-02-01 10:39:40 -05:00
Tom Melendez
237b39556c [GCE] External IP Address Module. (#20779)
* [GCE] External IP Address Module.

This module allows users to create and delete External IP Addresses. Both Regional and Global Addresses are supported.

* Removed whitespace causing pep8 issue
2017-02-01 10:08:02 -05:00
naslanidis
c29f52897b [cloud] New module ec2_vpc_igw_facts (#19787)
* added ec2_vpc_igw_facts module

* added cr at end of file

* corrected import json in wrong location

* corrected version added

* added snake_case conversion

* updated documentation and fixed for python 3'

* ec2_vpc_igw_facts: simplify logic

Make module arguments more 'Ansiblish'
Remove unnecessary intermediate variables in results generation
Use `ansible_dict_to_boto3_filter_list` rather than duplicating logic
Use `check_mode` rather than pass a `dryrun` argument
Update for flake8 improvements

* updated documentation
2017-02-01 09:47:47 -05:00
Peter Sprygada
406c9e01a2 moves the module utils network cli transport into a separate module (#20921)
This move will allow for the cli transport to go through a deprecation
process as we transition to network_cli plugin
2017-02-01 08:19:55 -05:00
Peter Sprygada
9ab0a49ef2 removes assert and uses to_list common function (#20866)
non impacting change to refactor assert statement out of ios shared
module
2017-02-01 08:19:15 -05:00
Ivan Bojer
327ad42ff2 new panos module to import software or configuration file into firewall (#19901)
* # This is a combination of 6 commits.
# The first commit's message is:
new module to import software or configuration file onto firewall

# This is the 2nd commit message:

changes based on the review comments; remove unecessary if statements; change returned value docstring

# This is the 3rd commit message:

empty checkin to trigger ANSIBLEbot

# This is the 4th commit message:

added additional exception handling

# This is the 5th commit message:

- added new module info to the changelog as requested

# This is the 6th commit message:

removed blank space as tox checks were failing

* new module to import software or configuration file onto firewall
2017-02-01 12:41:52 +00:00
Ganesh Nalawade
01f4d4a666 module_utils/basic.py: Support logical or condition in required_if (#20220)
* Support logical or condition in required_if

Add logical 'or' condition support in 'required_if'
for requirements.
* If requirements is a list all parameters within it should
  be present.
* If requirements is a set atleast one parameter should
  be present

* Fix review comment
2017-01-31 20:01:29 -08:00
Matt Clay
cdc56afe01 PEP 8 fixes. 2017-01-31 15:18:24 -08:00
Brian Coca
16615811b4 clean up empty warnings/deprecations from modules 2017-01-31 18:13:26 -05:00
Samuel Boucher
488acc750f Feature/lookup keyring (#18379)
* Add keyring lookup

* Better error control

* Update keyring.py

* Update keyring.py

typo
2017-01-31 17:26:19 -05:00
Matt Clay
2adc71fabc PEP 8 fix. 2017-01-31 13:38:05 -08:00
Brian Coca
f4b6b72c5b Warn reserved (#20567)
* removed unused vars

* added warning when using reserved vars

fixes #4816

* cleanup
2017-01-31 15:35:28 -05:00
Adrian Likins
b3b598c835 Rhn register misc fixes (#20724)
* Remove monkeypatching of rhn config in rhn_register

rhn_register.Rhn() was doing some complicated monkeypatching of
the up2date_client.config.Config() class to add a default config
value. Since that was only used in one place, remove the monkeypatch
and handle the single default case.

That case was 'server_url' option, so replace it with a Rhn.server_url
property. Also handle the error case when no server url is provided.

* refactoring
* flatten some indention levels
* add 'enable_eus' to module doc
* set enable_eus var and use it directly
* style/pep8/etc cleanups
* some import cleanups

types was unused, os/re were from module_utils * import

* remove * import from module_utils.redhat
* remove * imports from module_utils.base
* remove unused Rhn._subscribe method
* cleanup pep8 style stuff
* remove a unused default mutable arg from Rhn.subscribe

Rhn.subscribe() only gets called in one place, and thats
with channels from module_params which default to [] and
are typed as a list.
2017-01-31 15:23:27 -05:00
Will Thames
38ff9b735e Fix python3, fix flake8, use common code
Update exception handling, remove use of iteritems
Update for better flake8 compliance

Use ansible_dict_to_boto3_filter_list rather than
duplicating its implementation
2017-01-31 14:49:50 -05:00
Etherdaemon
2e35d5716b Remove camel_dict_to_snake_dict as this was breaking the module itself - the result is a list 2017-01-31 14:49:50 -05:00