Commit graph

17302 commits

Author SHA1 Message Date
Christian Pointner
1ce2bf56a2 crypto/openssl_*: Standardize implementaton and add support keyUsage, extenededKeyUsage (#27281)
* openssl_csr: make subjectAltNames a list

* csr module now uses the new standard way to build openssl crypto modules

* add check functions for subject and subjectAltNames

* added support for keyUsage and extendedKeyUsage

* check if CSR signature is correct (aka the privatekey belongs to the CSR)

* fixes for first PR review

* fixes for second PR review

* openssl_csr: there is no need to pass on privatekey as it can be accessed directly

* openssl_csr: documentation fixes
2017-08-03 12:27:17 +01:00
rahushen
e0f482a8c5 Fixes #27340 - make indent consistent for nxos_config (#27652) 2017-08-03 07:09:31 -04:00
Trishna Guha
3da9607203 fix unexpected key argument for eos_config replace (#27683)
Signed-off-by: Trishna Guha <trishnaguha17@gmail.com>
2017-08-03 14:08:23 +05:30
Trishna Guha
91a9564b3b modify indent to avoid re-run of src template fail (#27686)
Signed-off-by: Trishna Guha <trishnaguha17@gmail.com>
2017-08-03 12:58:27 +05:30
Felipe Garcia Bulsoni
b060d0ccba Initial commits for integration of HPE OneView resources with Ansible (#26026)
* Initial commit for integration of HPE OneView resources with Ansible Core. Adding FC Network and FC Network Fact modules and unit tests, and OneView base class for all OV resources.
2017-08-02 19:54:32 -07:00
James Mighion
baaa1ef2ec Sanitizing all responses from aireos. (#27660) 2017-08-02 22:01:38 +01:00
Eduard Iskandarov
a1abe7d941 add kubernetes beta resources to clustering/kubernetes module (#18953) 2017-08-02 16:41:12 -04:00
Adrian Likins
6fbd0a8bb5 Add set_fact_persistent action and module. (#26153)
* Add 'cacheable' param to  set_fact action and module.

Used just like set_fact, except facts set with cacheable: true
will be stored in the fact cache if fact caching is enabled.

set_fact normally only sets facts in the non_persistent_fact_cache, so they
are lost between invocations.

* update set_facts docs

* use 'ansible_facts_cacheable' in module/actions result

* pop fact cacheable related items out of args/results

We dont want to use 'ansible_facts_cacheable' result item
or 'cacheable' arg as actual facts, so pop them out of the
dicts.
2017-08-02 15:57:58 -04:00
jctanner
e1abed28ba Fix version_added from #21822 (#27665) 2017-08-02 15:34:08 -04:00
jctanner
93f98effe9 Update version added from #20777 (#27662) 2017-08-02 15:33:55 -04:00
Chekov2k
a0370b8254 Add pv_options to lvg module so that, for example, metadatasize can b… (#21822)
* Add pv_options to lvg module so that, for example, metadatasize can be specified (e.g. for openstack cinder volumes)

* Fixing version added
2017-08-02 15:08:32 -04:00
mwellmeyer
54a3bcc4ec add iptables tcp-flags option (#20777)
* add iptables tcp-flags option

* fix invalid character in iptables documentation

* fix wrong default value for tcp_flags in the documentation
2017-08-02 14:54:00 -04:00
Sloane Hertel
b0efbc5418 [cloud] ec2_vpc_igw: fix check mode - fixes #27490 (#27637)
Fix check mode for adding/removing tags; boto's DryRun is not equivalent to check mode.

Fixes #27490
2017-08-02 13:47:13 -04:00
Sloane Hertel
c02deef454 [cloud] filter by vpc and subnet if provided before terminating instances (#27394) 2017-08-02 13:43:24 -04:00
piotrkarbowski-ciklum
a260d99f74 ec2_ami_copy.py: Fix WaiterError handling. (#27416)
* ec2_ami_copy.py: Fix WaiterError handling.

Change suggested by Adam Johnson at https://github.com/ansible/ansible/issues/26971

* ec2_ami_copy.py: WaiterError: fail_json: add exception parameter.

* ec2_ami_copy.py: import traceback
2017-08-02 13:05:08 -04:00
Toshio Kuratomi
e992e4f436 Add missing copyright header in modules cleaned up yesterday 2017-08-02 09:53:28 -07:00
Abhijeet Kasurde
5e2184c683 Fixing broken imports and get_exception for ipa
Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
2017-08-02 09:53:02 -07:00
Brandon Davidson
3d20a2ea82 Fix typo in cloud/amazon/ec2_vpc_nacl_facts (#27534) 2017-08-02 12:26:28 -04:00
Abhijeet Kasurde
be58fa979d Fix broken import in cloudformation
* Fix imports
* Add new GPLv3 Licence

Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
2017-08-02 09:05:25 -07:00
Nathaniel Case
123b5e222f nxos_bgp_neighbor fixes (#27348)
* Fix `timers` idempotency

* `shutdown` is not documented as having a `default` option

* dynamic_capability is the inverse of BOOL_PARAMS
2017-08-02 11:07:46 -04:00
Adrian Likins
27a015f0ad add a 'min' type for gather_subset to collect nothing (#27085)
previously gather_subset=['!all'] would still gather the
min set of facts, and there was no way to collect no facts.

The 'min' specifier in gather_subset is equilivent to
exclude the minimal_gather_subset facts as well.

   gather_subset=['!all', '!min'] will collect no facts

This also lets explicitly added gather_subsets override excludes.

   gather_subset=['pkg_mgr', '!all', '!min'] will collect only the pkg_mgr
fact.
2017-08-02 11:04:01 -04:00
DavidVentura
c85b36d220 Fix Proxmox module crashing if the hostname doesn't exist and there's no vmid (#21305)
* fail the execution instead of panicking when the hostname is not found and the vmid was not provided

* return an empty vmid list if the hostname doesn't exist
2017-08-02 15:42:05 +01:00
mharista
c85f363aaa Add module cv_server_provision for integration with Arista CloudVision Portal. (#25450)
* Add module cv_server_provision for integration with Arista CloudVision Portal.

* Doc update.

* Remove shebang from test file. Update short description with company and product name.

* Update exception syntax to Python3 style.

* Remove blank line between imports.

* Remove newlines from RETURN documentation.

* Add cvprac to unittest requirements.

* Update unittest format. Add a few additional tests.

* Mock exceptions from cvprac so the library is not needed for unittests.

* Mock cvprac imports.

* Update unit tests to support python 3.5.

* Mock full cvprac library for unittests.

* Update Jinja2 import to pass updated CI checks.

* Update cvprac imports format for new CI tests.

* Add __metaclass__ and __future__.
2017-08-02 15:24:52 +01:00
Simon Dodsley
7fbd924cbb Add Pure Storage Host Group module (#26355) 2017-08-02 15:22:05 +01:00
Simon Dodsley
b3865b173d Add Pure Storage Protection Groups module (#26356)
Update documentation to be correct
Change type to bool
2017-08-02 15:20:58 +01:00
jctanner
baf1ed9100 [WIP] Create preserved_copy function in basic.py to perserve file ownership. (#27344)
Create preserved_copy function in basic.py to perserve file ownership.

* Add a test for template preserved backup
* Use a script to get the random names
* bytes to strings
* Remove dump of hostvars
* Stop being fancy and create a testuser instead
* Fix pep8
* set file attributes
* Pass the correct data to set_attributes_if_different
* Use -j instead -b and pass the attributes as a string instead of a list
* remove debugging message
* Use shell to softly set the attr

Fixes #24408
2017-08-02 10:04:09 -04:00
Abhijeet Kasurde
b266204afa Fix JSON parsing for Python3
Fix corrects the parsing of JSON output in Python 3
environment by using to_text API.

Fixes: #26489

Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
2017-08-02 06:47:44 -07:00
Nathaniel Case
b93878b685 Minor cleanup to nxos_vrrp (#27593)
* Safe changes

* Fold `[0]` into `execute_show_command()`

We only ever execute one command, so only return the one response

* Streamline `results`
2017-08-02 08:46:44 -04:00
Abhijit Menon-Sen
20b0716948 Allow variables to be passed in to template lookup plugin (#18662)
This allows a single template to be evaluated with different values in
the same task. For example, with a template like 'x:{{a}}', one could do
something like this:

    - foo:
        a: "{{ lookup('template', 'x.j2', template_vars=dict(a=foo[item])) }}"
        b: "{{ lookup('template', 'x.j2', template_vars=dict(a=bar[item])) }}"
      with_items:
        - x
        - y

…and "a" and "b" would expand to different strings based on what we
passed in to the template lookup.
2017-08-02 09:29:27 +05:30
Andrew Saraceni
435a562630 Rename win_group_member module to win_group_membership (#27614)
* rename win_group_member to win_group_membership

* adding details to BOTMETA.yml
2017-08-02 12:06:39 +10:00
Jordan Bach
24e393aef1 allow use of jinja2 variables for ec2_group from_port/to_port params (#27145) 2017-08-02 10:26:38 +10:00
Adrian Likins
2b0a7338d4 Handle win style CRLF newlines in vault text (#27590)
When parsing a vaulttext blob, use .splitlines()
instead of split(b'\n') to handle \n newlines and
windows style \r\n (CRLF) new lines.

The vaulttext enevelope at this point is just the header line
and a hexlify()'ed blob, so CRLF is a valid newline here.

Fixes #22914
2017-08-01 18:53:22 -04:00
Toshio Kuratomi
7d2597a68d change the gpl header to single line version and order of imports 2017-08-01 15:41:07 -07:00
Toshio Kuratomi
15902f2496 Fix for ansiballz filenames conflicting with python stdlib modules
The AnsiBallZ wrapper is transferred to the remote machine with
a filename similar to the Ansible-module it runs.  For modules like copy
and tempfile, this can end up conflicting with stdlib modules on the
remote machine depending on how python is setup there.  We have a little
bit of code in the wrapper to deal with this by removing the path that
the ansible module resides in from sys.path.

On MacOSX, that code was having a problem.  The path the module ends up
in included a symlinked directory so we were looking for a path in
sys.path but we had to look for the unsymlinked path instead.

Fix that by using os.path.realpath() instead of os.path.abspath()
2017-08-01 15:20:35 -07:00
Adrian Likins
75a8be9a5d Add back support for vault_password_file config var (#27597)
Got removed in arg parsing updates. Now added back in
setup_vault_secrets().

The default value for DEFAULT_VAULT_PASSWORD_FILE was also
set to '~' for some reason, change to to no default.

Add integration tests.
2017-08-01 18:07:33 -04:00
Matt Davis
f19ed387a7 fix non-pipelined output parsing in winrm.py (#27606)
* ensures stdout/stderr are converted to text type in py3 to avoid json serialization failures
2017-08-01 14:59:52 -07:00
Robin Roth
b134352d8c WIP: Replace boilerplate (#27554)
* Replace boilerplate

* Enable test on packaging/os
2017-08-01 14:37:37 -07:00
CyberArk BizDev
6aa851c6bc CyberArk InitialSupport (#21764)
* Added cyberarkpassword lookup plugin

Added cyberarkpassword lookup plugin: It allows to retrieve credentials
(password, sshkey) from CyberArk Digital Vault

* Added Modules: cyberark_authentication & cyberark_user

Added Modules:
- cyberark_authentication: Logon/Logoff to CyberArk Vault
- cyberark_user: user management

These 2 modules use CyberArk Privileged Account Security Web Services
SDK

* Update cyberark_authentication.py

* Update cyberark_user.py

* Removed ternary conditional to comply with 2.4

* Replaced usage of iteritems() for items() to comply with python3

* PEP8 Updates

* Fixed Doc Issues

* Doc Fixes

* More Doc Fixes

* Removing cyberark_user module, and cyberark lookup plugin

for initial approval of PR, and continue with 2 different PRs after PR
#21764 is approved.

* PEP8 Fixes

* Moved cyberark modules to identity category

From IRC #ansible-devel recommendation (@bcoca) I moved cyberark to
identity category so the authorized maintainers can provide feedback
and move it forward.

* Updates based on community_review by bjolivot

- Updated description lines to have full stops in the documentation
section.
- changed file to use delimiter-separated words instead of camel case
- Updated AnsibleModule module_spec parameters to use
mutually_exclusive, required_if and required_together parameters to
avoid manual validation of the parameters.
- Added comments for more readability.
- Removed “required”: false as they are implicit.
- Enhanced check_mode handling.

* PEP8 Updates

* Updates based on IRC Feedback June 6

* Fixed description for token item

* Fixed Documentation RETURN string

* Fixed PEP8 W291 trailing whitespace

* Changes based on feedback from community review

* Added import to_text from ansible.module_utils._text

* Updates based on recommendation from community

* Changed Exception for Error in friendly messages in try/except blocks

* Updates based on community review (bcoca & dagwieers)

* Fixed httplib for python3 (http.client)
2017-08-01 14:20:27 -07:00
Ganesh Nalawade
6a0d9d1498 Fix junos_logging integration test failure (#27605) 2017-08-02 02:12:09 +05:30
Adrian Likins
9f57920eab Fix --ask-vault-pass prompt to match old when poss (#27602)
If we don't use more than one vault-id, and we use
--ask-vault-pass, instead of using the new vault prompt
format ('Vault password (my_vault_id): ') we use the old
one ('Vault password: ').

This avoids confusing Tower when it needs to detect an
interactive vault password prompt.

This also potentially could allow vault password prompts
to be customized per vault_id.
2017-08-01 16:39:54 -04:00
saichint
37392318a6 fix nxos_vlan and nxos_switchport issues (#27505) 2017-08-01 16:27:12 -04:00
Adrian Likins
a52a4332fd Fix aruba_config flake8 failures (#27603)
* Fix aruba_config flake8 failures

* fix intefaces_file build/flake8 fail
2017-08-01 15:48:48 -04:00
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