Commit graph

17260 commits

Author SHA1 Message Date
Sloane Hertel
d8eccdda3a [cloud] make ec2 paging() more functional and add paging to ec2_lc_facts (#27355) 2017-08-01 15:06:46 -04:00
Sloane Hertel
ad2c1e1838 [cloud] ec2_customer_gateway: add routing option to allow bgp_asn to be optional (#27276)
fixes #27157

 add routing option to allow bgp_asn to be optional
2017-08-01 14:54:34 -04:00
Nathaniel Case
ec8cbbf926 Fix aruba boilerplate 2017-08-01 14:32:25 -04:00
Sloane Hertel
61ebb89fe3 improve cloudformation failures (#27427) 2017-08-01 12:23:32 -06:00
jhawkesworth
a43af128cf Add mac address to windows facts (#25803) 2017-08-01 11:13:19 -07:00
Roman Belyakovsky
42039cd436 New module: manage debian network interfaces file /etc/network/interfaces (system/interfaces_file) (#25295)
* Added new module interfaces_file

* interfaces_file: added unit tests

* interfaces_file: added golden files for unit tests

* interfaces_file: moved to system modules

* interfaces_file: fixed code formatting and convention issues
2017-08-01 12:11:43 -06:00
Brandon Davidson
4ec8744b8b Ignore main route table association when determining which associations to remove. (#23781)
They can't be removed anyway, and will just throw an error if you try to disassociate them.
2017-08-01 12:10:16 -06:00
Jens Carl
cc72dead45 New module: Add module to collect facts for Amazon Redshift Cluster (cloud/amazon/redshift_facts) (#22615)
* New module redshift_facts

Gather facts about aws Redshift cluster(s).

* Fix she-bang, PEP8 violations, and ansible metadata.

* Bump version_added to "2.4"

* Fix some typos and add supporting check mode

* Fix type of RETURN fields

Fix type of RETURN fields number_of_nodes and
automated_snapshot_retention_period from integer to int.

* Add traceback information to fail_json()
2017-08-01 12:09:55 -06:00
Nathaniel Case
c017d0c7c0 Fix fortios & netscaler boilerplate
Sorry
2017-08-01 14:02:10 -04:00
Trishna Guha
407dc2dc68 fix nxos_vrf removal failure (#27547)
Signed-off-by: Trishna Guha <trishnaguha17@gmail.com>
2017-08-01 11:51:25 -06:00
Gaurav Rastogi
23ec711494 Added flags for Federated objects used in GLSB (#27531) 2017-08-01 11:51:01 -06:00
Ganesh Nalawade
c4e06a1735 ios implementation for net_interface (#27459)
* ios implementation for net_interface

*  ios_interface implementation
*  ios_interface integration test

* net_interface integration test for ios and other refactor

* Update boilerplate and minor refactor
2017-08-01 11:50:08 -06:00
Ganesh Nalawade
70ce394840 Persistent connection timer changes (#27272)
*  Add command_timeout timer that defines the amount
   of time to wait for a command or RPC call before
   timing out.
*  Remove connect_retries and connect_interval configuration
   varaible and replace it with connect_retry_timeout to control
   the timeout value of connection to local scoket.
*  Make required changes to netowrk action plugins and relevant
   network files in module_utils.
*  Required documentation changes.
2017-08-01 11:45:45 -06:00
James Mighion
4dd8f281d6 Adding aruba_config module (#27130)
* Adding aruba_config module.

* Fixing documentation.

* Forgot action plugin.
2017-08-01 11:44:26 -06:00
George Nikolopoulos
f204e7cb33 New module: manage Citrix Netscaler content switching virtual server configuration (network/netscaler/netscaler_cs_vserver) (#26245)
* Add netscaler_cs_vserver

* Correct version_added
2017-08-01 18:43:59 +01:00
QijunPan
402ac47549 Contributing lib/ansible/modules/network/cloudengine/ce_bfd_session.py module to manage HUAWEI data center CloudEngine (#26069)
* add bfd session module

* update return doc
2017-08-01 11:40:15 -06:00
George Nikolopoulos
36537186e3 New module: manage Citrix Netscaler content switching policy configuration (network/netscaler/netscaler_cs_policy) (#26189)
* Add netscaler_cs_policy

* Correct version_added
2017-08-01 18:35:29 +01:00
Ken Celenza
7a51c5f4df make panos security rule more idempotent (#26573) 2017-08-01 11:35:18 -06:00
benthomasson
fb1583b2c2 Add last line of LLDP data (#26451) 2017-08-01 11:34:42 -06:00
George Nikolopoulos
e329c9da8c New module: manage Citrix Netscaler servicegroup configuration (network/netscaler/netscaler_servicegroup)) (#26183)
* Add netscaler_servicegroup

* Correct version_added
2017-08-01 18:34:28 +01:00
George Nikolopoulos
7df14bd2b0 New module: manage Citrix Netscaler load balancer virtual servers configuration (network/netscaler/netscaler_lb_vserver) (#26144)
* Add netscaler_lb_vserver

* Correct version_added
2017-08-01 18:33:35 +01:00
John R Barker
727a7e8a1c Correct version added 2017-08-01 18:32:02 +01:00
George Nikolopoulos
ac0c5dec2f Add netscaler_lb_monitor (#26143) 2017-08-01 11:30:47 -06:00
QijunPan
17e64f876d add bfd view module (#26070) 2017-08-01 11:28:51 -06:00
QijunPan
5b2373df16 add bfd global module (#26068) 2017-08-01 11:28:19 -06:00
Dennis Israelsson
d7202e6155 Add fabricpath support for nxos_vlan (#26013)
* Add files via upload

Fix for issue #25720

* nxos_vlan fabricpath (#25720)

Fix for issue #25720

* Add files via upload

* Add files via upload

* Delete nxos_vlan.py

* Add files via upload

* Add files via upload
2017-08-01 11:27:47 -06:00
Ganesh Nalawade
448c461940 Convert port value to integer (#25939)
Fixes #25175

convert port value to integer explicitly
2017-08-01 11:27:04 -06:00
techhelper1
a25c6b9478 ios_facts: Fixed Retrieving All IPv4 Addresses on L3 Interfaces (#25462)
* Fixed Retrieving All IPv4 Addresses on L3 Interfaces

The ios_facts module retrieving the interface subnet, would only get the primary IPv4 address on the interface and would not capture all the secondary IPs (ones that I would be set by "ip address x.x.x.x x.x.x.x secondary").

This was tested and confirmed to work on a Cisco 6500 with IOS 15.1(2)SY6.

* Fixed whitespace and if statement issues for sanity.

* Fixed spacing because sanity.
2017-08-01 11:24:02 -06:00
ikelos
03d3c6135d Convert the src entry to a templated entry. (#24026) 2017-08-01 11:19:08 -06:00
jpvrenen
b13d547621 Added result responses (#23336)
Return value 'responses' is now created in result, so it can actually be
called/used.
2017-08-01 11:18:34 -06:00
numone213
25b3f194f8 Contributing lib/ansible/modules/network/cloudengine/ce_vrrp.py module to manage HUAWEI data center CloudEngine (#22344)
* add ce vrrp

add ce vrrp

* metadata_version

* fix CI issue
2017-08-01 11:17:44 -06:00
Benjamin Jolivot
753b26ccf9 Manage Fortios/Fortigate Address (#21542)
* New module fortios_address

* Add module_utils required_if + fix Doc

* Merge spec & required_if from module_utils

* Fix pep8

* Py2.5 compat , cosmetic changes

* Fix param timeout

* Fortios_address module + integration tests

* add netaddr library in requirements for integration tests

* Pep8 problems

* ANSIBLE_METADATA.version -> ANSIBLE_METADATA.metadata_version
2017-08-01 11:17:12 -06:00
Adrian Likins
17ab546c48 Add 2.0-2.3 facts api compat (ansible_facts(), get_all_facts()) (#27294)
* Add 2.0-2.3 facts api compat (ansible_facts(), get_all_facts())

These are intended to provide compatibilty for modules that
use 'ansible.module_utils.facts.ansible_facts' and
'ansible.module_utils.facts.get_all_facts' from 2.0-2.3 facts
API.

Fixes #25686

Some related changes/fixes needed to provide the compat api:

* rm ansible.constants import from module_utils.facts.compat

Just use a hard coded default for gather_subset/gather_timeout
instead of trying to load it from non existent config if the
module params dont include it.

* include 'external' collectors in compat ansible_facts()

* Add facter/ohai back to the valid collector classes

facter/ohai had  gotten removed from the default_collectors
class used as the default list for all_collector_classes by
setup.py and compat.py

That made gather_subset['facter'] fail.
2017-08-01 12:51:33 -04:00
Chris Houseknecht
3db768f393 Removes container-enabled warning (#27578) 2017-08-01 12:51:03 -04:00
Gaurav Rastogi
dc5b826af8 New Module: Manage Avi Networks ServerAutoscale Policy (#27544) 2017-08-01 17:50:37 +01:00
Gaurav Rastogi
d3ed3dd7c3 New Module: Manage Avi Networks HardwareSecurityModuleGroup (HSM) (network/avi/avi_hardwaresecuritymodulegroup) (#27541) 2017-08-01 17:48:33 +01:00
Gaurav Rastogi
6f12abe517 New Module: Manage Avi Networks PoolGroupDeploymentPolicy (nettwork/avi/avi_hardwaresecuritymodulegroup) (#27542) 2017-08-01 17:48:16 +01:00
Gaurav Rastogi
d78d3931a1 New Module: Manage Avi Networks Traffic Clone profile (network/avi/avi_trafficcloneprofile) (#27543) 2017-08-01 17:42:16 +01:00
Gaurav Rastogi
5fe82c6b4a New Module: Manage Avi snmptrapprofile (network/avi/avi_snmptrapprofile) (#27583) 2017-08-01 17:41:51 +01:00
Gaurav Rastogi
eae1e9a351 New Module: Manage Avi Networks Scheduler (network/avi/avi_scheduler) (#27582) 2017-08-01 17:41:38 +01:00
Gaurav Rastogi
4d1bd424f4 New Module: Manage Avi Networks Backupconfiguration (network/avi/avi_backupconfiguration) (#27580) 2017-08-01 17:41:25 +01:00
Gaurav Rastogi
833d3dd5f9 New Module: Manage Avi Networks Webook (network/avi/avi_webhook) (#27579) 2017-08-01 17:41:10 +01:00
Gaurav Rastogi
279c50e43f New Module: Manage Avi Networks PriorityLabels (network/avi/avi_prioritylabels) (#27576) 2017-08-01 17:40:54 +01:00
Ganesh Nalawade
97a34cf008 Add options sub spec validation (#27119)
* Add aggregate parameter validation

aggregate parameter validation will support checking each individual dict
to resolve conditions for aliases, no_log, mutually_exclusive,
required, type check, values, required_together, required_one_of
and required_if conditions in argspec. It will also set default values.

eg:
tasks:
  - name: Configure interface attribute with aggregate
    net_interface:
      aggregate:
        - {name: ge-0/0/1, description: test-interface-1, duplex: full, state: present}
        - {name: ge-0/0/2, description: test-interface-2, active: False}
    register: response
    purge: Yes

Usage:
```
from ansible.module_utils.network_common import AggregateCollection

transform = AggregateCollection(module)
param = transform(module.params.get('aggregate'))
```

Aggregate allows supports for `purge` parameter, it will instruct the module
to remove resources from remote device that hasn’t been explicitly
defined in aggregate. This is not supported by with_* iterators

Also, it improves performace as compared to with_* iterator for network device
that has seperate candidate and running datastore.
For with_* iteration the sequence of operartion is
load-config-1 (candidate db) -> commit (running db) -> load_config-2
(candidate db) -> commit (running db) ...

With aggregate the sequence of operation is
load-config-1 (candidate db) -> load-config-2 (candidate db) -> commit
(running db)

As commit is executed only once per task for aggregate it has
huge perfomance benefit for large configurations.

* Fix CI issues

* Fix review comments

*  Add support for options validation for aliases, no_log,
   mutually_exclusive, required, type check, value check,
   required_together, required_one_of and required_if
   conditions in sub-argspec.
*  Add unit test for options in argspec.
*  Reverted aggregate implementaion.

* Minor change

* Add multi-level argspec support

*  Multi-level argspec support with module's top most
   conditionals options.

* Fix unit test failure

* Add parent context in errors for sub options

* Resolve merge conflict

* Fix CI issue
2017-08-01 09:32:18 -07:00
Will Thames
5f73bdc3bf [cloud] Improve Camel to Snake conversion in EC2 module_utils (#25015)
* Make camel_to_snake work on capitalized plurals

`TargetGroupARNs` should become `target_group_arns`, not
`target_group_ar_ns`

Promote `camel_to_snake` to top layer function but prefix
it with an underscore.

Add tests for improved `_camel_to_snake` function.

Reduce use of `re.compile` as it makes no sense when the
compilation result is not reused.

* Remove unused LooseVersion check

* Fix PLURALs case for camel_to_snake

Also renamed EXPECTED_CAMELIZATION to EXPECTED_SNAKIFICATION
2017-08-01 11:09:22 -04:00
Ganesh Nalawade
60676add33 iosxr implemetation for net_interface (#27513)
* iosxr implemetation for net_interface

*  iosxr_interface implementation

* Add integration test

*  iosxr_interface integration test
*  net_interface intergration test for iosxr

* update boilerplate
2017-08-01 20:19:54 +05:30
ossark
3290c2fc3c Added priority attribute for pool members (bigip_pool_member module) (#23128)
* Added priority attribute for pool members (bigip_pool_member module)

* Line break missing

* Change from 'priority' to 'priority_group'

* Update bigip_pool_member.py

* Update bigip_pool_member.py
2017-08-01 15:15:54 +01:00
Ganesh Nalawade
bb998a3cd2 Add fix to read correct socket path recieved from ansible-connection (#27560)
Currently socket path is send from `ansible-connection` (running as background
process) over stdout. This can conflict with debug logs that are also send on
stdout resulting in incorrect socket path received by the main process.

To avoid this add a socket path delimiter string which is recevied by
main process and socket path is retrieved based on delimiter string.

This implementation will change in future when ansible-connection
framework is made more robust.
2017-08-01 19:32:25 +05:30
hyperized
00ef894f6c Add module to list S3 buckets (#27322)
* Add module to list S3 buckets

* Move check for boto3 before boto3 is attempted to be used
2017-08-01 09:25:54 -04:00
Nikita Chernyi
889495bf7f skippy callback plugin: hides banner for skipped tasks (#18621)
* Modified skippy callback plugin

* Added original skippy.py, moved plugin to full_skip.py

* Full skip: fixed code style
2017-08-01 08:19:51 -04:00
Jiangge Zhang
891a8ad2fe Proposed new notification module: BearyChat (#21947)
* Add new notification module: BearyChat integration

BearyChat (https://bearychat.com) is a Slack alternative service.

* Remove implicit args and change position of module.fail

* Update the metadata of bearychat module
2017-08-01 12:47:47 +01:00
Will Thames
f972994662 [cloud] fix VPC behavior for ec2_group module, improve integration tests (#27038)
* Add tests for group in a VPC

* Improve ec2_group output and documentation

Update ec2_group to provide full security group information
Add RETURN documentation to match

* Fix ec2_group creation within a VPC

Ensure VPC ID gets passed when creating security group

* Add test for auto creating SG

* Fix ec2_group auto group creation

* Add backoff to describe_security_groups

Getting LimitExceeded from describe_security_groups is definitely
possible (source: me) so add backoff to increase likelihood of
success.

To ensure that all `describe_security_group` calls are backed off,
remove implicit ones that use `ec2.SecurityGroup`. From there,
the decision to remove the `ec2` boto3 resource and rely on the client
alone makes good sense.

* Tidy up auto created security group

Add resource_prefix to auto created security group and delete
it in the `always` section.
Use YAML argument form for all module parameters
2017-08-01 06:53:43 -04:00
Jordan Borean
7a7a0cae94 win_service: added support for paused services (#27216)
* win_service: added support for paused services

* change pausable service for local computers

* more fixes for older hosts

* sigh

* skip pause tests for Server 2008 as it relies on the service
2017-08-01 18:48:14 +10:00
Pilou
49b8bd0358 Fix broken import in utilities.helper._accelerate (#27088)
* Fix py3 compatibility using six.moves.socketserver

* Remove useless call to str
2017-07-31 22:05:46 -07:00
Jordan Borean
1517db06c5 fix to alllow the winrm plugin to send input with Python 3 (#27474) 2017-07-31 18:35:05 -07:00
Chris Houseknecht
e2651d4bac Give precedence to user supplied --roles-path option (#27524) 2017-07-31 18:46:49 -04:00
Ozi Boms
16d23e96c5 Add reference to VNET resource group (#26052)
* Add reference to VNET resource group

When creating a new virtual machine, added new parameter to allow creation of VM in a resource group using virtual network from another resource group

* Fixed white space errors

Was getting compialtion errors with code and just went around and cleaned up extra white spaces and such.

* Re-fixed more white space issues

* Fixed Version Number for new parameter

* specified exceptions

Use clouderror instead of exceptions for finidng virtual network

* Simplified code lines

created a local variable to either use the VNET resource group or the VM resource group and then used whichever was available as a parameter

* fixed syntax issue with newline

...hopefully

* removed superfluous default/required from docs

* fix vm_size default
2017-07-31 15:29:51 -07:00
Ganesh Nalawade
7cf4416c9c Fix junos_netconf integration test failure (#27528) 2017-08-01 02:25:52 +05:30
Toshio Kuratomi
0b9a78f0b3 Remove wildcard, add boilerplate and get rid of get_exception
* smaller collections of database modules
* Some of the smaller collections of network modules
2017-07-31 13:51:38 -07:00
Ryan Sabatini
f65f3570a8 Add Ability to Exlude Paths from Archive
Archive.py allows you to pass a glob path of files to archive.
This allows end users to glob a dir, and exlude a list of dirs
from the archive which are not necessary.
2017-07-31 11:46:16 -07:00
Andrew Saraceni
7b3d893f2d New Module: Manage Windows local group membership (win_group_member) (#26307)
* initial commit for win_group_member module

* fix variable name change for split_adspath

* correct ordering of examples/return data to match documentation verbiage

* change tests setup/teardown to use new group rather than an inbult group
2017-07-31 11:10:57 -07:00
Matt Davis
91f4c37ed7 rename legacy PS module_utils to remove PowerShell prefix (#27495) 2017-07-31 10:06:12 -07:00
Brian Coca
b79744f282 make random_choice more error resilient (#27380)
* make random_choise more error resilient

fixes #27373

* missing imports

* PEEP 16
2017-07-31 11:44:53 -04:00
Gaurav Rastogi
e575ff8d8d New Module: Manage Avi Networks Microservicegroup (network/avi/avi_microservicegroup) (#26209) 2017-07-31 15:29:09 +01:00
Gaurav Rastogi
69c4f90f7d New Module: Manage Avi Networks VRF Context Objects (networks/avi/avi_backup) (#26204) 2017-07-31 15:23:28 +01:00
Gaurav Rastogi
202cbd3421 New Module: Manage Avi Networks Serviceengine (network/avi/avi_serviceengine) (#26210) 2017-07-31 15:22:16 +01:00
Gaurav Rastogi
51ff3dba68 New Module: Manage Avi Networks IPAM DNS provider profiles (network/avi/avi_ipamdnsproviderprofile) (#26207) 2017-07-31 15:21:06 +01:00
Gaurav Rastogi
1e6fd571e1 New Module: Manage Avi Networks Cluster objects (networks/avi/avi_cluster) (#26205) 2017-07-31 15:14:28 +01:00
Gaurav Rastogi
0424919fe6 New Module: Manage Avi Networks AlertSyslogConfig (network/avi/avi_alertsyslogconfig) (#26215) 2017-07-31 15:12:53 +01:00
Gaurav Rastogi
1da76772f8 New Module: Manage Avi Networks AlertScriptConfig (network/avi/avi_alertscriptconfig) (#26214)
* New Module: Manage Avi Networks AlertScriptConfig (network/avi/avi_alertscriptconfig)

* updated example to not include python import as it fails sanity test
2017-07-31 15:12:15 +01:00
Gaurav Rastogi
d2ec5462bc New Module: Manage Avi Networks AlertEmailConfig (network/avi/avi_alertemailconfig) (#26213) 2017-07-31 15:11:24 +01:00
Gaurav Rastogi
2589d640dd New Module: Manage Avi Networks AlertConfig (network/avi/avi_alertconfig) (#26212) 2017-07-31 15:08:05 +01:00
Gaurav Rastogi
a8caff169e New Module: Manage Avi Networks ActionGroupConfig (network/avi/avi_actiongroupconfig) (#26211) 2017-07-31 15:07:42 +01:00
John R Barker
66adb3d993 Correctly reference variables (#27486) 2017-07-31 14:26:15 +01:00
Martin Krizek
19d119f43c Pass server_hostname from task to subscription-manager (#27420) 2017-07-31 09:15:15 -04:00
saichint
350018de73 nxos_vxlan_vtep fixes and integration tests (#27405)
* fix issue 27404

* conflict resolve
2017-07-31 08:37:31 -04:00
Dag Wieers
97aaf103e8 ACI module_utils library for ACI modules (#27070)
* ACI module_utils library for ACI modules

This PR includes:
- the ACI argument_spec
- an aci_login function
- an experimental aci_request function
- an aci_response function
- included the ACI team

* New prototype using ACIModule

This PR includes:
- A new ACIModule object with various useful methods
2017-07-31 12:44:27 +01:00
Abhijeet Kasurde
e419a55c71 Add correct URL for docker guide (#27465)
Fixes : #27463

Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
2017-07-30 10:08:43 +01:00
Toshio Kuratomi
4109a82d0a remove wildcards and add boilerplate
* cloud/centurylink
* source_control
* cloud/google
* notification
* cloud/rackspace
* cloud/vmware
2017-07-29 14:13:30 -07:00
Toshio Kuratomi
9a55487dff Remove get_exception usage from amazon modules 2017-07-29 07:02:12 -07:00
Toshio Kuratomi
8de6cff2b1 more wildcards 2017-07-29 07:02:12 -07:00
Toshio Kuratomi
1ee08c0f06 Get rid of more wildcard imports and add boilerplate to more modules
This commit cleans up the following module categories:
* messaging
* inventory
* crypto
* commands
* clustering
* cloud/webfaction
* cloud/docker
* cloud/digital_ocean
2017-07-29 07:02:12 -07:00
Toshio Kuratomi
4e6cce354e Remove wildcard imports
Made the following changes:

* Removed wildcard imports
* Replaced long form of GPL header with short form
* Removed get_exception usage
* Added from __future__ boilerplate
  * Adjust division operator to // where necessary

For the following files:

* web_infrastructure modules
* system modules
* linode, lxc, lxd, atomic, cloudscale, dimensiondata, ovh, packet,
  profitbricks, pubnub, smartos, softlayer, univention modules
* compat dirs (disabled as its used intentionally)
2017-07-28 22:10:17 -07:00
Toshio Kuratomi
0a2cdb2585 New tests for copy recursive with absolute paths
Absolute path trailing slash handling in absolute directories

find_needle() isn't passing a trailing slash through verbatim.  Since
copy uses that to determine if it should copy a directory or just the
files inside of it, we have to detect that and restore it after calling
find_needle()

Fixes #27439
2017-07-28 21:00:51 -07:00
giovannisciortino
7cfd02097c add_hosts.py: Fix add_host does not recognise 'host' alias (#27418)
* add_hosts.py: Fix add_host does not recognise 'host' alias

* add_hosts.py: add note in documentation that 'hosts' alias of name parameter is only available on >=2.4
2017-07-28 17:35:20 -04:00
Adrian Likins
934b645191 Support multiple vault passwords (#22756)
Fixes #13243

** Add --vault-id to name/identify multiple vault passwords

Use --vault-id to indicate id and path/type

 --vault-id=prompt  # prompt for default vault id password
 --vault-id=myorg@prompt  # prompt for a vault_id named 'myorg'
 --vault-id=a_password_file  # load ./a_password_file for default id
 --vault-id=myorg@a_password_file # load file for 'myorg' vault id

vault_id's are created implicitly for existing --vault-password-file
and --ask-vault-pass options.

Vault ids are just for UX purposes and bookkeeping. Only the vault
payload and the password bytestring is needed to decrypt a
vault blob.

Replace passing password around everywhere with
a VaultSecrets object.

If we specify a vault_id, mention that in password prompts

Specifying multiple -vault-password-files will
now try each until one works

** Rev vault format in a backwards compatible way

The 1.2 vault format adds the vault_id to the header line
of the vault text. This is backwards compatible with older
versions of ansible. Old versions will just ignore it and
treat it as the default (and only) vault id.

Note: only 2.4+ supports multiple vault passwords, so while
earlier ansible versions can read the vault-1.2 format, it
does not make them magically support multiple vault passwords.

use 1.1 format for 'default' vault_id

Vaulted items that need to include a vault_id will be
written in 1.2 format.

If we set a new DEFAULT_VAULT_IDENTITY, then the default will
use version 1.2

vault will only use a vault_id if one is specified. So if none
is specified and C.DEFAULT_VAULT_IDENTITY is 'default'
we use the old format.

** Changes/refactors needed to implement multiple vault passwords

raise exceptions on decrypt fail, check vault id early

split out parsing the vault plaintext envelope (with the
sha/original plaintext) to _split_plaintext_envelope()

some cli fixups for specifying multiple paths in
the unfrack_paths optparse callback

fix py3 dict.keys() 'dict_keys object is not indexable' error

pluralize cli.options.vault_password_file -> vault_password_files
pluralize cli.options.new_vault_password_file -> new_vault_password_files
pluralize cli.options.vault_id -> cli.options.vault_ids

** Add a config option (vault_id_match) to force vault id matching.

With 'vault_id_match=True' and an ansible
vault that provides a vault_id, then decryption will require
that a matching vault_id is required. (via
--vault-id=my_vault_id@password_file, for ex).

In other words, if the config option is true, then only
the vault secrets with matching vault ids are candidates for
decrypting a vault. If option is false (the default), then
all of the provided vault secrets will be selected.

If a user doesn't want all vault secrets to be tried to
decrypt any vault content, they can enable this option.

Note: The vault id used for the match is not encrypted or
cryptographically signed. It is just a label/id/nickname used
for referencing a specific vault secret.
2017-07-28 15:20:58 -04:00
James Mighion
a328e96455 Adding aireos_config module (#27408)
* Adding aireos_config module.

* Fixing pep8 W291.
2017-07-29 00:36:04 +05:30
Toshio Kuratomi
cce06c5a3b Fix _get_file_contents to return bytes and checking that a different file exists than it opens 2017-07-28 11:07:43 -07:00
fredericve
095560771c Fixes #17958: use stderr instead of the default stdout for fatal errors (#17962)
* add a callback plugin that sends failures to stderr

* fix warnings
2017-07-28 10:50:15 -07:00
Ganesh Nalawade
43bd993fac Fix fetch configuration in junos_command (#26392)
* Fix fetch configuration in junos_command

Fixes #26358 Add support to fetch configuration
from device in `xml`, `text`, `json`, `set` display
format.

* Add error message if set display is not supported

* Throw error in case of warning for show commands
2017-07-28 23:06:21 +05:30
Mike Wiebe
07b097af7c Fix nxos portchannel force option (#27190)
* Add integration tests

* Fix force option

* Enable nxos_portchannel test

* Satisfy ansibot demands
2017-07-28 13:06:41 -04:00
Nathaniel Case
fb2b3de5e4 Fix nxos_vtep_vni typo 2017-07-28 13:04:08 -04:00
Marko Stanković
0ebc80cbd6 Fix a typo in win_iis_webapplication.ps1 (#27417)
introduced with https://github.com/ansible/ansible/pull/26082/files#diff-bd862e2bbcb44c9c332df7b6cacf6adaR74
2017-07-28 17:24:08 +01:00
David Newswanger
c594f1e1c9 fixed nontype error (#27428) 2017-07-28 21:50:09 +05:30
David Newswanger
3b1f2aeb16 Iosxr attribute error #27122 (#27425)
* WIP fixing iosxr_logging idempotency

* remove debug stuff from module, add teardown section to start of test
2017-07-28 20:07:34 +05:30
Martin Krizek
36c6d0f748 fetch: fail if flat=yes and dest=existing-dir w/o trailing slash 2017-07-28 09:53:50 -04:00
Trishna Guha
6d1bd33aa5 fix iosxr_banner (#27378)
Signed-off-by: Trishna Guha <trishnaguha17@gmail.com>
2017-07-28 17:09:04 +05:30
Simon Dodsley
26c9007c2d Add Pure Storage Volume module (#26357)
Update documentation to fix typos and define the extend feature
Force size to be a required variable on create as requested.
Change type to bool
2017-07-28 11:24:31 +01:00
Sloane Hertel
91781487ab aws_kms: don't append to unicode - fixes #25786 (#27352)
* AWS key management service fix; statement may not have a principal, and if there is only one AWS principal it will not be a list as expected. Fixes 25786.

* remove len(), only catch exception in function for json.dumps() failure

* use a defined variable and make formatting python 2.6 compatible
2017-07-28 19:36:37 +10:00
Yanis Guenane
9e41fd399b Removing openssl_publickey from pep8 legacy files (#27414) 2017-07-28 11:10:02 +02:00
Trishna Guha
a49c419651 fix nxos_vrf_af nxapi & cli (#27307)
* fix nxapi failure #27142

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

* fix nxos_vrf_af nxapi and cli

Signed-off-by: Trishna Guha <trishnaguha17@gmail.com>
2017-07-28 09:02:02 +05:30
Matt Clay
51bd07204b Revert "Revert "Allow ini plugin to load file using other encoding than utf8." (#27407)"
This reverts commit 520696fb39.
2017-07-27 18:15:56 -07:00
Toshio Kuratomi
520696fb39 Revert "Allow ini plugin to load file using other encoding than utf8." (#27407)
* Revert "Update conventions in azure modules"

This reverts commit 30a688d8d3.

* Revert "Allow specific __future__ imports in modules"

This reverts commit 3a2670e0fd.

* Revert "Fix wildcard import in galaxy/token.py"

This reverts commit 6456891053.

* Revert "Fix one name in module error due to rewritten VariableManager"

This reverts commit 87a192fe66.

* Revert "Disable pylint check for names existing in modules for test data"

This reverts commit 6ac683ca19.

* Revert "Allow ini plugin to load file using other encoding than utf8."

This reverts commit 6a57ad34c0.
2017-07-27 17:08:31 -07:00
Toshio Kuratomi
30a688d8d3 Update conventions in azure modules
* Remove wildcard imports
* Update GPL header to the one-line form
* Add from __future__ imports
2017-07-27 15:37:26 -07:00
Toshio Kuratomi
6456891053 Fix wildcard import in galaxy/token.py 2017-07-27 15:37:26 -07:00
Yannig Perré
6a57ad34c0 Allow ini plugin to load file using other encoding than utf8.
- New option for ini plugins: encoding
  - Add a new option encoding to _get_file_contents
  - Use replace option in test/runner/lib/util.py when calling decode on stdout/err
    output when diff have non-utf8 sequences
2017-07-27 14:20:18 -07:00
Josh Bradley
31b27819e1 adding lookup plugin for chef_databags (#18403)
* adding lookup plugin for chef_databags

* add missing classes for code-smell
2017-07-27 16:42:32 -04:00
mzizzi
9817ec84a0 [cloud] cast tag values to strings in ansible_dict_to_boto3_tag_list utility (#27396)
* ansible_dict_to_boto3_tag_list cast tag values to string

* ansible_dict_to_boto3_tag_list cast with to_native
2017-07-27 16:15:05 -04:00
David Newswanger
81151ef02c Remove Deprecated Template network modules (#27076)
* removed deprecated networking template modules

* update changelog

* update changelog
2017-07-27 19:40:11 +01:00
mesk41in
0fb64214a4 add support of nested groups in group_by 2017-07-27 11:37:34 -04:00
Trishna Guha
7351ee9a76 fix nxos_interface multiple issues (#27106)
* fix execute_show_command

* fix pep8 issues

* fix AttributeError #26562

* legacy-file remove

* modify execute_show_command output

* fix admin_state up doc

* fix admin_state for all interfaces doc

Signed-off-by: Trishna Guha <trishnaguha17@gmail.com>
2017-07-27 19:23:35 +05:30
saichint
9b9a8749da Add integration tests and fix nxos providers (#26913)
* fix issues with python3.x

* Add integration testa and fix for nxos_evpn_vni

* add nxos_evpn_vni to nxos.yaml

* fix get_vtp_config()

* add new integration tests

* fix rollback

* add integration test files
2017-07-27 09:32:35 -04:00
Nathaniel McAuliffe
c94c2831da extracting list from CustomerGateways to match create (#24897)
* Limiting CustomerGateway to dictionary within list of CustomerGateways

* Copying CustomerGateways[0] to CustomerGateway only if it exsits
2017-07-27 09:12:20 -04:00
Trishna Guha
2eaf3571f3 fix state absent nxos_hsrp (#27366)
Signed-off-by: Trishna Guha <trishnaguha17@gmail.com>
2017-07-27 14:28:46 +05:30
Anil Kumar Muraleedharan
81a9dada1c Added no shutdown command to list (#27360) 2017-07-27 09:53:46 +01:00
Evan Kaufman
589e8fd6bc Added warning for cron jobs containing line breaks (#19184)
Fixes ansible/ansible-modules-core#4312, moved from ansible/ansible-modules-core#4488
2017-07-27 02:19:36 -04:00
Dan O'Brien
d2f34754b2 fixing defaults (#23874)
* fixing defaults

* setting default to null

* setting default values back to null, remove backupsenabled(never used)

* fixing code smell

* whitespace, remove required statement

* doc changes
2017-07-26 21:12:15 -07:00
acrewdson
0f2b3d55b4 'Response' makes more sense here than 'request' 2017-07-26 16:35:49 -07:00
Matt Davis
3f1ec6b862 add custom module type validation (#27183)
* Module argument_spec now accepts a callable for the type argument, which is passed through and called with the value when appropriate. On validation/conversion failure, the name of the callable (or its type as a fallback) is used in the error message.
* adds basic smoke tests for custom callable validator functionality
2017-07-26 16:12:50 -07:00
Matt Davis
53ebe8d441 coerce azure securitygroup priority to int (#27354)
* fixes #22686
* would be better served in the future by using subspec, but it's in too much flux right now
2017-07-26 16:09:31 -07:00
mdawid92
bfdf85e002 [cloud] IAM module returns created keys (#21237)
* return new key, porting https://github.com/ansible/ansible-modules-core/pull/3385/ by defionscode

* fix python3 compatibility

* fixed indentation

* added user_meta field
2017-07-26 16:24:29 -04:00
Brian Coca
b93b9e68d7 ensure prefix in plugin loading to avoid conflicts
when using 'all' to load all plugins were ending in main namespace
creating conflicts with each other and random modulesr
 i.e. when trying to access json callback we were getting json 'parsing' lib
2017-07-26 11:54:13 -04:00
Trishna Guha
498bf4b5be change collection to aggregate (#27325)
Signed-off-by: Trishna Guha <trishnaguha17@gmail.com>
2017-07-26 20:36:56 +05:30
Martin Krizek
119c9e5d6e Fix using DNF group upgrade/remove api 2017-07-26 07:39:26 -07:00
David Newswanger
8643e9cb34 changed collection arg to argregate on 2.4 network modules (#26649)
* changed collection arg to argregate on 2.4 network modules

* replace users with aggregate in eos_user, junos_user, nxos_user

* added version_added to places where we replaced users with aggregate in the docs

* fix ios_static_route test

* update tests to reference aggregate instead of collection/users
2017-07-26 10:09:17 -04:00
Pilou
9d771f6eea filesystem: workaround bug in xfs_info, use xfs_growfs instead (#25703)
xfs_info is a bash script located in /usr/sbin/ (/sbin is a symlink to
/usr/sbin/) which calls xfs_growfs command. When neither /sbin nor
/usr/sbin are in the PATH environment variable, filesystem module is able to
call xfs_info because /sbin path is hardcoded in get_bin_path method, then
xfs_growfs isn't found because neither /sbin nor /usr/sbin are in the
PATH environment variable.

"xfs_growfs -n" could be used directly instead of xfs_info, the man page
states that: "xfs_info is equivalent to invoking xfs_growfs with the -n
option".

Fixes #24823.
2017-07-26 08:47:12 -04:00
René Moser
bb5b1680f8 composer: docs: fix conflicting statement about defaults (#27313) 2017-07-26 12:43:13 +02:00
Abhijeet Kasurde
b2d609b6f1 Add testcase for ipify_facts (#26421)
Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
2017-07-26 12:16:10 +02:00
Rene Moser
e2914a45e1 cloudstack: make facts run in check mode 2017-07-26 11:55:53 +02:00
René Moser
c16b1844a9 cloudstack: cs_facts: add option for custom meta data host (#27290) 2017-07-26 11:49:15 +02:00
Arthur Burkart
90a42d1e53 Updates docs to match module behavior (#26658)
* Updates docs to match module behavior

* Updates docs to match module behavior

Updated using advice from jimi-c

* Removes snippet about git module before v1.8.3

At suggestion of robinro
2017-07-25 23:21:23 -07:00
Trishna Guha
41ce724801 fix nxos_hsrp (#27306)
* fix nxos_hsrp

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

* modify nxos_hsrp test

Signed-off-by: Trishna Guha <trishnaguha17@gmail.com>
2017-07-26 11:38:55 +05:30
Samuel Boucher
5fbd42eca5 Update svc.py
Killed is a valid state
2017-07-25 22:07:51 -04:00
Toshio Kuratomi
225fa5d092 Fix undefined variables, basestring usage, and some associated python3 issues 2017-07-25 15:58:23 -07:00
Toshio Kuratomi
9f7b0dfc30 Remove automatic use of system six
* Enable the pylint no-name-in-module check.  Checks that identifiers in
  imports actually exist.  When we do this, we also have to ignore
  _MovedItems used in our bundled six.  This means pylint won't check
  for bad imports below ansible.module_utils.six.moves but that's
  something that pylint punts on with a system copy of six so this is
  still an improvement.
* Remove automatic use of system six.  The exec in the six code which
  tried to use a system library if available destroyed pylint's ability
  to check for imports of identifiers which did not exist (the
  no-name-in-module check).  That test is important enough that we
  should sacrifice the bundling detection in favour of the test.
  Distributions that want to unbundle six can replace the bundled six in
  ansible/module_utils/six/__init__.py to unbundle.  however, be aware
  that six is tricky to unbundle.  They may want to base their efforts
  off the code we were using:

  2fff690caa/lib/ansible/module_utils/six/__init__.py

* Update tests for new location of bundled six Several code-smell tests
  whitelist the bundled six library.  Update the path to the library so
  that they work.

* Also check for basestring in modules as the enabled pylint tests will
  also point out basestring usage for us.
2017-07-25 15:58:23 -07:00
Jason Tibbitts
ccce74cf7b Avoid using deprecated group_install API
DNF's base.group_install() function accepts a string as its first
argument.  Prior to DNF-2, compatibility code existed which allowed this
function to accept a base.comps.Group object instead.  That is no longer
possible.

Pass "group.id" to base.group_install() instead of "group" to work
around this.
2017-07-25 15:34:22 -07:00
Abhijeet Kasurde
1c87721a86 Add missing import for basic_auth_argument_spec (#27207)
Fix adds a missing import for basic_auth_argument_spec in
netapp module_utils.

Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
2017-07-26 07:05:13 +10:00
Brian Coca
4fba9bf23b revert action loader changes to doc, due to error
restoring behaviour in which a missing module is a warning that shows paths searched,
patch incorrectly bypassed detection and ended up in an exception: global name 'module' is not defined
2017-07-25 16:33:30 -04:00
Michael Scherer
4811c7f117 Permit to have a action plugin without a empty module file
Currently, someone writing a action plugin will also need
to have a empty file in the module path to avoid triggering
the error "no action detected in task.".
2017-07-25 15:11:56 -05:00
Toshio Kuratomi
0d290bddda Port cs_facts to the ansible 2.4 facts API (#27257)
* Port cs_facts to the ansible 2.4 facts API

Fixes #27256
References #27254
2017-07-25 12:08:54 -07:00
Toshio Kuratomi
197a360977 Fix undefined vars on python3 and a whole bunch of other cleanup. (#27202)
* Fix undefined vars on python3 and a whole bunch of other cleanup.

References #27193

* No need to catch exception and reraise.  This just obfuscates the traceback
* Build up a list and then join at the end instead of building up a string. list.append() is faster than string concatenation
* No need to extract k, v pairs from one dict to make a second dict and then extract k, v pairs from the second dict.  Iterate over the k, v pairs extracted from the first dict directly instead of building the second dict.
* No need to check if the dict is empty before iterating on it.  Iterating on an empty dict will automatically go to the end of the loop
* Use isinstance instead of type(obj) is class, handles inheritance and is better style
* use to_native instead of v.encode().  We can use the surrogate_or_strict error handler to deal with more potential tracebacks.  Does the right conversion on both Py2 and Py3.
* Convert bool to string before combining it with the string we're building.
* Don't reference unicode directly as unicode does not exist in Python3
* The string resulting from this function will not have a trailing comma
* Simplify the conversion to string int and bool values are now used in string formatting which will use str to transform them without an explicit invocation.
2017-07-25 10:51:53 -07:00
René Moser
a566a7ea2e cloud: cs_user: add feature keys handling (#27285) 2017-07-25 18:07:58 +02:00
Ricardo Carrillo Cruz
3a3bdde869 Fix multiple code and test issues on iosxr (#27267)
* Fix multiple code and test issues on iosxr

It passes the integration tests now.
Fixes #27123

* Fix pep8 issue

* Fix unit tests
2017-07-25 17:21:53 +02:00
TSDominguez
b9a2dc979f Add dist-upgrade and extra_args to zypper module (#21313)
* Implement state='dist-upgrade'

Implements `zypper dist-upgrade` for the zypper module. This follows
how `zypper upgrade` is invoked, except `state='dist-upgrade'`.

Setting name to anything other than '*' would cause the module to error
out. `dist-upgrade` affects all packages and would not make sense to
apply to a specific package.

* Implement option extra_args

Add option to append additional arguments to zypper command. This
should be able to accommodate other options that are not (yet) covered
by zypper module.

Arguments are given as if written in the command line, complete with
dashes.
2017-07-25 11:12:29 -04:00
Abhijeet Kasurde
dfb97b2728 Remove excessive imports from cloudformation_facts (#27209)
Fix removes excessive imports from cloudformation_facts module.

Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
2017-07-25 10:53:17 -04:00
James Cammarata
df8fde4d78 Add cookie parsing to fetch_url/open_url
This patch adds cookie parsing to the fetch_url/open_url module_utils
method. The overall result will still contain the key `set_cookie`, however
an additional key (`cookies`) will also be present. This new field is a
dictionary of values. Overall, this should make looking for individual
cookies in the response much easier, as currently the `set_cookie` field
is an amalgamation of the returned set-cookie headers and can be somewhat
difficult to parse.
2017-07-25 10:16:34 -04:00
Eric Johnson
09e9203844 [google] adding a GCE labels module 2017-07-25 09:36:33 -04:00
Yanis Guenane
35ba6d469e openssl_publickey: Standardize implementaton of the module
The OpenSSLObject class has been merged[1]. This commit makes the
openssl_publickey rely on this class and standardize the way openssl
module should be written.

[1] #26945
2017-07-25 15:31:11 +02:00
Yanis Guenane
d72ac0b391 openssl_privatekey: Standardize implementaton of the module
The OpenSSLObject class has been merged[1]. This commit makes the
openssl_privatekey rely on this class and standardize the way openssl
module should be written.

Co-Authored-By: Christian Pointner <cpointner@mgit.at>

[1] https://github.com/ansible/ansible/pull/26945
2017-07-25 15:31:11 +02:00
Toshio Kuratomi
8b34e31e05 Remove the error checking from apply_patch()
The error checking would itself cause a traceback.  The load_config()
function that we'd need to check for errors from only returns None so
there's no way to check for errors via the return value.  In the future
someone could rewrite the load_config function to return useful
information and restore the error checking but for now this is better as
it won't traceback on success and it will let us turn on static analysis
of undefined variables

Fixes #27255
References #27254
2017-07-25 06:12:44 -07:00