Commit graph

16630 commits

Author SHA1 Message Date
Peter Sprygada
3aa41eda0b adds new common functions for declarative intent modules (#25210)
* adds new common functions for declarative intent modules

* adds Entity and EntityCollection
* adds dict_diff and dict_combine

* update for CI  PEP8 compliance

* more CI PEP8 fixes

* more PEP8 CI clean up

* refactors the lambda assignments into top level classes

this is to be in compliant the PEP8 CI sanity checks

* one last pep8 ci fix
2017-06-16 10:16:20 -04:00
Rene Moser
43468b825d vars: fixed missing path in splitext() 2017-06-16 10:08:14 -04:00
Nathaniel Case
a38e727380 nxos_nxapi fix (#25306)
* Add nxos_nxapi tests

* Simple changes to nxos_nxapi

* Move validation to check_args

* Don't mark protocol change unless change is requested

* Add different regex to handle HTTP{,S} ports on a different version of nxos
2017-06-16 07:15:08 -06:00
Christopher Gadd
2edd5da2c5 Update system/ufw.py for ufw v0.35 (#21604)
* Updating ufw.py to support comments

* Revert "Updating ufw.py to support comments"

This reverts commit 54a42de97c77004d4755543bf310f0ec6e1b4d14.

* Support ufw v0.35 in ufw.py

* Add ufw version check to ufw module
2017-06-16 08:08:09 -04:00
Simon Dodsley
937d7993cc Initial commit for Pure Storage Ansible module (#25386)
* Initial commit for Pure Storage Ansible module

* Initial commit for Pure Storage Ansible module

* Initial commit for Pure Storage Ansible module

* Fix import issues as required by post-2.2

* Move last import to top

* Follow suggestions and only implement one module per PR
Fix documentation changes requested

* Documentation and formatting changes
2017-06-16 11:28:50 +01:00
Trishna Guha
98269888a9 iosxr_banner Implementation module (#25744)
* Add iosxr_banner implementation module

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

* Integration test for iosxr_banner

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

* Unit test for iosxr_banner

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

* remove blank line pep8

Signed-off-by: Trishna Guha <trishnaguha17@gmail.com>
2017-06-16 11:56:47 +05:30
James Cammarata
c5b8196ff1 Do not set default value for any_errors_fatal in Base
Setting default values for FieldAttribute values created in the Base class
prevents the _get_parent_attribute() code from working correctly, as the value
is always non-None.

Related to #22924
2017-06-16 00:56:06 -05:00
Matt Clay
3eea649cbb PEP 8 fixes. 2017-06-15 15:54:05 -07:00
Sloane Hertel
938d60472a [cloud] ec2.py: add region to the aws_connect_kwargs before creating vpc connection Fixes #25673 (#25749)
* add region to the aws_connect_kwargs before creating vpc connection

* remove unused import
2017-06-15 15:52:56 -04:00
Robin Miller
540e1bbd69 [cloud] Route53 Avoid throttling errors and unnecessary processing when checking rrsets. (#22104)
The boto Route53 get_all_rrsets method will return the record set
matching the name, type, and identifier specified, followed by ALL
subsequent sets in alphabetical order based on name. If the specified
set does not exist, the method will still return all the sets that
_would_ have come after it. Searching through sets we know will not
match is not just a waste of resources but, more importantly, often
triggers AWS API throttling when used on zones with large numbers of
records.
2017-06-15 15:06:16 -04:00
Brian Coca
fedbf3666b fixed issue with paths separator and others
finished  normalizing of path handling
removed overloaded '-p' from init_paths option, it is for role_paths
removed expand_tilde and get_opt methods as both were redundant, adjusted rest of code
updated tests to match
2017-06-15 14:53:54 -04:00
Abhijeet Kasurde
c426481b33 Add command variable in failure message (#25674)
Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
2017-06-15 10:45:40 -07:00
Rob
6d34ce3f2a [cloud] elb_target_group_facts.pyFix tags being snaked (#25742) 2017-06-15 13:19:28 -04:00
Trishna Guha
44687bb917 Add iosxr_user implementation module (#25615)
* Add iosxr_user implementation module

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

* iosxr_user Integration test

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

* iosxr_user Unit test

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

* Modify integration test with idempotent case

Signed-off-by: Trishna Guha <trishnaguha17@gmail.com>
2017-06-15 22:07:03 +05:30
Trishna Guha
b3c22a96bd Add vyos_user implementation module (#25677)
* Add vyos_user implementation module

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

* Integration test for vyos_user

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

* Make state absent work

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

* Unit test for vyos_user

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

* Standardize user names

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

* Modify integration test with idempotent case

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

* Add role as alias to level

Signed-off-by: Trishna Guha <trishnaguha17@gmail.com>
2017-06-15 22:06:18 +05:30
Brian Coca
13a1111dde tighter host/group_var discovery
now only loads nonext or valid yaml extensions
only first file gets loaded
directories must match name (initially) so no name.yml is loaded anymore
2017-06-15 12:35:18 -04:00
Trishna Guha
9c6ee8d0bb Add nxos_banner implementation module (#25695)
* Add nxos_banner implementation module

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

* nxos_banner integration test

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

* nxos_banner unit test

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

* doc update

Signed-off-by: Trishna Guha <trishnaguha17@gmail.com>
2017-06-15 22:05:38 +05:30
Pierre-Louis Bonicoli
571e93f882 Fix a typo in assert message 2017-06-15 11:22:57 -04:00
Brian Coca
df2fcecd62 pager should not log
fixes #25719
2017-06-15 10:47:11 -04:00
Abhijeet Kasurde
8ad04d6348 Move redudant check_ip_addr method to common ce (#25575)
Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
2017-06-15 13:21:18 +01:00
René Moser
a51d64dfe3 constants: pep8 fix (#25735) 2017-06-15 13:40:06 +02:00
Gaurav Rastogi
8ad464c4f5 New Avi Module for Backup objects (#24843) 2017-06-15 11:50:35 +01:00
Gaurav Rastogi
6c3eace794 Minor Updates to the module descriptions and field options (#25430) 2017-06-15 11:46:07 +01:00
Tim Rupp
8e3ef4b052 Adds virtual_address module (#25728)
This module lets users manage a number of different config options
for Virtual Addresses on a BIG-IP.

Unit tests are provided. Integration tests can be found here

https://github.com/F5Networks/f5-ansible/blob/devel/test/integration/bigip_virtual_address.yaml#L23
https://github.com/F5Networks/f5-ansible/tree/devel/test/integration/targets/bigip_virtual_address/tasks
2017-06-15 11:18:23 +01:00
Ganesh Nalawade
12493707a7 Add persistent connection control path dir constant (#25736) 2017-06-15 11:14:43 +01:00
Brian Coca
5e4b8d04d7 readded missing become configs 2017-06-14 17:36:46 -04:00
Brian Coca
a54666d31e now host list removes trailing/leading spaces
othewise hostnames were just 'fun'
2017-06-14 16:57:00 -04:00
Brian Coca
077ca3e07d skip hidden files for {host,group}_vars
fixes #25712
2017-06-14 15:48:42 -04:00
Tim Rupp
b85785bf07 Refactors irule module to conform to recent standards (#25709)
Also includes unit tests for the code
2017-06-14 19:03:17 +01:00
Tim Rupp
ba12ce64b0 Adds the bigip_snmp module (#25668)
This patch adds a module for managing several snmp related settings
on a BIG-IP that are required when configuring the range of SNMP
settings on a device.

Unit tests are provided. Integration tests can be found here

https://github.com/F5Networks/f5-ansible/blob/devel/test/integration/bigip_snmp.yaml#L23
https://github.com/F5Networks/f5-ansible/tree/devel/test/integration/targets/bigip_snmp/tasks
2017-06-14 18:29:41 +01:00
Tim Rupp
478d364f4d Adds bigip_iapp_template module (#25630)
This module can be used to upload and manage TCL iApps on a BIG-IP.
iApps can be added, removed and updated in place as needed. iApp
files should be provided to the module via Ansible lookups.

Unit tests are provided. Integration tests can be found here

https://github.com/F5Networks/f5-ansible/blob/devel/test/integration/bigip_iapp_template.yaml#L23
https://github.com/F5Networks/f5-ansible/tree/devel/test/integration/targets/bigip_iapp_template/tasks
2017-06-14 18:29:10 +01:00
Tim Rupp
0c68e200d5 Adds the bigip_provision module to Ansible (#25558)
This module allows an administrator to provision new module functionality
on a BIG-IP. BIG-IP modules provide enhanced ADC and security features that
are commonly used by customers such as GTM, ASM, and AFM.

Unit tests are provided. Integration tests can be found here

https://github.com/F5Networks/f5-ansible/blob/devel/test/integration/bigip_provision.yaml#L23
https://github.com/F5Networks/f5-ansible/tree/devel/test/integration/targets/bigip_provision/tasks
2017-06-14 18:28:12 +01:00
Dag Wieers
1c9a570ffe win_timezone: Add diff support, integration tests (#25284)
* win_timezone: Add diff support, integration tests

This PR includes:

- Diff support
- Returns both previous_timezone and timezone
- Adds integration tests
- More examples
- Improved documentation

* Merged the changes from jborean93's PR
2017-06-14 17:34:46 +01:00
Rob
f8d027b1ba [cloud] New module elb_target_group_facts (#24583) 2017-06-14 12:22:50 -04:00
Tim Rupp
db834cafaa Adds a reconnect method (#25625)
This is being made available so that module developers do not
need to use the gnarly long-form version to get a similar
result
2017-06-14 17:09:48 +01:00
Brian Coca
6b99f0d65c account for absense of config file 2017-06-14 11:38:35 -04:00
Sloane Hertel
dfcf43efa9 ec2: Allow EC2-VPC instances to modify security groups - fixes #18928 (#23831)
* Allow EC2-VPC instances to update SG

make ec2 pep8

* use sets instead of loop and a break

* bring things in an indentation level

* Use to_text instead of str, text_type instead of basestring, - instead of difference

* basestrings not unicode

* simplifying syntax
2017-06-14 11:10:29 -04:00
Brian Coca
74842adc07 1st part of ansible config, adds ansible-config to view/manage configs (#12797)
* Start of ansible config project

moved configuration definitions to external yaml file vs hardcoded
 * updated constants to be a data strcutures that are looped over and also return origin of setting
changed to manager/data scheme for base classes
new cli ansible-config to view/manage ansible configuration settings
 * prints green for default/unchanged and yellow for those that have been overriden
 * added list action to show all configurable settings and their associated ini and env var names
 * allows specifying config file to see what result would look like
 * TBD update, edit and view options

removed test for functions that have been removed

env_Vars are now list of dicts
allows for version_added and deprecation in future
added a couple of descriptions for future doc autogeneration
ensure test does not fail if delete_me exists
normalized 'path expansion'
added yaml config to setup packaging
removed unused imports
better encoding handling

updated as per feedback

* pep8
2017-06-14 11:08:34 -04:00
Nathaniel Case
4344132a7d nxos_vpc updates (#25452)
* Add nxos_vpc tests

* Split execute-show between get_config and run_commands
2017-06-14 11:06:49 -04:00
jhawkesworth
ccb5756d1f Added requires WMF5 note to win_firewall module documentations (#25676) 2017-06-14 15:10:17 +01:00
Ganesh Nalawade
b69c7f50d0 Add junos_vlan platform agnostic module (#25652)
* Add junos_vlan platform agnostic module

*  junos_vlan implementation

*  integration test for junos_vlan

* Minor fixes

* Fix Integration test failure
2017-06-14 14:23:52 +05:30
Andrew Saraceni
91e995d691 Allow win_scheduled_task to support adding and removing task paths (#24025)
* allows win_scheduled_task to support adding and removing task paths

* fix line length for documentation

* added integration tests for path creation and removal

* removing ability to remove TaskPath if a task isn't removed.  also removed superfluous line of code in Invoke-TaskPathCheck function
2017-06-14 08:02:36 +01:00
Dag Wieers
cf30b162a9 vmware_guest: Various fixes to VM customizations (from template) (#24768)
* Various fixes to VM customizations (from template)

This patch implements:
- New find_obj() function from vmware.py replacing get_obj()
- Implement proper resource_pool selection
- Fix productId implementation (was not working)
- Ensure that we are not changing anything that is not mandatory (hostName, orgName, fullName)


This is an alternative proposal to #24283
This does not fix #19860 yet though.

For our use-case, we do not want to customize the network information (or any information in fact).
What is used in the template should remain intact.

* Added find_obj() function

* Fix the returned object-list (unused yet)

* Small improvement

* Support DHCP type and fix customizations

* Small fix

* Support resource_pool also for reconfiguring VM

* Remove redundant

* Fix short hostname, specific resource_pool, PEP8

* Improve docs and examples

* Fix missing hostsystem

* Make folder absolute path

* Improve docs, add missing 'mac'
2017-06-13 17:50:55 -04:00
Sloane Hertel
bd4f08d434 [cloud] Fix Route53 module value option, defaulting to empty list (#24555) 2017-06-13 15:55:19 -04:00
Adrian Likins
d46dd99f47 Add UUID, label and id links to devices when building facts (#25448)
At present, the available facts around block devices are not sufficient to be able to find stable names guaranteed to work across reboots, or to identify block devices by label (UUID, etc).

This patch provides a list of observed links for each device. It relies on functionality specific to Linux (as does the existing sysfs-based code which it extends), but should not cause issues on other platforms.

Moreover, it prevents virtual devices from being excluded, and links such devices to the physical devices to which they are attached.
2017-06-13 15:33:13 -04:00
Adrian Likins
56b7483b85 More statvfs info for mount facts rebase 12073 (#25454)
* Add more mount point statvfs info including sizes

Based on https://github.com/ansible/ansible/pull/12073

facts.utils.get_mount_size() now returns a dict of most
of the posix statvfs data, including block_size and inode
counts.

Update the facts.hardware classes that use get_mount_size() to
use the new info by mount_info.update(mount_statvfs_inof) to merge.

* add back unit tests for LinuxHardware mount/fs facts

* add test cases for facts.utils.get_mount_size
2017-06-13 15:31:41 -04:00
Sloane Hertel
3bba43a487 [cloud] ec2.py: region is documented as optional; allow endpoints to be used - fixes #24382 (#24470)
* region isn't required for ec2.py; allow endpoints to be used

* move where aws_connect_kwargs is set

* remove camel_dict_to_snake_dict and display error message
2017-06-13 15:12:47 -04:00
jctanner
58db0da5a5 Fix pep8 extra lines error (#25666) 2017-06-13 13:59:23 -04:00
Dag Wieers
bf43eb92f5 win_firewall: check-mode support, integration tests (#25127)
* win_firewall: check-mode support, integration tests

This PR includes:
- Check-mode implementation
- Documentation improvements
- Ensure module output is consistent (no matter what profiles are provided)
- Fixed indentation
- Cosmetic changes
- Integration tests

* win_firewall: check-mode support, integration tests

This PR includes:
- Check-mode implementation
- Documentation improvements
- Ensure module output is consistent (no matter what profiles are provided)
- Fixed indentation
- Cosmetic changes
- Integration tests
2017-06-13 17:32:22 +01:00
Brian Coca
4ee348e564 draft constructed groups plugin (#23374)
* draft constructed groups plugin

can use fact cache as vars source

* pw4er5e
2017-06-13 10:46:40 -04:00
Brian Coca
37acb7423b add deprecation notice for sudo/su cli options (#23983)
* add deprecation notice for sudo/su cli options

* updated as per feedback
2017-06-13 10:46:09 -04:00
Brian Coca
c4169d93e8 add validation to fetch for source/dest
also added missing display
2017-06-13 10:37:14 -04:00
Brian Coca
13d3b27a0a Get warnings/deprecations per item in loop
warnings and deprecations were only returned for the top level of a task, this now deals with them in loop
deduplication still occurs so only unique ones will be shown to user.

fixes #25258
2017-06-13 09:54:00 -04:00
Toshio Kuratomi
90b1d780eb Fix redis cache for python3
According to the redis-py docs, zrank will return the 0 based index for
the value in the sorted set.  So the logic here wasn't right to begin
with (It just means that a value at the 0-th position would never show
up as cached).  Need to compare against None to know if the value
exists in the cache.

https://redis-py.readthedocs.io/en/latest/#redis.StrictRedis.zrank

Fixes #25590
2017-06-13 09:50:46 -04:00
Brian Coca
498aea8acc Revert "Add log_only to debug messages (#25545)"
This reverts commit 9e8cc26720.
2017-06-13 09:29:18 -04:00
Sloane Hertel
00d5de3dec fix return value (#25611)
document the returned
2017-06-13 09:18:58 -04:00
Ganesh Nalawade
9e8cc26720 Add log_only to debug messages (#25545)
Fixes #25544
When `debug` is enabled the debug messages triggered
from `bin/ansible-connection` should be logged only to file
and not on stdout.
2017-06-13 18:41:33 +05:30
Abhijeet Kasurde
f65ced0438 cloudstack: Use errortext from router in cs_router (#25634)
Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
2017-06-13 11:11:53 +02:00
Abhijeet Kasurde
b7558f5018 Add missing msg keyword in fail_json (#25635)
Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
2017-06-13 11:11:11 +02:00
jhawkesworth
e017bf964e Small improvement to the way the powershell code lines render in win_say module (html rendering only, still does not break lines properly in ansible-doc) (#25624) 2017-06-13 08:18:32 +01:00
netservers
d5becd728e Have cs_host search both name and ipaddress fields when fetching the host from listHosts. (#25628)
Make ip_address an alias of name to allow playbooks to more clearly make
use of IP addreses.
2017-06-13 07:30:59 +02:00
Simon Staszkiewicz
eb7530df95 Correct link to DescribeInternetGateway docs (#25622)
Old link pointed to DescribeRoutingTable documentation instead of DescribeInternetGateway documentation.
2017-06-12 20:30:30 -04:00
Abhijeet Kasurde
0770b1018c Correct variable name in vca_nat module
Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
2017-06-12 19:36:08 -04:00
Abhijeet Kasurde
a4f1738082 Fail module instead of returning boolean value
Fix added to fail module instead of returning boolean value
which raises AttributeError.

Fixes #21770

Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
2017-06-12 17:55:22 -04:00
ademmers
025b52938e system/service module initctl location usage (#19712)
* Call initctl version based on initctl's retrieved location

* Remove the use of start/stop/restart in favor of initctl

* Provide correct argument order for initctl usage
2017-06-12 15:29:08 -04:00
Sloane Hertel
3f0c47196e [cloud] s3: deleting a nonexistent bucket should not give a traceback Fixes #25445 (#25487)
* trying to delete a nonexistent bucket should not fail

* Improve error handling for deleting s3 bucket

* Allow successful deletion

* Add test for deleting a nonexistent bucket

rename integration test target from s3 to aws_s3
2017-06-12 13:52:25 -04:00
Abhijeet Kasurde
7521be73c1 Add missing import for get_exception
Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
2017-06-12 13:18:54 -04:00
Brian Coca
ff4c308359 fixed issue with empty string 'packages'
also cleaned up unused imports/vars
fixes #25582
2017-06-12 12:59:16 -04:00
Abhijeet Kasurde
077a2df1d6 Return exception as string
Pyodbc returns exception as Python Exception class,
typecast as string for fail_json.

Partially fixes: #25010

Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
2017-06-12 11:26:54 -04:00
Abhijeet Kasurde
da6f6d27e8 Add Description parameter in os_user
Fixes #18914

Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
2017-06-12 10:56:34 -04:00
Monty Taylor
45f07fdeae Make auto_ip in os_server not always return changed (#25540) 2017-06-12 16:48:46 +02:00
Alan Loi
3ac9273507 Fix hash_key_name to be optional for delete (#25009) 2017-06-12 10:25:43 -04:00
Alan Loi
c23e3c1913 Fix version_added for tags and wait_for_active_timeout params (#24993) 2017-06-12 10:19:41 -04:00
Vinay Dandekar
45019e440f Add Linux Mint to Debian OS family in setup facts 2017-06-12 09:27:03 -04:00
Abhijeet Kasurde
e160bcf237 Correct fail_json call in rpm_key
Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
2017-06-12 09:11:03 -04:00
willricardo
dd1f5d7acd ec2 module conver basestring to string_types (#25503) 2017-06-12 08:48:38 -04:00
Will Thames
16b877e2b3 ec2_asg and ec2_asg_facts module improvements (#25166)
* ec2_asg and ec2_asg_facts module improvements

Return target group information for both ec2_asg and ec2_asg_facts
modules

Provide RETURN documentation for ec2_asg module

PEP8 fixes for ec2_asg_facts

* ec2_asg: use pagination when describing target groups

In case an ASG has 100s of target groups, ensure that
we get the full result using build_full_result
2017-06-12 07:15:04 -04:00
Abhijeet Kasurde
b89cb95609 Fix spelling mistakes (comments only) (#25564)
Original Author : klemens <ka7@github.com>

Taking over previous PR as per
https://github.com/ansible/ansible/pull/23644#issuecomment-307334525

Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
2017-06-12 07:55:19 +01:00
Pilou
460d932aa8 postgresql_user: fix bugs related to 'expires' option (#23862)
* Factorize tests related to no_password_change using an include task

* Refactor: deduplicate tasks

* postgresql_user: test 'expires' parameter

* Change 'valid until' even it's the only updated field

* value is changed when another value is provided

* value isn't returned when unset

* Remove unused variable

* psycopg2.extras.DictRow is able to handle comparison

* postgresql_user: simplify helper method

* postgresql_user: define variable just before using it

* Fix comparison between user input and applied configuration

* new test: adding an invalid attribute

* Refactor, add cleaning task

* Check that using same attribute a 2nd time does nothing

* Always try to remove created user

* postgresql_user: fix pep8
2017-06-11 14:48:39 -07:00
Abhijeet Kasurde
301cbc1f5b Remove unreachable code from cron module (#25577)
Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
2017-06-11 07:35:46 +02:00
Matt Martz
23eebb62e6 Convert docker cmd output to native, early 2017-06-10 07:09:04 -07:00
Matt Clay
a18cc45778 Fix PEP 8 issue. 2017-06-10 14:07:15 +08:00
Brian Coca
5717f4f161 updated cache descriptions 2017-06-09 23:48:47 -04:00
Brian Coca
cdcbd84088 refactor of virtualbox plugin, fixed cache use 2017-06-09 23:48:47 -04:00
Matt Martz
392934f1b9 Fix pep8 issue in lib/ansible/inventory/manager.py (#25562) 2017-06-09 18:40:36 -05:00
Brian Coca
cc66bd4ad0 moved general pattern cache into object
no real reason this is a class global
2017-06-09 15:30:11 -04:00
Adrian Likins
4befefd78c Try to show original exception info for yaml (and other) errors (#24468)
* show original exception for yaml (and other) errors

In places where we need to catch a yaml error and raise
an AnsibleError, add the orig yaml exc to the AnsibleError
via the orig_exc arg.

When the AnsibleError is displayed it will now include the
AnsibleError (AnsibleParserError for example) and the type
and message from the original yaml exception.

This provides more detail to the error messages related to
yaml errors.

This also improves errors from dataloader (for example,
previously if a wrong password was used for a vault encrypted
yaml file, the error was very vague and suggested yaml errors,
but now the message includes the original exception from vault
indicating the password was incorrect or missing).

Add a text note to playbook helper asserts. For playbook
syntax/layout errors that aren't yaml errors, but errors
indicating invalid data structures for a playbook/task/role/block,
we now include some info about where the assert was and
why it was raised.

In places we raise an AnsibleParserError in an except
clause, pass the original exception to AnsibleParserError via
orig_exc arg.

Make assorted error messages a little more specific (like
the playbook helper load methods)

* Revert "Include the original YAML error in syntax error messages"

This reverts commit 781bb44b02.
2017-06-09 13:13:15 -04:00
Abhijeet Kasurde
ccc7f788c0 Fix import for get_exception (#25551)
Fixes #25549

Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
2017-06-09 11:58:18 -05:00
René Moser
29817ab115 cloudstack: add tests, fix pep8 (#25518)
* cloudstack: cs_zone: fix pep8

* cloudstack: cs_zone: add tests
2017-06-09 18:48:53 +02:00
René Moser
76c598f044 cloudstack: cs_zone: fix missing type bool for params (#25552) 2017-06-09 18:10:32 +02:00
James Cammarata
81998b963d Re-adding missing os import to wait_for 2017-06-09 10:57:17 -05:00
Chris Atkinson
62fa2019c6 [cloud] Allow IAM certificate secrets, body, chains to be strings (e.g. sourced from ansible-vault) (#24206)
* Allow cert and private pem information to be passed in via string, eg when obtaining sensitive key details from anisble-vault at runtime

* Allow cert chain body to be passed as a string

* Ensure the new options are set in parameters

* Dont publish the private key in logs

* Set the version_added documentation

* Update documentation inline with review

* Removes file based certificates in favour of string only as suggested in feature review

* Documentation changes as suggested by review
2017-06-09 11:32:22 -04:00
Sloane Hertel
b376bde4d7 [cloud] ec2_eni module - allow attaching a new instance - fixes #19452 (#22377)
* fix bug attaching instances

* pep8
2017-06-09 11:31:42 -04:00
Tim Rupp
61684f7313 Updates gtm wide ip module to be feature complete (#25502)
This module is used to manage GTM wide ips on a bigip.
Previously, this module only included a small subset of functionality
primarily related to editing a wide ip that already existed. Additionally
it used the SOAP api for its communication. this patch completes the
feature set of wide ips and refactors the code to use the F5 python SDK
and the REST API.

Unit tests are provided. Integration tests can be found here

https://github.com/F5Networks/f5-ansible/blob/devel/test/integration/bigip_gtm_wide_ip.yaml#L23
https://github.com/F5Networks/f5-ansible/tree/devel/test/integration/targets/bigip_gtm_wide_ip/tasks
2017-06-09 16:07:14 +01:00
Ted
416d9774ce New module: Add Bcf switch module. (network/bigswitch/bcf_switch) (#24261)
* Make access_token type str, remove alias, and make validate_certs default value true

* Remove comma

* Add bcf switch module

* Remove white space in blank line

* Fix yaml

* Try removing the RETURN just like in the other modules
2017-06-09 08:14:28 -06:00
Abhijeet Kasurde
ba4f6de35a Add support for Devuan in hostname module (#25525)
Fixes #25395

Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
2017-06-09 08:47:09 -04:00
Ricardo Carrillo Cruz
72e65e4290 Platform agnostic module for VRFs (#25383)
* WIP VRF platform agnostic module

* Fixed examples refering vlans instead of vrfs

* Add integration tests
2017-06-09 13:33:11 +02:00
Ricardo Carrillo Cruz
d83f254bb6 New eos_vrf module (#25427)
* New eos_vrf module

* Add CLI integration tests

* Check rd only if not None
2017-06-09 13:24:28 +02:00
Trishna Guha
91e5fce90f Add ios_user implementation module (#25413)
* Add ios_user module

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

* Integration test for ios_user

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

* Add unit test for ios_user

Signed-off-by: Trishna Guha <trishnaguha17@gmail.com>
2017-06-09 13:50:57 +05:30
Phil Nelson
eb349cb201 Template parent include path before finding its dirname (#23202)
Given parent include path "{{ var | default('path/file.yml') }}"
os.path.dirname(parent_include_path) yields {{ var | default('path/
which is incorrect in itself but also causes templating errors
due to unbalanced quotes. Fix both problems by templating
parent include path before finding its dirname.
2017-06-08 23:47:21 -05:00
René Moser
64a9794997 ovirt_storage_connections: fix RETURN, fixes build (#25517)
* ovirt_storage_connections: fix RETURN, fixes build, pep8
2017-06-08 17:57:01 -04:00
Ondra Machacek
f762c61816 cloud: ovirt: Add support to specify multiple LUNs (#22866) 2017-06-08 23:24:12 +02:00
Adrian Likins
dde3dac9f8 Support NetBSD 7.1+ style ifconfig -a output (#25442)
* Support NetBSD 7.1+ style ifconfig -a output

network facts on NetBSD after 7.1 cvs would fail
because of format changes in 'ifconfig -a' output.

update code to support new and old format.

add unit tests for both based on
examples from Bruce V Chiarelli.

* wrap use of interfaces.keys() in list() for py3 compat
* sort interface ids for stability
2017-06-08 17:09:22 -04:00
Ondra Machacek
d7b3ace0b0 cloud: ovirt: Fix upgraded state of the ovirt_hosts module (#25169) 2017-06-08 16:58:54 -04:00
Ondra Machacek
c17efa4aaa cloud: ovirt: Add possibility to specify opentack volume type (#22361)
This PR fixes: https://github.com/ansible/ansible/issues/21580
2017-06-08 16:53:26 -04:00
Ondra Machacek
c17e206b0e cloud: ovirt: add module to manage storage connections (#22239) 2017-06-08 16:52:20 -04:00
Tareq Alayan
013f759775 ovirt_vms: add ability to specify storage domain (#24012)
When creatinf a new VM from template, you can specify the storage domain
name and disk format where to copy all the template disks

For example if you want to create a VM from template into specific
storage domain you can do the following:

  ovirt_vms:
    name: vm_on_my_storage_domain
    cluster: my_cluster
    template: my_template
    operating_system: other_linux
    type: server
    cpu_cores: 1
    cpu_sockets: 1
    state: stopped
    clone: True
    storage_domain: my_nfs_storage
    format: COW
2017-06-08 16:52:07 -04:00
Tareq Alayan
a401f6a8e9 ovirt_nics.py: support adding nic to template (#24020)
before this change adding nic was allowed only to a vm. Now it is
possible to add it to template.

example:
- name: test add nic to template
  ovirt_nics:
    auth: "{{ ovirt_auth }}"
    state: present
    template: mytemplate
    name: nic1
    interface: virtio
    profile: ovirtmgmt
    network: ovirtmgmt
2017-06-08 16:44:44 -04:00
Katerina Koukiou
b8c4ca75cf cloud: ovirt: Add option to register template (#24830) 2017-06-08 16:44:15 -04:00
Ondra Machacek
a1a246e85d cloud: ovirt: add ovirt_scheduling_policies_facts module (#25055) 2017-06-08 16:43:54 -04:00
Ondra Machacek
436b8c9791 cloud: ovirt: add localfs option to storage_domains module (#25439) 2017-06-08 16:43:40 -04:00
Adrian Likins
f4128746d3 Cmdline fact uefi 23647 (#25446)
* Fix ansible_cmdline initrd fact for UEFI

UEFI cmdline paths use \ path sep which would
get munged by cmdline fact collection.

* Make CmdLineFactCollector easier to test

extract the parsing of the /proc/cmdline content to
_parse_proc_cmdline()

add a wrapper method for get_file_content _get_proc_cmdline()

Add unit tests of _parse_proc_cmdline based on examples
from issue #23647

Fixes #23647
2017-06-08 16:03:29 -04:00
James Cammarata
781bb44b02 Include the original YAML error in syntax error messages 2017-06-08 12:51:37 -05:00
Brian Coca
db15528de3 added example for those with ansible_connection set 2017-06-08 13:40:48 -04:00
Brian Coca
d325fa00cc corrected docs 2017-06-08 13:18:03 -04:00
Brian Coca
a2cff554ee allow more 'backwards compatible' vars_plugins (#25451)
* allow more 'backwards compatible' vars_plugins

* better version relying on exceptions
2017-06-08 12:47:40 -04:00
Jordan Borean
89caef8fb6 win_environment: Added tests and return info in document (#25064)
* win_environment: Added tests and return info in document

* fixing up some yaml issues

* some more things I should have detected

* fixing up test tag name
2017-06-08 17:39:10 +01:00
Branko Majic
6ce7448ca4 New module: Add module for manipulating the dconf database (system/dconf) (#23015)
* Implemented dconf module for manipulating and reading the dconf database.

* Fixed remote execution for the dconf module when state=present by wrapping the invocation with dbus-launch (dconf requires a running DBus user session). Updated documentation to mention external module dependencies.

* Fixed remote execution for the dconf module when state=absent by wrapping the invocation with dbus-launch (dconf requires a running DBus user session).

* Updated dconf module implementation to make it more robust:

- Detect running D-Bus session, and reuse that one if possible.
- If detection fails, try launching process via dbus-run-session to avoid
  left-over D-Bus processes.
- As last resort run dbus-launch, and clean-up after the changes have been
  made.
- Updated documentation to mention new dependencies and to be more explicit
  about module limitations.

* Fixed PEP8 errors reported by ansibot in dconf module.

* Updated dconf module implementation:

- Fail early if psutil library is not available on the system.
- Go through all of user's processes to locate a running D-Bus daemon.
- Test potential D-Bus session bus address before deciding to (re)use it.
- Added a couple of debug statements.
- Updated documentation to include dbus-send as requirement.

* Updated dconf module implementation:

- Simplified module, removing all code for handling dbus-daemon, as discussed in
  a community meeting.
- Module user must ensure that D-Bus user session is available and specified
  either via module parameter or environment variable.
- Updated documentation for the change.

* Updated dconf module implementation:

- Add back ability to detect running D-Bus user session.
- Fail-back to using dbus-run-session if running session could not be detected.

* PEP8 fix for dconf module.

* Updated dconf module implementation:

- Introduce correct examples for Gnome DE.
- Rename existing examples to mark them as Cinnamon-specific.
- Use self.module.get_bin_path instead of custom check for dbus-run-session.
- Fixed typo in method documentation for DconfPreference.reset().
2017-06-08 09:12:34 -07:00
Brian Coca
8badfcd7fe make sure ini handles children no matter the order
fixed 'pending declarations' assumption that children only have 1 parent
fixes #25488
2017-06-08 10:37:19 -04:00
George Nikolopoulos
a00089c341 New module: manage Citrix Netscaler service configuration (network/netscaler/netscaler_service) (#25129)
* netscaler_service initial implementation

* Changes as requested by reviewers

* Skip some tests if under python2.6 and importing requests library

* Change option "operation" to "state"

* Remove print statements from netscaler module utils

* Catch all exceptions during login

* Fix fail message

* Add common option save_config
2017-06-08 08:33:32 -06:00
Eric D Helms
2220362a5f fixes(#25299) Don't fail when creating a Foreman organization (#25396) 2017-06-08 12:49:40 +01:00
marlier
6bd1681203 RabbitMQ 3.6.7 changed a couple of response codes (#22715) 2017-06-08 12:33:30 +01:00
Dag Wieers
6e98dbbfd7 wait_for: PEP8, imports, cosmetics (#24634)
- Make PEP8 compliant
- Ensure imports are specific
- Few cosmetic changes (sort lists, casing, punctuation)

This fixes #19781
2017-06-08 11:06:11 +02:00
Chris Houseknecht
20bddde669 docker_service: Forward stderr-based output from docker-compose (#25456)
PR #5165 at https://github.com/ansible/ansible-modules-core/pull/5165
adds redirection and capture of stdout during execution of
docker-compose.

This doesn't necessarily catch all errors, since some are printed to
stderr and lost.

This extends the redirection to include stderr, and does minor string
processing to attempt to find a 'useful' message to present as the
final Ansible error.
2017-06-07 23:30:26 -04:00
Matt Martz
13c070948b Fix pep8 issues in profile_roles (#25458)
* Fix pep8 issues in profile_roles

* Fix reduce import
2017-06-07 21:20:59 -05:00
Brian Coca
2e920d724d fixed import, had moved 2017-06-07 19:11:45 -04:00
Tennis Smith
1d15ca739f feat: add role profiler (#20092)
* feat: add role profiler

* fix: use 2.0 api version
2017-06-07 18:38:32 -04:00
Ricardo Carrillo Cruz
b3e8c48d4b New module: Add support for Arista EOS vlan (network/eos/eos_vlan) (#25355)
* WIP Add eos_vlan module

* Fix docstrings

* Fix pep8 issues

* Add active/suspend states logic

* Add integration tests for eos_vlan

* Fix map_config_to_obj on EAPI

* Sixify iteritems

* Add platform agnostic net_vlan integration tests
2017-06-07 23:47:28 +02:00
Brian Coca
88f0e0b882 removed spurious warning (traling ,)
also removed unused improt
2017-06-07 15:16:47 -04:00
Matt Martz
004e99316c Allow template files to be vaulted (#22951)
* Allow template files to be vaulted

* Make sure to import exceptions we need

* get_real_file can't take bytes, since it looks specifically for string_types

* Now that we aren't using open() we don't need b_source

* Expand playbooks_vault docs to include modules that support vaulted src files

* Add vaulted template test
2017-06-07 14:16:03 -04:00
Adrian Likins
24f2a616dd Fix manual reference for dmidecode (#25444)
dmidecode(1) does not exist, dmidecode(8) does exists.

(rebased from https://github.com/ansible/ansible/pull/24106)
2017-06-07 13:56:15 -04:00
Dag Wieers
656db3707c win_defrag: New module to defragment local volumes (#23140)
This module performs defragmentation on local Windows volumes.

This module requires PR #23131 for list parameter support.
2017-06-07 10:52:28 -07:00
Jay LaCroix
449cf43926 Add Antergos to OS_FAMILY_MAP as fork of Arch Linux. (#25363)
Support 'Antergos' as a target for distribution facts.
2017-06-07 13:46:29 -04:00
Matt Kunkel
3d21965e73 Fix HPUX cpu facts on HP Integrity VM's (#25369)
Skips cpu facts not returned by machinfo on HP Integrity VM's.

Fixes #25368
2017-06-07 13:43:54 -04:00
Daniele Lazzari
eda6a6baee New module: Add module to add/remove a network static route on windows (windows/win_route) (#23405)
* adds win_route windows module

* fix documentation indent

* fix documentation pep8 issues

* fix documentation issues

* genaral code review

* changed 'supported_by' in doc, supports_check_mode removed

* use of powershell cmdlet instead of route command, destnation in CIDR format, adds check mode support

* adds win_psmodule module

* documentation review

* documentation review

* removed files accidentatlly pushed

* add integration tests, add return in documentation

* add conditional statement in test, add os requirementes in documentation

* fix documentation

* fix os check in tests
2017-06-07 10:25:50 -07:00
Mike Wiebe
b76acc8ce8 Fix nxos_vpc idempotence issues (#25219)
* Fix nxos_vpc idempotence issues

* Remove legacy-file pep8 now passing
2017-06-07 10:35:08 -04:00
Toshio Kuratomi
80c1765653 When cleaning up the AnsiBallZ tempdir we need to not fail if the tempdir wasn't created
If the temp directory creation failed in mkdtemp then temp_path is never
given a value.  This would lead to a NameError exception which would
obfuscate the original error (out of disk space being a common one).  By
catching NameError, python will raise the original exception as we want.

Fixes #17215
2017-06-07 06:38:42 -07:00
Evan Kaufman
3d1701b959 Fixed subsection replacement with before/after patterns
* using a _named_ capture in our assembled pattern, since before/after could potentially contain their own parenthesized captures
* ensuring we only replace against the named capture in question
* removing some duplication in the regexp replacement, that was introduced in ansible/ansible#22535
* fixed edge case of before/after not matching file content to replace

Fixes ansible/ansible#24840
2017-06-07 01:45:34 -07:00
Abhijeet Kasurde
5bd4e01533 Update documentation of pamd module (#24712)
Updated explanation and documentation of new_module*
in pamd documentation

Fixes #24516

Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
2017-06-07 08:48:42 +01:00
Abhijeet Kasurde
577d01baa3 fortios: module_utils: Fix typo in close call (#24853)
Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
2017-06-07 08:26:25 +02:00
Abhijeet Kasurde
8a4a04b016 logicmonitor: remove closed statement, used for py2.4 compat (#25240)
Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
2017-06-07 08:23:29 +02:00
Abhijeet Kasurde
26349033c1 Add FreeIPA module for managing DNS records (#25203)
Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
2017-06-07 08:06:31 +02:00
Abhijeet Kasurde
5b03e55440 Misc typos in azure_rm_deployment (#25372)
Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
2017-06-07 07:57:24 +02:00
Abhijeet Kasurde
5cf66ceda0 Misc typo in azure_rm_virtualmachine (#25376)
Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
2017-06-07 07:56:28 +02:00
Abhijeet Kasurde
65bd5c4d56 Refactor github_hook module (#24391)
* PEP8 fixes
* Refactoring for fetch_url call
* Removed un-used code

Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
2017-06-07 07:52:03 +02:00
Abhijeet Kasurde
677a6c2982 Pep8 fixes for ejabberd_user and jboss (#24586)
* PEP* Fixes
* Refactor code

Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
2017-06-07 07:35:22 +02:00
René Moser
894b86a467 cloudstack: cs_zone_facts: add tests and fix pep8 (#25407) 2017-06-07 00:35:24 +02:00
Ondra Machacek
bcc5bffd8e cloud: ovirt: Fix searching of network in datacenter (#25248) 2017-06-07 00:25:10 +02:00
KATO Tomoyuki
cbe87d0af7 doc: fix missing period for hostname.py (#25392) 2017-06-07 00:21:27 +02:00
James Cammarata
483df9c5f8 Imports and includes (#25399)
Initial commit to split includes into static imports/dynamic includes

This implements the new include/import syntax for Ansible 2.4:
* include_{tasks,role,variables} = dynamic
* import_{playbook,tasks,role} = static

The old bare `include` will be considered deprecated, as will any use of the `static: {yes|no}` option.

This also adds docs for import/include and reorganizing the "Playbook Reuse" section of the documentation.
2017-06-06 16:39:48 -05:00