Commit Graph

3062 Commits (b060d0ccbab124902b33f2d98baf254d1b83258a)

Author SHA1 Message Date
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.
7 years ago
Jordan Borean 8bb10bb225 removed requirements on WANT_JSON and POWERSHELL_COMMON (#27679) 7 years ago
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.
7 years ago
Abhijeet Kasurde 5e2184c683 Fixing broken imports and get_exception for ipa
Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
7 years ago
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.
7 years ago
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__.
7 years ago
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
7 years ago
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`
7 years ago
Ganesh Nalawade 94748e1728 Fix junos_command test failure (#27627)
Add a loopback interface check instead
of device specific management interface
7 years ago
Ganesh Nalawade 505f3bfcac Fix multiple issues in junos integration test (#27624) 7 years ago
John R Barker 2233d9aeb2 network-integration UserKnownHostsFile=/dev/null (#27622) 7 years ago
Ganesh Nalawade 37670b09f5 Fix junos_linkagg integration test failure (#27621)
Fixes #27574
7 years ago
Ganesh Nalawade 6e0741e8b6 Add dependency to run junos integration test (#27620) 7 years ago
Trishna Guha 9304d6cb01 fix nxos_user integration test (#27619)
Signed-off-by: Trishna Guha <trishnaguha17@gmail.com>
7 years ago
Sloane Hertel 517c91df18 ec2_group: add integration test for port ranges (#27112)
* fix port ranges for ec2_group and add a test to verify
7 years ago
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
7 years ago
Jordan Bach 24e393aef1 allow use of jinja2 variables for ec2_group from_port/to_port params (#27145) 7 years ago
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
7 years ago
Ricardo Carrillo Cruz 8f18ca45f1 Comment cli provider creds on junos group_vars (#27611)
We set the ansible_ssh_user and ansible_ssh_pass at the inventory level,
commenting these out to avoid precedence issue.
7 years ago
Ricardo Carrillo Cruz f8582c985a Comment the user/pass of Junos group_vars netconf provider (#27610)
We set the ansible_ssh_user and ansible_ssh_pass on the Junos
group. However, that has lower precedence than group_vars.
Commenting the group_vars so we have the creds for all Nodepool nodes
within the inventory.
7 years ago
Ricardo Carrillo Cruz 2de404e90a Enable log_path on network integration targets (#27608)
Logs it to /tmp/ansible-test.out
7 years ago
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.
7 years ago
Robin Roth b134352d8c WIP: Replace boilerplate (#27554)
* Replace boilerplate

* Enable test on packaging/os
7 years ago
saichint 37392318a6 fix nxos_vlan and nxos_switchport issues (#27505) 7 years ago
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
7 years ago
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
7 years ago
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
7 years ago
James Mighion 4dd8f281d6 Adding aruba_config module (#27130)
* Adding aruba_config module.

* Fixing documentation.

* Forgot action plugin.
7 years ago
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
7 years ago
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
7 years ago
George Nikolopoulos e329c9da8c New module: manage Citrix Netscaler servicegroup configuration (network/netscaler/netscaler_servicegroup)) (#26183)
* Add netscaler_servicegroup

* Correct version_added
7 years ago
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
7 years ago
George Nikolopoulos ac0c5dec2f Add netscaler_lb_monitor (#26143) 7 years ago
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
7 years ago
Trishna Guha 1b7ac73c85 fix enabling nxapi for nxos integration testsuite (#27587)
Signed-off-by: Trishna Guha <trishnaguha17@gmail.com>
7 years ago
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.
7 years ago
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
7 years ago
Ganesh Nalawade 19fac707fa junos_netconf integration test failure fix (#27569)
*  Create socket using port value and not connection type
*  Correct error message in integration test task
7 years ago
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
7 years ago
David Newswanger e599a01bdc added lines to mode: strict (#27442) 7 years ago
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
7 years ago
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
7 years ago
Ganesh Nalawade 2d734c7ea7 Fix for ios integration test failuers (#27552)
Fixes #27116
7 years ago
John R Barker 499875f897 host_key_checking = False (#27553) 7 years ago
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
7 years ago
Pilou ade593da52 Copy module: improve tests allowing to use a managed host which isn't the controller host (#25672)
* set output_dir_expanded using module result

'path' values are expanded using 'expandvars' too

* foo.txt is located in 'files' directory

* Use 'role_path' and 'connection: local' for local paths

'{{ role_path }}/tmp' is used for generated paths

* Use local connection with local paths

/tmp/ansible-test-abs-link and /tmp/ansible-test-abs-link-dir are
defined by targets/copy/files/subdir/subdir1/ansible-test-abs-link
and targets/copy/files/subdir/subdir1/ansible-test-abs-link-dir links.

* task names: add a suffix when same name is reused

* Check that item exists before checking file mode

then error message is more explicit when item doesn't exist

* Use output_dir_expanded only when necessary

* Enforce remote_user when root is required

* Fix remote path

* Use different local & remote user

this is useful when controller and managed hosts are identical

* Checks must not expect output of tested module to be right

* Use a temporary directory on the controller

* Use sha1 & md5 filters instead of hardcoded values

* Use 'remote_dir' for directory on managed host

* Workaround tempfile error on OS X

Error was:
temp_path = tempfile.mkdtemp(prefix='ansible_')
AttributeError: 'module' object has no attribute 'mkdtemp'"
7 years ago
Pilou 49b8bd0358 Fix broken import in utilities.helper._accelerate (#27088)
* Fix py3 compatibility using six.moves.socketserver

* Remove useless call to str
7 years ago
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
7 years ago
Matt Clay 0c7602fb59 Add potential work-around for expect on macOS.
http://pexpect.readthedocs.io/en/stable/commonissues.html#truncated-output-just-before-child-exits
7 years ago
Nathaniel Case 13948b6d72 More nxos integration fixes (#27507)
* nxos does not have `authorize`

* Enable nxos_banner nxapi tests
7 years ago