Commit graph

1108 commits

Author SHA1 Message Date
Anton Roman
1e3428a766 fix issue in random_mac filter with short prefixes (#53928) 2019-03-26 13:49:23 -04:00
Matt Martz
6996926d89
Expose loop_control.loop_var as ansible_loop_var (#54240)
* Expose the loop_var as ansible_loop_var

* Add docs

* fix assert test

* Indicate version added
2019-03-26 11:07:54 -05:00
Evan Kaufman
cf69ec5db0 replace - fixed combined before and after usage (#31452)
When using before and after in combination, the opposite behavior was induced. This PR makes the the replacement happen between the specified patterns as intended.

* Added integration tests
* Add changelog, porting guide entry, and minor doc fixes
2019-03-26 11:49:58 -04:00
Andrea Tartaglia
df86b9ec3d openssl_pkcs12: privatekey_path and friendly_name are not always required together (#54370)
* Removed required_together, updated tests

Since required_together: privatekey_path -> friendly_name, is not always
required it has been removed.
Updated openssl_pkcs12 integration tests to be in line with other
openssl_* modules, and added a test for export with no privatekey_path.

* linter fixes

* Removed cryptography from tests

* Added changelog fragment

* Removed non-necessary select_crypto_backend
2019-03-26 15:06:00 +00:00
Hannes Ljungberg
be293fbe50 docker_swarm_service: Remove configs and secrets defaults (#54361)
* Remove defaults

* Skip redundant casting

* Indentation fix

* Use generic compare functions

* Add tests for compare functions

* Remove extra whitespace

* Add changelog fragment
2019-03-26 09:45:40 -04:00
Sloane Hertel
54be769e8d fix AWS plugin credential precedence for environment variables (#52945)
* fix AWS plugin credential precedence for environment variables

* Allow aliases in direct plugins options

Consolidate precedence fix just in the doc fragment using aliases for mismatched options

* Access options with the option name rather than alias

* fix indentation

* update unit tests

* Improve readability
2019-03-25 16:53:11 -04:00
Felix Fontein
4fac91bed5 docker_container: add networks_cli_compatible option (#54198)
* Adding networks_cli_compatible option.

* Move network tests into own test file.

* Extend tests (for networks_cli_compatible=no).

* Adding tests for networks_cli_compatible=yes.

* There seems to be no way to create a container without at least one network attached.

* Integrate networks / purge_networks with comparisons.

* Speed up tests.

* Removing double dot.

* Add changelog.

* Use comparisons value only if the networks option has been specified. purge_networks on the other hand also removes networks if it has not been specified.
2019-03-25 15:06:21 -04:00
Felix Fontein
121990d8c5 openssl_dhparam: fix state=absent (#54296)
* Fix remove.

* Add changelog.
2019-03-25 12:00:20 -05:00
Abhijeet Kasurde
5db7501ebd
VMware: Change in update tag API (#54304)
Changed update tag API as per new changes.

Fixes: #53060

Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
2019-03-25 21:50:46 +05:30
Felix Fontein
d7a273273a openssl_*: proper mode support (#54085)
* Add write helper.

* Adjust modules (except openssl_certificate).

* Adding tests for mode (with openssl_privatekey).

* Add openssl_certificate support.

* Never, ever remove the output file before actually trying to generate new content for it.

Removal is only allowed when state=absent, or when the object has been regenerated and the result needs to be written to that place.

* Add changelog.

* Extend test.
2019-03-25 14:20:52 +01:00
Felix Fontein
534c833bb3 openssl_certificate: fix state=absent (#54298)
* Fix state=absent.

* Add changelog.
2019-03-25 13:07:28 +01:00
Felix Fontein
752db43b2d Rename return of docker_compose. (#54171) 2019-03-23 18:35:11 +00:00
Martin Krizek
bafa291af9 uri: do not write the file after failure (#53515)
* uri: do not write the file after failure

Fixes #53491

* Add changelog
2019-03-22 09:32:43 -05:00
Martin Krizek
63ea96d5f1 assemble: avoid extra newline on Python 3 (#54176)
Fixes #44739
2019-03-22 09:14:02 -05:00
Andrea Tartaglia
36a790dcde New cryptography backend for openssl_certificate (#53924)
* New cryptography backend for openssl_certificate

load_* functions in module_utils/crypto.py now have a backend paramter
which when set to 'cryptography' will return cryptography objects so
they can be used for both pyopenssl and cryptography backends.
Added a select_message_digest function too returning a cryptography
digest hash from `cryptography.hazmat.primitives.hashes`
Added new classes for Cryptography backend

* Run test with various backends.

* Prefixing tests.

* Make sure we have the correct backend available.

* Linting (flake8).

* Moved cryptography import to separate try/except

* Make sure certificate is actually valid at some time in the past.

* Improve error handling.

* Trying to fix validation for cryptography backend.

* Fixed issue with keyUsage test in assertonly

* Fixed CI/Lint issues

* Fix private key problem for OwnCA.

* Cryptography backend doesn't support v2 certs.

* issue an expired cert with command when using cryptography backend

* Added warning when backend is auto and v2 cert is requested

* Bumped min cryptography version to  1.6

* Correctly check for failure when backend is cryptography and cert is v2

* Use self.backend where possible

* Use secp521r1 EC when testing on CentOS6

* Fixed pylint issue

* AcmeCertificate support for both backends

* Review fixes

* Fixed missing '(' when raising error

* Fixed date_fmt loop

* Updated docs and requirements with cryptography

* Add openssl_certificate to changelog.
2019-03-22 13:21:23 +00:00
Christian Rohmann
90c092a104 Allow configuration of connection_limit per postgresql database (postgresql_db) (#40345)
Fixes #40060

* Fix coding style errors
* Use CONNECTION LIMIT (no underscore)
* From review done by amenonsen and bcoca - Set default at None, make the change detection less confusing
* Added EXAMPLE on how to apply a database specific connection limit
* Added some basic tests for conn_limit applied to a database
* Check that conn_limit has actually been set / updated to 200
* Add changelog fragment regarding postgresql_db conn_limit parameter
2019-03-22 18:21:39 +05:30
Felix Fontein
1a94cf140c openssl_publickey: fix handling of OpenSSH private keys with passphrase (#54192)
* Cleanup.
* Make sure that OpenSSH passphrases are handled correctly.
* Add changelog.
2019-03-22 16:15:55 +05:30
David Passante
aa32164d15 cs_volume: add volumes extraction and upload features (#54111)
* cs_volume: add volumes extraction and upload features

* cs_volume: Update doc, remove deprecated code

* cs_volume: Add unit tests for extract and upload features
2019-03-22 07:09:26 +01:00
Alexander Bethke
f9c7ccbb41 Fixes flatpak module to work with flatpak >=1.2.0, fixes #51485 (#51482)
* Fixes flatpak module to work with flatpak >=1.2.0, fixes #51481

This keeps backwards-compatibility for flatpak versions before 1.2.0

* Fixes typeo

Co-Authored-By: oolongbrothers <oolongbrothers@zeibar.net>
2019-03-21 15:57:41 +00:00
tcraxs
bb61d7527f #50877: add support to postgresql_privs to use "FOR { ROLE | USER } target_role" in "ALTER DEFAULT PRIVILEGES" (#51073)
* #50877:
* add support to postgresql_privs to use "FOR { ROLE | USER } target_role"
   in "ALTER DEFAULT PRIVILEGES"

* fix sanity errors

* #50877: fix documentation and add a check for correct usage
of target_roles

*  #50877: fix missing absent option for default privs with target_role

* #50877: add clear description, when target_roles can be used

* #50877: fix conflicts, formatting, and add a changelog fragment

* #50877: fix sanity error E335

* #50877: swap conditions and fix error to warning msg

*  #50877: add tests for default privileges

* #50877: fix tests for default privileges

* #50877: fix tests for default privileges on centos 6
2019-03-21 13:26:44 +00:00
René Moser
f885717f74 fix typo (#54166) 2019-03-21 10:08:54 +01:00
Felix Fontein
8d62794f91 docker: rename docker_*_facts -> docker_*_info (#54124)
* Rename docker_*_facts -> docker_*_info.

* Add changelog.

* Update scenario guide.
2019-03-21 08:37:18 +00:00
René Moser
c5609c51bf
include_tasks: fix traceback if no file specified (#54044) 2019-03-20 19:17:20 +01:00
Martin Krizek
0e28ab4528
Template run_once for handlers (#54030)
Fixes #27237
2019-03-20 14:46:19 +01:00
Brian Coca
d1a688b1d7
dict is dict (#54057) 2019-03-20 09:37:34 -04:00
Felix Fontein
05bca95ab1 ACME: rename acme_account_facts -> acme_account_info (#54082)
* Rename acme_account_facts -> acme_account_info.

* Add changelog fragment.
2019-03-20 13:21:28 +00:00
Hannes Ljungberg
7a3f9456ef docker_swarm_service: Make resolve_image default to false (#54018)
* Make resolve_image default to false

* Check resolve_image versions regularly
2019-03-19 18:58:51 -04:00
Felix Fontein
847a86beef docker_image: allow proxy config (#53905)
* Simplify checks.

* Add use_config_proxy option.

* Add changelog.

* Avoid docker-py crash.
2019-03-19 13:58:16 -04:00
Sorin Sbarnea
014cb73694 Facts: Use vm_stat instead of sysctl for free memory (#52917)
Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
2019-03-19 08:52:52 +05:30
Jordan Borean
7ab77f6c8a
win_psexec - support paths with a space (#54009) 2019-03-19 12:51:30 +10:00
Jordan Borean
cf24542e9f
win_get_url - fix glob like paths (#54008) 2019-03-19 12:01:35 +10:00
Jordan Borean
eb18df1a0f
win_certificate_store - fix glob like paths (#54007) 2019-03-19 11:49:25 +10:00
Jordan Borean
2f1bc34589
win_copy - fix glob like paths (#54006) 2019-03-19 11:22:17 +10:00
Jordan Borean
8a4079ddbf
win_find - fix glob like paths (#54005) 2019-03-19 10:30:11 +10:00
Jordan Borean
c053bc1fc7
win_file - fix glob like paths (#54003) 2019-03-19 09:20:33 +10:00
Felix Fontein
e00f315358 openssl_privatekey: add backup option (#53593)
* Add backup option to openssl_privatekey.

* Add changelog fragment.

* Make module available in remove().

* Add tests for backup.

* Update lib/ansible/modules/crypto/openssl_privatekey.py

Co-Authored-By: felixfontein <felix@fontein.de>

* Update lib/ansible/modules/crypto/openssl_privatekey.py

Co-Authored-By: felixfontein <felix@fontein.de>

* Update lib/ansible/modules/crypto/openssl_privatekey.py

Co-Authored-By: felixfontein <felix@fontein.de>

* Update lib/ansible/modules/crypto/openssl_privatekey.py
2019-03-18 16:34:47 +00:00
MonsieurBon
eb790cd3c6 Added support for iptables module iprange (#53732) (#53732) 2019-03-18 13:05:04 +00:00
Felix Fontein
50d56ca89d docker_image: stop pulling by default on build (#53911)
* Prepare to change default of build.pull from yes to no in Ansible 2.12.

* Specify build.pull.

* Add changelog.

* Fix bad indent.
2019-03-18 01:34:07 -04:00
David Passante
e62fc508ad cs_network_offering: Add choice list for supported_services in arg_spec (#53901) 2019-03-16 13:43:27 +01:00
Jordan Borean
980ca564ce
windows - Fix module utils with glob paths (#53835)
* windows - Fix module utils with glob paths

* fix link util tests when using DOS 8.3 paths
2019-03-15 19:44:53 +10:00
Jordan Borean
cac3c6efcf
win_chocolatey - Fix incompatibilities with latest Chocolatey release (#53841) 2019-03-15 16:40:30 +10:00
Jordan Borean
d00418c924
win_slurp - fix glob like paths (#53831) 2019-03-15 14:59:01 +10:00
Jordan Borean
d063cefb64
win_owner - fix glob like paths (#53830)
* win_owner - fix glob like paths

* Fix issues on older PS versions
2019-03-15 14:58:15 +10:00
Jordan Borean
3cfa71bff0
win_acl_inheritance - fix glob like paths (#53829) 2019-03-15 14:57:59 +10:00
Jordan Borean
aba6f5f50d
win_acl - fix glob file paths (#53828) 2019-03-15 14:57:41 +10:00
Jordan Borean
4f9de45785
win_tempfile - return absolute path on created temp file (#53827)
* win_tempfile - return absolute path on created temp file

* Fix tests for CI
2019-03-15 14:57:27 +10:00
Sam Doran
1e595493d9
User module - Check local database when local is specified in the task (#51088)
The output of pw.getpwnam() does not distinbuish between local and remote accounts. It will return a result if an account exists locally or in the directory. When local is set to True in the task parameters, look through the local password database explicitly.

* Ensure luseradd is present for tests
* Add docs and warnings about local mode
2019-03-14 22:16:53 -04:00
Sloane Hertel
87ebc56de6 Allow parent groups to be variables or literal (#53649)
* Allow parent groups to be variables or literal, requires {{ }}
* Check strict before failing on templating errors
* Don't add a group if an invalid parent group was provided
2019-03-14 14:22:18 -04:00
Brian Coca
e280f2f7b0
Try to get correct buffer size to avoid races (#53547)
* Try to get correct buffer size to avoid races

  fixes #51393

* fix test, mock buffer function since all is mocked
2019-03-14 11:04:56 -04:00
Matteo Ferrando
86405b8fe4 (postgresql_privs) accept 'ALL_IN_SCHEMA' objs for 'function' type (#35331)
* avoid using Postgres formatting function
* add tests for ALL FUNCTIONS IN SCHEMA
* documentation and changelog
* requested changes in tests
* fixed changelog
2019-03-14 20:21:05 +05:30
Felix Fontein
fbbab7429e docker_*: report more warnings (#53710)
* More warnings.

* Add changelog.

* Improve docstring.
2019-03-14 09:55:16 +00:00
Felix Fontein
35e7fb776a docker_image: improve usage (#52894)
* Add source option.

* Split force parameter into force_source, force_absent and force_tag.

* Move all build-related options into a suboption called build.

* Add changelog.
2019-03-14 09:46:38 +00:00
Matt Clay
f6d12fc918 Fix changelog entries using strings for sections. 2019-03-13 23:43:15 -07:00
Matt Clay
7f0e09aa31
Keep existing to_yaml behavior with pyyaml >= 5.1. (#53772)
In pyyaml versions before 5.1 the default_flow_style for yaml.dump
was None. Starting with 5.1 it is now False. This change explicitly
sets the value to None to maintain the original to_yaml behavior.

The change to pyyaml was made in the following commit:

507a464ce6
2019-03-13 16:43:26 -07:00
Brian Coca
42e6700a71 Undeprecate force handlers (#53705)
* removed deprecation notice, made comment instead

* remove noisy deprecation

* space
2019-03-13 15:45:52 -05:00
David Passante
244a9a83aa cs_iso: fix missing param "is_public" (#53740)
* cs_iso: fix missing param "is_public"

* add changelog fragment
2019-03-13 19:06:44 +01:00
Andrey Klychkov
d30879a0b7 postgresql_db - Handle pg_dump return code (#52985)
Handle return code return by pg_dump command

Fixes: #40424
2019-03-13 18:01:50 +05:30
Abhijeet Kasurde
f0ef4dae05
iptables: Add support for gateway parameter (#53465)
When user specifies the JUMP value to 'tee', gateway is required.
This fix adds new parameter 'gateway' to support this functionality.

Fixes: #53170

Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
2019-03-13 17:47:44 +05:30
Felix Fontein
c2cb82ec14 ACME: add support for IP identifiers (#53660)
* Adding support for IP identifiers according to https://tools.ietf.org/html/draft-ietf-acme-ip-05.

* Add changelog.

* Make sure that the authorizations return value is unchanged for CSRs with DNS-only SANs.

* Remove unneeded import.

* type -> identifier_type

* Python 2.6 compatibility.

* Fix unit tests.

* Add IP address normalization.

* Extend tests.

* Move data into fixtures.

* Adjust BOTMETA.
2019-03-13 10:16:56 +01:00
Felix Fontein
028facdfed acme_challenge_cert_helper: add support for IP identifiers (#53661)
* Add IP address identifier support to acme_challenge_cert_helper.

* Add changelog.

* type -> identifier_type.
2019-03-13 10:15:57 +01:00
Jason Witkowski
acdb4c3ede Fix min_size reference where type is None (#53669) 2019-03-12 21:31:03 -04:00
Jordan Borean
3d23e47c53
win_reboot - Fix rc validation when using psrp and add extra docs (#53711)
* win_reboot - Fix rc validation when using psrp and add extra docs

* Revert boot time command and fix docs
2019-03-13 10:43:02 +10:00
Brian Coca
b793f08a92
fixes for stripping (#52930)
function changed to do in place replacement, should be less expensive even with copy as it avoids 'sub copies', can compose with module_args_copy to create replacement for old behavior

  attempt to fix #52910

* handle lists and subdicts correctly
* added  missing exception case, which was not noticed since 'cleaning' was not working
* added comments to clarify exceptions
2019-03-12 18:18:38 -04:00
Brian Coca
a8eb25ac14
clear all loader caches with new dir for plugin (#53413)
* clear all loader caches with new dir for plugin

  fixes #17078

* added toggle to revert behaviour
2019-03-12 16:19:56 -04:00
Martin Krizek
e0a7f01f0b
Add changelog for #53552 (#53695) 2019-03-12 19:09:07 +01:00
Matt Martz
77217fdd24
Fix checksum file parsing in get_url (#53685)
* Fix checksum file parsing. Fixes #48790

* guard invalid int conversion

Co-Authored-By: sivel <matt@sivel.net>

* Remove extra newline
2019-03-12 12:39:02 -05:00
Brian Coca
3e52a6a693
Overridable safety (#53458)
* create overridable sanitation function
* now used in aws, gce and azure plugins
* added new option to these plugins to work in conjunction with general toggle to make it easier
  to emulate inventory script behavior.
2019-03-12 12:03:20 -04:00
Matt Martz
e9f9bcae6a
Don't raise AnsibleConnectionFailure if the ssh process has already died. (#53534)
* Don't raise AnsibleConnectionFailure if the ssh_process has already died. Fixes #53487

* Better support for file not found messages

* Add changelog fragment
2019-03-12 10:41:30 -05:00
Sloane Hertel
4172d68dc3 use composed vars in constructed groups (#53152)
* changelog

* combine provided variables and host vars inside of constructing groups to take into account composed variables

let composed variables "win"

* fix whitespace

* Allow user to control hash behavior
2019-03-11 12:43:31 -04:00
Glandos
d784b77cb4 Remove dependency to psycopg2 with dump/restore (#53323)
* Remove dependency to psycopg2 with dump/restore

'dump' and 'restore' state only need pg_dump and pg_restore. These tools
don't use psycopg2 so this change tries to avoid the use of it in these
cases.

The db_exists test was replaced with an error detection when piping to
compression program, using a FIFO file. This effectively reverts #39483,
that was a fix for #39412.

* Fix typo

* Add changelog fragment

* Add note for dump and restore not requiring psycopg2

* Fix YAML syntax

* Update lib/ansible/modules/database/postgresql/postgresql_db.py

Co-Authored-By: Glandos <bugs-github@antipoul.fr>
2019-03-11 14:38:14 +00:00
Felix Fontein
3117900b1e docker_container: show warnings, fix/improve tests (#53440)
* Output warnings from docker daemon on container create and update.

* Accept warning for blkio_weight instead of idempotency.

* Value quoting.

* Avoid loop variable conflict.

* Add changelog.

* Make one test case faster.

* Add 'Docker warning: ' prefix.

* Add a generalized warning reporting function.
2019-03-11 19:04:06 +10:00
Hannes Ljungberg
7bb174214c docker_swarm_service: Add option rollback_config (#53594)
* Add rollback_config

* Add change log fragment

* Fix broken test

* Actually fix broken tests

* Add rollback_config example

* Default rollback_config as None

* Abort early if rollback_config does not exist
2019-03-11 18:55:41 +10:00
Jordan Borean
830a11dd38
test: optimize win_psmodule tests (#53431) 2019-03-11 05:43:21 +10:00
Hannes Ljungberg
57f706e5a0 docker_swarm_service: Extend mount options (#53559)
* Add mount options

* Remove mount readonly default

* Fix driver_config test

* Add documentation

* Add changelog fragment

* Properly indent tmpfs_ options

* Use correct service suffix for mount tests

* Check for None value on tmpfs usage check

* Document change of mounts.readonly return key

* Use correct change log type

* Really use correct change log type

* Revert changing mount.readonly to read_only
2019-03-09 14:35:57 -06:00
Felix Fontein
c75da35595 Removing a swarm node does not work with docker-py < 2.4.0, since it calls client.inspect_node(). (#53565)
For the same reason, docker_node requires docker >= 2.4.0.
2019-03-09 14:28:04 -06:00
Matt Clay
2c59d88154 Fix yamllint issue. 2019-03-08 22:42:19 -08:00
Matt Clay
0c4785720d Add extensions to changelog fragments. 2019-03-08 22:42:19 -08:00
Matt Clay
5c866fc17e Move fragment to correct location. 2019-03-08 21:38:53 -08:00
Adam Miller
7b98ff6a31 fix pkg name nevra parsing regex in dnf (#53572) 2019-03-08 20:53:46 -08:00
Jason Witkowski
be39e757e3 apply node_id parameter to swarm node removal (#53503) 2019-03-08 15:58:34 -05:00
Matt Martz
414440e323
Allow dict2items to work with hostvars (#53538) 2019-03-08 14:36:53 -06:00
Brian Coca
90bcff3d92
allow nontype configdata (#53365) 2019-03-08 13:03:46 -05:00
Felix Fontein
caf7fd2245 openssl_*: improve passphrase handling for private keys in PyOpenSSL (#53489)
* Raise OpenSSLBadPassphraseError if passphrase is wrong.

* Improve handling of passphrase errors.

Current behavior for modules is: if passphrase is wrong (or wrongly specified), fail.
Current behavior for openssl_privatekey is: if passphrase is worng (or wrongly specified), regenerate.

* Add changelog.

* Add tests.

* Adjustments for some versions of PyOpenSSL.

* Update lib/ansible/modules/crypto/openssl_certificate.py

Improve text.

Co-Authored-By: felixfontein <felix@fontein.de>
2019-03-08 16:21:18 +00:00
Sam Doran
1d91e03119
Ensure Clear Linux parsing is actually parsing a Clear Linux host and all others fall back to NA (#53298)
Fixes a bug where parse_distribution_file_ClearLinux() was called on CoreOS (and probably many other distros) and it returned True since it successfully parses the distribution file. Since this file exists on many Linux distributions and they are a very similar format, add an additional check to make sure it is Clear Linux.

Change the order in which distribution files are processed so NA is last. This prevents a match on CoreOS hosts since they also have /etc/os-release and the called matching function for NA is very general and will match CoreOS.

* Add changelog

* Add unit tests

Only add tests for Clear Linux parsing since that was the cause of this issue.
2019-03-08 10:40:49 -05:00
Bartosz Licheński
6e198487c9 postgresql_privs: Support FOREIGN DATA WRAPPER and FOREIGN SERVER (#38803)
* Support FOREIGN DATA WRAPPER and FOREIGN SERVER in postgresql_privs module
* Added available from note to fdw and fs object types
* Integration tests, examples in documentation
* Complete integration tests
2019-03-08 14:51:03 +05:30
Hannes Ljungberg
f5faf8211d docker_swarm_service: Add read_only option (#53482)
* Add read_only option

* Add changelog fragment

* Add version_added

* Fix broken test
2019-03-08 03:34:49 -05:00
Jakob Ackermann
13ab9a61a8 [docker_image] fix the changed state for tagging and pushing (#53451)
* [docker_image] fix the changed state for tagging and pushing

Signed-off-by: Jakob Ackermann <das7pad@outlook.com>

* [docker_image] add tests for (force) tagging and force pushing

Signed-off-by: Jakob Ackermann <das7pad@outlook.com>

* [docker_image] add a news fragment for the fixed force tag/push behavior

Signed-off-by: Jakob Ackermann <das7pad@outlook.com>
2019-03-08 08:28:42 +00:00
Timo Runge
b45b599433 Fix for "AttributeError: 'module' object has no attribute 'cursors'" (#49191) (#53445)
* Fix for "AttributeError: 'module' object has no attribute 'cursors'" (#49191) (#1)

* Fix for "AttributeError: 'module' object has no attribute 'cursors'" (#49191)

* Adding changelog fragment for issue #49191 and the following PR.

* Update lib/ansible/module_utils/mysql.py

Co-Authored-By: timorunge <timorunge@users.noreply.github.com>
2019-03-08 08:21:56 +00:00
S
3bc474bf99 Fixed win_file crash with hidden files (#52584)
* Fixed crash with hidden files

added "-force" parameter on "Get-Item" cmdlet. this is needed to get file info if the file is "hidden" 
without this option modules like win_file, win_template, win_copy crashes on hidden files. this is because with "test-path" it sees that the file exists, but "get-item" can't get the file info. 
for more information on "-force option": https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.management/get-item

* Add changelog and integration tests

* fix tests for older Windows versions
2019-03-08 15:32:32 +10:00
Abhijeet Kasurde
a5d3647eca
include_vars: include main.yml (#51926)
Enhance the conditional check to include main.yml if it is not
from 'role/vars/'

Fixes: #29135

Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
2019-03-08 10:03:01 +05:30
synical
f470736476 ipa_dnsrecord: Add SRV and MX record type (#42482)
* Add dnsrecord_show method for supporting base domain record
* Replace dnsrecord_show with conditional in dnsrecord_find
* Added changelog entry for MX and SRV

Signed-off-by: synical <sjohnsondot@gmail.com>
2019-03-08 09:48:00 +05:30
Jordan Borean
8ef2e6da05 Add support for Windows hosts in the SSH connection plugin (#47732)
* Add support for Windows hosts in the SSH connection plugin

* fix Python 2.6 unit test and sanity issues

* fix up connection tests in CI, disable SCP for now

* ensure we don't pollute the existing environment during the test

* Add connection_windows_ssh to classifier

* use test dir for inventory file

* Required powershell as default shell and fix tests

* Remove exlicit become_methods on connection

* clarify console encoding comment

* ignore recent SCP errors in integration tests

* Add cmd shell type and added more tests

* Fix some doc issues

* revises windows faq

* add anchors for windows links

* revises windows setup page

* Update changelogs/fragments/windows-ssh.yaml

Co-Authored-By: jborean93 <jborean93@gmail.com>
2019-03-07 16:38:02 -08:00
Hannes Ljungberg
3d07e7241a docker_swarm_service: Documentation fixes (#53479)
* Document and validate mode choices

* Update examples

* Test cpu float values

* Test correct option

* Fix module return sample

* Add secrets and user to module return value

* Order options alphabetically

* Add changelog

* yaml indentation

* Revert "Order options alphabetically"

This reverts commit 51dabccda7.

* Be consistent with choices type
2019-03-07 16:51:59 -06:00
Jordan Borean
008db85d44
win_domain: fix issue when running without credential delegation (#53480)
* win_domain: fix issue when running without credential delegation

* Add check for reboot is required to complete role e install

* Fix changelog sanity issue

* removed meta file accidentally committed
2019-03-08 08:44:12 +10:00
Jordan Borean
072fa54b50
win reg - Support special chars in path (#53305)
* win reg - Support special chars in path

* Added deprecation warning for path separators
2019-03-08 05:41:52 +10:00
Matt Martz
728970232e
Properly quote the username to support usernames with spaces (#53420) 2019-03-07 11:47:33 -06:00
Felix Fontein
b2e992cecd openssl_csr: improve subject validation (#53198)
* Improve subject field validation.

* Add country name idempotency test.

* Add failed country name test.

* Add changelog.
2019-03-07 15:29:35 +00:00
Matt Martz
264d9a9008
Allocate an explicit stdin in async_wrapper (#53410)
* add changelog fragment

* Add stdin async test

* Allocate an explicit stdin in async_wrapper. Fixes #50758
2019-03-07 09:28:44 -06:00
James Cassell
e55e8fe2c4 regex_escape: support POSIX basic regex (#50327) 2019-03-07 08:51:19 -05:00
Hannes Ljungberg
c563caf451 docker_swarm_service: Set minimum docker-py version to 2.0.2 (#53295)
* Fix version checks in tests

* Set minimum version to 2.0.2

* Networks can only be updated >= docker-py 2.7

* Constraints require docker-py 2.4.0

* Healthchecks require docker-py 2.6.0

* Properly run tests different docker_py_versions

* Add changelog fragment

* Specify lowest version on placement.constraints

* Fix running new tests on older docker-py

* Handle different hosts formats returned by docker

* FIx test naming

* Quote str options

* secrets options require docker-py 2.4.0
2019-03-06 20:50:05 +00:00
Sloane Hertel
9687879840
Fix inventory cache interface (#50446)
* Replace InventoryFileCacheModule with a better developer-interface

Use new interface for inventory plugins with backwards compatibility

Auto-update the backing cache-plugin if the cache has changed after parsing the inventory plugin

* Update CacheModules to use the config system and add a deprecation warning if they are being imported directly rather than using cache_loader

* Fix foreman inventory caching

* Add tests

* Add integration test to check that fact caching works normally with cache plugins using ansible.constants and inventory caching provides a helpful error for non-compatible cache plugins

* Add some developer documentation for inventory and cache plugins

* Add user documentation for inventory caching

* Add deprecation docs

* Apply suggestions from docs review

* Add changelog
2019-03-06 12:12:35 -06:00
Brian Coca
b94bfed1a6
scan_packages: made adding package managers easier (#49079)
* made adding package managers easier

  added portage support

* moar pkg mgrs and moar info

 - added 'pkg' pkg manager (freebsd)
 - added pip
 - more apt info

* updated clgo

* Updates from feedback

Co-Authored-By: bcoca <bcoca@users.noreply.github.com>

* incorporated more feedback and added docstrings

* moar from feedback

  - made manager list dynamic and names based on class
  - better not found msg
  - made abstract metaclass again
  - test is now init exception
  - module to global
  - better dedupe comments

* more targetted errors/warnings

* added strategy, reordered to conserve priority

* rpm > apt

* move break to top

* fix trate

* piping it

* lines and meta

* refactored common functions

 - moved pip into it's own module
 - cleaned up base clases
 - ensure 'lower' match in package_facts

* missing license

* avoid facts

* update clog

* addressed feedback

* fix clog

* cleanup

* upd

* removed pip as that was removed

* renamed cpan

* added a single line since 2 lines are needed to be

readabnle instead of just 1 line, it is a huge problem otherwise

* fix internal ref

* not intended in this round

* updated as per fb
2019-03-06 12:29:51 -05:00
Brian Coca
d241794daa
Add toggle to control invalid character substitution in group names (#52748)
* make add_group return proper name
* ensure central transform/check
* added 'silent' option to avoid spamming current users
  those already using the plugins were used to the transformations, so no need to alert them
* centralized valid var names
* dont display dupes
* comment on regex
* added regex tests
  ini and script will now warn about deprecation
* more complete errormsg
2019-03-06 11:49:40 -05:00
Andrea Tartaglia
5c6b16edc3 Fix ec2_instance eventual consistency when wait: false (#51885)
* Do not return 'instances' when wait is false

* Added integration tests for wait: false

* Added changelog fragment

* Fix test suite to work with ec2_instance

* Additional permissions
* Enforce boto3 version
* Fix broken tests
* Improve error messages

* fix linter issues
2019-03-06 22:46:37 +10:00
Tad Merchant
b979b26a74 Add launch type to ecs task (#49081)
* adds fargate launch_type to ecs_task module

* White space changes

* fix documentation for running ecs task on fargate

* remove extraneous example from ecs_task

* White space changes

* Adds changelog fragment

* Pluralize minor_changes in changelog fragment

* Add Stop and Start task permissions
2019-03-06 22:40:32 +10:00
Felix Fontein
61abbfc269 docker_swarm_service: rename return variable to swarm_service (#53229)
* Rename return variable to swarm_service.

* Add changelog.

* Add that old name will stay in Ansible 2.7.x.
2019-03-06 10:27:11 +00:00
Brian Coca
7a0b4a5117
Allow user to control output of verbose messages (#52948)
to stdout (default) or stderr
2019-03-05 16:08:15 -05:00
Brian Coca
949ddb48c0
make debconf compare apples to apples (booleans) (#53331)
hope to fix #25481
2019-03-05 16:03:54 -05:00
Jordan Borean
6b294eab4d
win_dsc - Add argument validation and other fixes (#53093)
* win_dsc - Add argument validation and other fixes

* Fix doc issues
2019-03-06 06:49:37 +10:00
Brian Coca
853a65eead
made chroot exe configurable (#53147)
* made chroot exe configurable

 fixes #53146

* added default for executable
2019-03-05 15:48:31 -05:00
Hannes Ljungberg
7a130d5446 docker_swarm_service: Add hosts option (#53290)
* Add hosts option

* Add changelog fragment
2019-03-05 18:59:49 +00:00
Alan Rominger
56e3597856 Add keyed_groups feature (#52045)
This implements:
- Allow creating keyed group parents
2019-03-05 12:34:34 -06:00
Felix Fontein
8c628c9b2c Simplify docker_*_facts return names (#51939)
* Simplify docker_*_facts return names.

* Adjust regular return values of modules to match style of docker_*_facts modules.
2019-03-05 16:09:00 +00:00
Hannes Ljungberg
139abd0849 docker_swarm_service: Add option groups (#53213)
* Add logging option

* Add limits option

* Add reservations option

* Add restart_config option

* Add update_config option

* Add placement option and remove placement_preferences

* Yaml indentation

* Use correct PR number for change log

* Handle grouper fallbacks better

* Add removed_in_version to argument spec

* Fix broken suboption usage check

* Reduce duplicate deprecated option tests

* Clearer deprecation documentation

* Compare bytes with MiB

* Use correct test service suffix
2019-03-05 16:07:27 +00:00
Felix Fontein
628326b879 openssl_csr: improve invalid SAN error messages (#53201)
* Improve invalid SAN error messages.

* Add changelog.
2019-03-05 16:07:07 +00:00
Felix Fontein
07fcb60d55 Python 2: accept both long and int for type=int (module options) (#53289)
* Added unit test
2019-03-05 09:39:03 -05:00
Viktor Utkin
b2a7561a7f [win_get_url] feature: Add support checksum to module win_get_url (#51986)
* set valid_until equal to current time + spot_wait_timeout

* Add checksum check for downloaded file.

* refactoring

* fix typo

* add fixes

* mart try,catch handling

* revert lib/ansible/modules/cloud/amazon/ec2.py from upstream

* refactoring

* remove empty lines

* add checksum verification for existing file

* fix current file check

* refactoring destination file check

* add handling exceptions

* refactoring

* Added download file hash data from url

* fix string aligning

* fix bug with uri

* Added get hash from multy-string file

* Added URI support for checksum file location

* refactoing

* Remove any non-alphanumeric characters for hash from url

* fix discussions; add support for PS3

* refactoring

* add size return value

* checkout from upstream for lib/ansible/modules/cloud/amazon/ec2.py

* add Ansible.ModuleUtils.Legacy support; refactoring

* Copyright added

* Checking files size before and after downloading added.

* remove unused code

* Corrected regexp for dotted slashed file name prefix in hash-file

* hotfix typo error; add int tests

* remove legacy module support; split checksum to checksum, checksum_algorithm, checksum_url

* changed default hash algorithm

* Fixed case for ContentLength = -1

* Old comment removed

* fix typo

* Remove file size check before downloading

* add alias to ; fix tests

* adjust tests; fix lint warnings from PSScritpAnalyzer

* workaround for bug in win_chocolatey module on win2008

* remove win_get_url.ps1 from /test/sanity/pslint/ignore.txt

* add checksum_algorithm as retuen value

* first normalise before return Result

* resolve discussions

Signed-off-by: Viktor Utkin <viktor.utkin7@yandex.ru>

* fix discussions
fix http tests as discussed

* fix last discussions

* Reduce code duplication and add idempotency check

* fix sanity issue and remove testing code

* move back to using tmp file for checksum comparison
2019-03-05 20:37:00 +10:00
Abhijeet Kasurde
d39f35c1d6
assert: allow list of strings in msg or failed_msg (#50531)
Added check for assert module for msg and failed_msg as a list or string types.

Fixes: #48547

Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
2019-03-05 11:12:17 +05:30
Jordan Borean
b74295d25f
win_chocolatey - add ability to pin a package (#53157)
* win_chocolatey - add ability to pin a package

* fix typoe in changelog fragment
2019-03-05 14:18:42 +10:00
Jordan Borean
be7768efc7
win_chocolatey_source - fix state=disabled with no source (#53097) 2019-03-05 14:18:00 +10:00
Jordan Borean
ae24bbff4a winrm - try and recover from a send input failure (#53187) 2019-03-04 17:31:00 -08:00
Felix Fontein
6249bb8ea4 openssl_certificate: make sure extensions are present when they are queried by assertonly (#53207)
* Make sure extensions are present when they are queried by assertonly provider.

* Add changelog.
2019-03-05 00:09:48 +01:00
Sloane Hertel
4cf7854ca3
If the private_ip has been provided for the new network interface it shouldn't also be added to top level parameters for run_instances (#52579)
changelog
2019-03-04 12:55:37 -06:00
Martin Krizek
239fb1f68d yum/dnf: Add download_dir param (#53171) 2019-03-04 13:08:58 -05:00
Felix Fontein
8e26c2dfbe docker_swarm: support older docker-py versions (#53129)
* Decreasing docker_swarm requirements.

* Fixing docker-py / docker API version requirements, and some comments.

* Add changelog.

* Only send parameters specified by user to docker daemon.

* Extend labels test: not specifying == keep labels.

* Bump minimally required docker-py version for docker_node and docker_node_facts to 2.4.0.

* Prevent crashing when publish or healthcheck is not provided.

* Similarly to docker_swarm tests, only execute docker_node tests on real VMs and restart docker daemon when tests are done.
2019-03-04 12:10:09 +01:00
Andrea Tartaglia
d5d92e4a70 openssl_certificate, fixed has_expired to check the cert expiration date (#53168) 2019-03-02 00:37:28 +01:00
Martin Krizek
66eb301cd3 profile_tasks: Fix last task time with multiple plays (#53065) 2019-03-01 10:29:33 -05:00
Sloane Hertel
8a02f894a6 replace uses of sort_json_policy_dict with compare_policies (#52943)
* replace uses of sort_json_policy_dict with compare_policies which is compatible with Python 3 and remove sort_json_policy_dict from the AWS guidelines since it only works on Python 2

* Sort any lists containing only strings

* Sort the original policy too
2019-02-28 17:09:00 -05:00
Sam Doran
1c87ea6fa6 Reboot - add parameter for paths to search for shutdown command (#51194)
* Look in /lib/molly-guard for shutdown command

Signed-off-by: Sam Doran <sdoran@redhat.com>

* Add parameter for extra_search_paths

Signed-off-by: Sam Doran <sdoran@redhat.com>

* Change option to search_paths

- Update docs
- Make the parameter replace the default values
- Add some sanity checking on the data type

Signed-off-by: Sam Doran <sdoran@redhat.com>

* Correct parameter in tests, change conditional for molly-guard tasks

Signed-off-by: Sam Doran <sdoran@redhat.com>

* Address feedback

* Simplify field validation

Needed the try except in case a non-iterable type is put in the search_paths field
2019-02-28 13:36:33 -08:00
Jiri Tyr
7739b5e96c Last two fields in fstab are optional (fixes #43855) (#43941)
* Last two fields in fstab are optional
* Add changelog
2019-02-28 14:09:30 -05:00
Brian Coca
55dc63be3a
properly convert inputs to handle bytes/unicode (#53072)
* properly convert inputs to handle bytes/unicode

  fixes #52186

* Update changelogs/fragments/nmap_bytes_fix.yml

Co-Authored-By: bcoca <bcoca@users.noreply.github.com>
2019-02-28 11:51:15 -05:00
rwagnergit
d2bdbadb03 adding quiet option to assert (ansible#27124) (#52032)
* adding quiet option to assert (ansible#27124)

* adding doc for quiet to assert.py

* fixing PEP8 failure

* improving example

* improving docs

* adding changelog fragment

* adding . at end of descriptions

* removing trailing blank line

* adding integration test for assert

* fixing CI complaints

* disabling gather_facts in quiet.yml test

* rerunning to capture skip

* cleaning up python 2 vs 3

* following rebase

* fixing CI complaints

* fixing CI complaints

* fixing CI complaints

* fixing CI complaints

* fixing CI complaints
2019-02-28 10:25:41 -05:00
Chuck Douglas
0e9a79a589 Change the retry_files_enabled to False and modify the comments to reflect that this has been disabled (#52581)
* Change the retry_files_enabled to False and modify the comments to reflect that
this has been disabled.

* Change the default action of retry_files_enabled to False

* Update porting guide to reflect change in default state of retry_files_enabled variable

* Change log documenting a change in default behaviour of retry_files_enabled

* Revert config change to comment out the retry_files_enabled line to let the user decided what is best.
Comment above still states how to change.
2019-02-28 10:13:26 -05:00
Andrey Klychkov
cf05429b3c postgresql_privs change fail to warn if role(s) does not exist (#52574)
* postgresql_privs change fail to warn if role does not exists

* postgresql_privs change fail to warn if role does not exists: fix sanity

* postgresql_privs change fail to warn if role does not exists: add changelog fragment

* postgresql_privs change fail to warn if role does not exists: fixes

* postgresql_privs change fail to warn if role does not exists: added fail_on_role param
2019-02-28 14:39:08 +01:00
Sam Doran
23a6b88dd2
Modify the correct variable when setting available hashing algorithms (#52994)
* Revert "use list instead of tuple and remove md5 on ValueError (#51357)" c459f040da.
* Modify the correct variable when determining available hashing algorithms
2019-02-28 07:32:00 -05:00
Matt Davis
4d3a6123d5
Python interpreter discovery (#50163)
* Python interpreter discovery

* No longer blindly default to only `/usr/bin/python`
* `ansible_python_interpreter` defaults to `auto_legacy`, which will discover the platform Python interpreter on some platforms (but still favor `/usr/bin/python` if present for backward compatibility). Use `auto` to always use the discovered interpreter, append `_silent` to either value to suppress warnings.
* includes new doc utility method `get_versioned_doclink` to generate a major.minor versioned doclink against docs.ansible.com (or some other config-overridden URL)

* docs revisions for python interpreter discovery

(cherry picked from commit 5b53c0012ab7212304c28fdd24cb33fd8ff755c2)

* verify output on some distros, cleanup
2019-02-27 23:52:02 -08:00
Brian Coca
cfba6dfe91
Ensure play order is obeyed (#49897)
* Ensure play order is obeyed

 it was being ignored depending on other options
 also added tests for each order (except shuffle) both serial and not
 fixes #49846
2019-02-27 18:20:16 -05:00
Marcos Paulo de Souza
fa83a711b6 hostname.py: Fix openSUSE distribution name (#47020)
All openSUSE distributions changed to the way they are returned from distro.id().

This patches fix the openSUSE Leap and SLES distro names, and adds one entry for Tumbleweed.

These descriptions are capitilized, as expected by Ansible's hostname module.

Signed-off-by: Marcos Paulo de Souza <marcos.souza.org@gmail.com>
2019-02-27 16:18:32 -05:00
Sloane Hertel
8fbb2f8b2a
fix no_log indentation so AWS temporary credentials aren't displayed in tests (#53073) 2019-02-27 12:22:43 -06:00
Felix Fontein
76e0e0080b Fix force when state==present. (#53003) 2019-02-27 09:11:57 +00:00
Felix Fontein
dec97381bc docker_swarm: fix ca_force_rotate idempotency (#53039)
* Fix ca_force_rotate idempotency.

* Add changelog.
2019-02-27 09:11:45 +00:00
Brandon Bui
1aae196cfa add boto3_tag_list_to_ansible_dict to ec2_vpc_peering_facts.py, and parameter checking to ec2_vpc_peer.py (#52307)
* add boto3_tag_list_to_ansible_dict to ec2_vpc_peering_facts.py

* Add parameter checking to ec2_vpc_peer and give helpful error message

* Fixed modules --> module typo in ec2_vpc_peer

* Added required_if logic and fixed incorrect boolean check for absent peering connection

* Changed error message to one of the following is

* Added changelog fragments for ec2_vpc_peer changes

* Changed changelog fragment as per request
2019-02-27 16:19:34 +10:00
Tad Merchant
b538e34a32 Ecs service add features (#50059)
* Support UpdateService forceNewDeployment in ecs_service module

* Fixes for review

* Add force_new_deployment option to ecs_service.py

cherrypicks changes from via/ansible
Adds tests for pull request #42518
fixes backwards compatability with boto<1.8.4

* WIP commit so I don't have to stash

* WIP commit for healthcheck grace period

* WIP commit; ecs_module handles service registries

* Fix bad check for desired_count

* Add scheduling strategy test, comment out service registry test

* Fix names in ecs_cluster role main task.

* move full test run back to the end

* Change botocore version for full test to support scheduling strategy

* fix bug with desired_count==0 in amazon/ecs_service

* Fix changed checking for scheduling strategy DAEMON in ecs_service

* Pass testS

* Fix some unhelpful comments

* Add changelog for ecs_service
2019-02-27 13:20:19 +10:00
Brian Coca
514b974182
Loader invalid plugin nicer error (#52754)
* stop processing invalid plugins
2019-02-26 11:51:16 -05:00
Pilou
d8a2d64ec1 osx_say callback plugin: add espeak support, rename to say (#33740)
* rename into say

* add support for espeak command

* adds symlink from osx_say to say

* Update version number
2019-02-26 09:46:35 -06:00
Felix Fontein
bf3c291606 docker_swarm: add diff support (#52947)
* Add diff support to docker_swarm.

* Add changelog.

* Using diff mode for docker_swarm tests. This improves debugging, since the the module now outputs more information on *why* it did certain actions.
2019-02-26 11:57:02 +00:00
Felix Fontein
42ae6cdb95 docker_swarm: fix idempotency (#52976)
* Improve idempotency checking: only consider parameters which are part of the generated spec.

* Properly handle rotate_worker_token and rotate_manager_token.
2019-02-26 11:46:43 +00:00
Dawson Mortenson
6f585b6ee9 terraform: patch state 'planned' outputs and perform minor refactor (#52004)
* patch state 'planned' outputs and perform minor refactor

* reconcile with pep8 and pylint

* remove a space...

* update changed to only flip when >0 added, changed, or destroyed is detected

* add state dependecy to conditional change check

* fix typo

* reconcile with pep8[E317]

* add a changelog fragment
2019-02-26 11:39:13 +00:00
Jordan Borean
d55ddec923
Revert Clear failed state in always only if we did rescue (#52968)
* Revert "Clear failed state in always only if we did rescue (#52829)"

This reverts commit f135960fc2.

* Add tests for failed scenario

* Set failed task with EXPECTED FAILURE
2019-02-26 16:22:32 +10:00
Brian Coca
40a053ce78
better error for bad module options (#52726)
also document clearly inline vaults don't work on 'options'
  fixes #52707
2019-02-25 15:58:51 -05:00
Martin Krizek
f135960fc2
Clear failed state in always only if we did rescue (#52829)
Fixes #52561
2019-02-25 09:30:17 +01:00
Felix Fontein
a1ec307d43 docker_swarm: make labels work with older docker daemon versions (#52895)
* Make labels work with older docker daemon versions.

* Fix idempotence detection.

* Add changelog.
2019-02-25 08:16:09 +00:00
Mario Lenz
bcd6702b8a VMware: Fix KeyError in vmware_host_config_manager (#52736)
* Bug fix for vmware_host_config_manager

* Update changelogs/fragments/44561-vmware_host_config_manager-fix_key_error.yml

Co-Authored-By: mariolenz <m@riolenz.de>
2019-02-25 13:27:49 +05:30
Jordan Borean
1126f76d4d
win_certificate_store - Fix exception handling typo (#52906) 2019-02-25 13:00:04 +10:00
René Moser
ee416fd01d
cloudscale: fix compatibilty with older py3 versions (#52822)
* cloudscale: fix compatibilty with older py3 versions

* add doc fragment
2019-02-24 20:04:34 +01:00
Felix Fontein
81d58cfef6 docker_swarm: hopefully fix debug CI problems, and fix check mode (#52825)
* Let's see some debug output.

* Also check LocalNodeState.

* Improve tests.

* Actually implement check mode.

* Add changelog.

* Add pretty-printing and more output.
2019-02-23 17:18:17 -05:00
Sam Doran
cc9c72d6f8 Do not add state: absent when a non-existent path is returned (#51350)
Leave it up to the module to return the state in the results.

I went through all the modules in files/ and only found one case where the module needed to return this. No other modules return paths that do not exists.

Signed-off-by: Sam Doran <sdoran@redhat.com>
2019-02-23 01:48:44 +01:00
Kevin Breit
d65a91ea7e meraki_config_template - Fix actions when specifying net_id (#51586)
* Allow configuration templates when using net_id...for reals
- Didn't work before, I had bad code. I'm sorry.
- Cleaned up code and simplified functions
- Added integration tests to test for net_id actions

* Add changelog

* Add module name to changelog

* Fix indentation
2019-02-22 19:39:01 -05:00
Sam Doran
f52a088862
Add option to ignore, warn, or error when a module parameter is converted to a string (#51404)
* Add new module property to Windows modules
* Add brief pause to file tests to ensure the stat times are not equal, which was happening sometimes.
* Raise TypeError on error rather than fail_json()
* Rework error message to be less verbose
* Add porting guide entry
2019-02-22 16:44:32 -05:00
Bramzor
17186bbde0 Added npm ci command (#49665)
* #49664 Added npm ci command

* Update lib/ansible/modules/packaging/language/npm.py

Sure

Co-Authored-By: Bramzor <bramverdonck@telenet.be>

* Moved ci_install so it would work for specific packages

Would this work?

* Reverted last commit

npm ci will remove node_modules so cannot be used it to install a specific module.

* Update lib/ansible/modules/packaging/language/npm.py

Co-Authored-By: Bramzor <bramverdonck@telenet.be>

* Update lib/ansible/modules/packaging/language/npm.py

Co-Authored-By: Bramzor <bramverdonck@telenet.be>

* Update lib/ansible/modules/packaging/language/npm.py

Co-Authored-By: Bramzor <bramverdonck@telenet.be>
2019-02-22 13:54:54 +00:00
Till Maas
0469134f16 rhsm_repository: Properly handle no repos (#51938)
When no repos are defined, the `repo` variable is undefined. Therefore
append it only to the result if a repo was found. Otherwise Ansible will
fail with an UnboundLocalError.
2019-02-22 11:44:18 +00:00
Albert Cervera i Areny
e0274adafe Filter DNSimple request by record name. (#49981)
* Filter DNSimple request by record name.

The request was not filtered and DNSimple returns only the first 100
records so if the number of records is larger the check could fail.

This patch fixes the issue and also makes the check to perform better.

* Add changelog fragment.
2019-02-22 08:58:16 +00:00
Tuan Anh Hoang-Vu
b0fc2a2103 Fixed lvol ValueError with float size. (#36811)
* Fixed lvol ValueError with float size.

* Fixed lvol ValueError with float size.

* Initialized locale using system default.
Changed size validation from float() to locale.atof().

* Added changelog fragment.
2019-02-22 08:41:50 +00:00
rockandska
540b07b884 Fix idempotence in rabbitmq_plugin (#52166)
* Fix idempotence in rabbitmq_plugin

* Add changelog fragment
2019-02-22 08:36:32 +00:00
arsenicks
d3fcdae4ad Katello: Added product to the dict choices (#49776)
* Added product to the dict choices.

Following issue 48594 where product is not a recognised choice: https://github.com/ansible/ansible/issues/48594

* fixed doc

added - product to the doc

* split line 549

to correct ci test splitting line 549

* Create 49776-product_fix_katello_foreman_module.yaml

changelog fragment creation
2019-02-22 08:27:34 +00:00
Abhijeet Kasurde
e41b98ffb5
VMware: Refactor guest inventory plugin (#52642)
* VMware: Refactor guest inventory plugin
* Review comments

Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
2019-02-22 09:55:57 +05:30
plumbeo
e73e9ecbc3 mysql_user: fix malformed regex used to check current privileges (#52278)
* mysql_user: fix malformed regex used to check current privileges

* Add changelog fragment for PR #52278
2019-02-21 16:39:51 -08:00
Jiri Tyr
ee14b123f3 Adding changelog fragment for PR #52051 (#52687) 2019-02-21 16:19:02 -05:00
Jiri Tyr
280e8911ce Adding changelog fragment for PR #52086 (#52689) 2019-02-21 16:18:18 -05:00
Hannes Ljungberg
dd4b4aa941 docker_swarm_service: Add stop_grace_period option (#52519)
* Add stop_grace_period option

* Add changelog fragment

* Move doc type to last

* Add version_added
2019-02-21 20:12:13 +00:00
Hannes Ljungberg
da8574c567 docker_swarm_service: Allow passing period strings on relevant options (#52530)
* Allow duration to be passed as duration strings

* Remove whitespace

* Add changelog fragment

* Fix broken test

* Better error handling
2019-02-21 11:47:06 +00:00
Hannes Ljungberg
7276344f85 docker_swarm_service: Don’t remove service when networks change (#52634)
* Don’t remove service when networks change

* Add changelog fragment

* Some more network integration tests

* Add hannseman as author

* Remove return on self.client.fail
2019-02-21 11:46:50 +00:00
Brian Coca
8a0347ac7a
warn when having issues with local facts (#52507)
* warn when having issues with local facts

fixes 41609
2019-02-20 17:25:55 -05:00
Veaceslav Mindru
6f91bccf78 handle non strings in requirements version for ansible-galaxy (#52109) 2019-02-20 14:28:04 -05:00
Martin Krizek
be9f07279e Add stats on rescued/ignored tasks (#48418)
* Adding rescued/ignored tasks to stats gathering

Fixes #31245

* Amend integration tests to pass

* callback/dense.py: fix too-many-format-args

* Add changelog

* Amend counter_enabled and unixy callbacks

* Fix syntax error

* Fix typo in the changelog

* Remove not needed comment

* Re-add skipped

* Add test for rescued

* Fix colors...

* Fix unstable tests?

* Add a note to the porting guide

* Re-word the note in the porting guide

Fixes #20346
Fixes #24525
Fixes #14393

Co-authored-by: James Cammarata <jimi@sngx.net>
Co-authored-by: Martin Krizek <martin.krizek@gmail.com>
2019-02-20 13:00:47 +10:00
Jordan Borean
1ec376abca
win_chocolatey - fix beta version parsing (#52601) 2019-02-20 08:16:48 +10:00
Mariusz Mazur
03c4cd757c Add k8s_auth and kubevirt_vm to the k8s group (#52320) 2019-02-19 16:01:11 -05:00
Martin Nečas
8d5811a611 ovirt_network: ovirt fix getting labels (#52499)
* ovirt fix getting labels

* add changelog - ovirt_network_label_fail

* add new line to changelog ovirt_network_label_fail
2019-02-19 13:42:10 -05:00
Hoshiyo
008313b8cc fix(rundeck_acl_policy): compatible python 2 and 3 (#52473)
* fix(rundeck_acl_policy): compatible python 2 and 3

* Add changelog fragment

* Use to_text instead of decode
2019-02-19 15:08:41 +00:00
Abhijeet Kasurde
57d85031d7
Parse multiple values for single key in cmdline facts (#49591)
* Facts parsing for cmdline can now handle multiple values for a single key.
* Unit tests for cmdline fact parsing
* Review comments

Fixes: #22766

Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
2019-02-19 15:47:06 +05:30
René Moser
d99728d9e6
cron: adjust deprecated version (#52531)
* add changelog fragment

* fixed freudian slip in changelog
2019-02-19 07:26:34 +01:00
Kevin Breit
48128ec2fc meraki_ssid - Modifying SSID won't work when specifying number (#51645)
* Fix bug when specifying SSID by number
- Migrated integration test to blocks with always
- Minor URL fixes

(cherry picked from commit ed79c294f2e3f82d4828226004c055dcd7ce9f63)

* Create changelog file

* Add new line
2019-02-18 19:25:41 -05:00
Dominik Holler
4df55bea2f provider_segmentation_id is int (#51600)
According to the OpenStack Networking API
the attribute provider:segmentation_id of a network has to be
an integer.
Even if neutron accepts provider:segmentation_id to be a
string, other implementations may not.
2019-02-18 18:26:03 -05:00
Kevin Breit
c254b93796 Meraki performance fixes for net and org lookups (#51395)
* Performance fixes for net and org lookups
- Both methods had duplicate lookups
- This should significantly improve performance
- Currently untested

* Add ChangeLog file

* Change from bugfix to bugfixes and change indent
2019-02-18 23:58:27 +01:00
Brian Coca
5e9b089ec2
Avoid resolving module_paths for docs (#51453)
alternate to #51419
2019-02-18 15:51:49 -05:00
Matt Martz
42cf50fbac Do not send "Connection: close" when requesting a tunnel. Fixes #32750 (#46070) 2019-02-18 14:58:50 -05:00
Hannes Ljungberg
0bf9052e06 docker_swarm_service: Remove defaults (#52420)
* Remove update_parallelism default

* Remove update_delay default

* Add documentation about removing defaults

* Present porting guide changes as a list
2019-02-18 14:19:19 -05:00
Matt Martz
77bfcad33a
Support unix socket with urls/uri (#43560)
* First pass at allowing unix socket with urls/uri. See #42341

* Only insert handler as needed

* Fix and add tests

* Add HTTPS functionality for unix sockets

* Additional test fixes

* Create context manager for monkey patching HTTPConnection.connect, de-dupe code, raise better errors

* doc

* Add a few more tests

* Fix __call__

* Remove unused import

* Patch HTTPConnection.connect with the functionality we want, instead of duplicating code and disabling

* Fix var name

* Remove unused var

* Add changelog fragment

* Update uri docs

* Fix rebase indentation issue
2019-02-18 10:21:42 -06:00
Matt Clay
687279c7bd Set user expires on FreeBSD using UTC. (#52276) 2019-02-18 09:59:13 -05:00
Hannes Ljungberg
c80ad43371 docker_swarm_service: Add working_dir option (#52425)
* Add working_dir option

* Check local mounts var to align with other checks

* Add changelog fragment

* Add trailing comma
2019-02-18 13:42:19 +00:00
Felix Fontein
37b0f5c81b docker: provide alternatives to ansible_facts results (#51192)
* Try to stop using ansible_facts for docker modules.

* Stop using facts returned from regular modules.
2019-02-18 13:41:34 +00:00
Felix Fontein
8222ebd23a docker_image: really deprecate state==build (#52412)
* Really deprecate state==build.

* Also explicitly deprecate use_tls.

* Add changelog.
2019-02-18 13:25:25 +00:00
Hannes Ljungberg
64b12d2c0d docker_swarm_service: Add groups option (#52428)
* Add groups option

* Add changelog fragment

* Remove whitespace

* Remove whitespace
2019-02-18 13:12:05 +00:00
Matt Martz
9f82f3fd14 Alias ansible_model to ansible_product_name for Darwin. Fixes #52233 (#52242) 2019-02-18 10:22:44 +00:00
Hannes Ljungberg
18b968d486 docker_swarm_service: Add healthcheck option (#52419)
* Define yaml versions as strings

* Add healthcheck option

* Add changelog fragment

* Don’t set version_added as strings

* Use single quoted string

* Disable healthcheck tests on python 2.6

* Bring back quoting on already quoted version-added

* Python 2.6 compat

* Move functions to docker-common

* Move parse_healthcheck to docker-common

* Cast exception to str before printing failure

* Extend parse_healthcheck tests
2019-02-18 09:46:14 +00:00
Hannes Ljungberg
77d116f66e docker_swarm_service: Add stop_signal option (#52424)
* Add stop_signal option

* Add changelog fragment
2019-02-18 09:43:35 +00:00
Zim Kalinowski
fa73abcf5d
fixing force_update in azure_rm_mysqldatabase (#52389) 2019-02-18 14:20:30 +08:00
Zim Kalinowski
8422e23533
Fixing azure_rm_postgresqldatabase force_update parameter (#52388) 2019-02-18 14:04:01 +08:00
Abhijeet Kasurde
fad6443e58
Distribution: Add support for Linux Mint 18.3 (#52224)
* Distribution: Add support for Linux Mint 18.3
* Review comments

Fixes: #52210

Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
2019-02-18 08:28:04 +05:30
Felix Fontein
be3a47e2fe docker_common: improve image finding methods (#44692)
* Work around problem with Docker daemon that sometimes won't find image if prefixed with docker.io repo name.

* When tring library/xxx, docker-py also doesn't sometimes find the image.

* Add changelog.
2019-02-17 14:28:40 -05:00
Martin Krizek
50d7483632
Native Jinja2: raise undefined error immediately (#52237)
Fixes #52158
2019-02-15 19:36:12 +01:00
Timo Runge
47190088b4 module_utils/mysql: Fixing unexpected keyword argument 'cursorclass' error after migratio… (#47809)
* Fixing unexpected keyword argument 'cursorclass' error after migration from MySQLdb to PyMySQL

* Adoptions for mysql.py as suggested by felixfontein.

* Adding changelog fragment.
2019-02-15 15:38:01 +00:00
Zim Kalinowski
2f3960558d
Fix for PostgresSQL server update and storage_mb (#51653) 2019-02-15 17:46:52 +08:00
Zim Kalinowski
1f5cda37b3
Fix for MySQL server update and storage_mb (#51661) 2019-02-15 17:33:21 +08:00
Zim Kalinowski
0c8c72a0bf
Fixing managed disk facts (#51781) 2019-02-15 17:07:30 +08:00
Adam Miller
ea0e2bf2b3 yum always return changes dict, not only in check mode (#51987)
Previously the yum module would provide a `changes` dict when
executed in check mode but omit it when not in check mode in favor
of the `results` data which is raw output from the yum command. This
pull request makes that output uniform.

Fixes #51724

Signed-off-by: Adam Miller <admiller@redhat.com>
2019-02-13 17:46:32 -05:00
Simon Westphahl
02e87b7d70 Raise AnsibleConnectionError on winrm connnection errors (#51744)
* Raise AnsibleConnectionError on winrm con errors

Currently all uncaught exceptions of the requests library that is used
in winrm will lead to an "Unexpected failure during module execution".

Instead of letting all exceptions bubble up we catch the connection
related errors (inkl. timeouts) and re-raise them as
AnsibleConnectionError so Ansible will mark the host as unreachable and
exit with the correct return code.

This is especially important for Zuul (https://zuul-ci.org) to
distinguish between failures and connection/host related errors.

* Update lib/ansible/plugins/connection/winrm.py

Co-Authored-By: westphahl <westphahl@gmail.com>

* Add changelog fragment
2019-02-13 14:55:55 -05:00
Kevin
c512471428 Add two more failure conditions to unarchive (#51914) 2019-02-13 13:40:26 -05:00
Matt Martz
b34d141eed
Disallow use of remote home directories containing .. in their path (CVE-2019-3828) (#52133)
* Disallow use of remote home directories containing .. in their path

* Add CVE to changelog
2019-02-13 10:38:28 -06:00
Juan Antonio Osorio
9f081ca04f identity: Add GSSAPI suport for FreeIPA authentication (#52031)
* identity: Add GSSAPI suport for FreeIPA authentication

This enables the usage of GSSAPI for authentication, instead of having
to pass the username and password as part of the playbook run.

If there is GSSAPI support, this makes the password optional, and will
be able to use the KRB5_CLIENT_KTNAME or the KRB5CCNAME environment
variables; which are standard when using kerberos authentication.

Note that this depends on the urllib_gssapi library, and will only
enable this if that library is available.

* identity: Add documentation for GSSAPI authentication for FreeIPA

This documentation describes how to use GSSAPI authentication with the
IPA identity modules.

* identity: Add changelog for GSSAPI support for IPA

This adds the changelog entry for the GSSAPI authentication feature for
the IPA identity module.
2019-02-13 15:38:13 +00:00
Alan Rominger
af9ff07c74 Send openstack inventory logs to stderr (#51827) 2019-02-13 13:36:37 +00:00
Will Thames
46fbcf08bc
aws_kms enhancements (#31960)
* Allow creation and deletion of keys (deletion just schedules for
  deletion, recreating an old key is just cancelling its deletion)
* Allow grants to be set, thus enabling encryption contexts to be
  used with keys
* Allow tags to be added and modified
* Add testing for KMS module
* Tidy up aws_kms module to latest standards
2019-02-13 13:06:58 +10:00
Andrew Gaffney
9c35f18dd6 Custom jinja Undefined class for handling nested undefined attributes (#51768)
This commit creates a custom Jinja2 Undefined class that returns
Undefined for any further accesses, rather than raising an exception
2019-02-12 15:04:00 -05:00
hansmi
76ab88c9f5 callbacks/slack: Explicitly set Content-Type header (#51824)
There are other chat systems with hook implementations more or less
compatible with Slack, such as Rocket.Chat. The latter requires the
Content-Type header to be set to "application/json" (the body is JSON).

Signed-off-by: Michael Hanselmann <public@hansmi.ch>
2019-02-12 12:47:33 -05:00
Abhijeet Kasurde
5c992fcc3f
ansible-vault: handle utf-8 filename in vault (#50341)
Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
2019-02-12 16:13:51 +05:30
Hannes Ljungberg
70d8f02db7 docker_swarm_service: Extend env and add env_files support (#51762)
* Extend env and add env_files support

* Python 2.6 compat

* Handle lists passed as string

* Add changelog fragment

* Use correct link formatting

Co-Authored-By: hannseman <hannes@5monkeys.se>

* Fix typo

Co-Authored-By: hannseman <hannes@5monkeys.se>

* Handle empty env and env_files values
2019-02-12 08:06:58 +00:00
Felix Fontein
09f78d2f6c ufw: allow to insert rules relative to first/last IPv4/IPv6 rules (#49796)
* Insert should have type int.

* Add insert_relative_to option.

* Add changelog.

* Add tests.

* Improve comment.
2019-02-12 08:05:14 +00:00
Jordan Borean
179cbb9891
win_dsc - return warning from DSC invocation (#51927) 2019-02-12 13:50:00 +10:00
Matt Martz
445ff39f94
Become plugins (#50991)
* [WIP] become plugins

Move from hardcoded method to plugins for ease of use, expansion and overrides
  - load into connection as it is going to be the main consumer
  - play_context will also use to keep backwards compat API
  - ensure shell is used to construct commands when needed
  - migrate settings remove from base config in favor of plugin specific configs
  - cleanup ansible-doc
  - add become plugin docs
  - remove deprecated sudo/su code and keywords
  - adjust become options for cli
  - set plugin options from context
  - ensure config defs are avaialbe before instance
  - refactored getting the shell plugin, fixed tests
     - changed into regex as they were string matching, which does not work with random string generation
     - explicitly set flags for play context tests
 - moved plugin loading up front
 - now loads for basedir also
 - allow pyc/o for non m modules
 - fixes to tests and some plugins
 - migrate to play objects fro play_context
 - simiplify gathering
 -  added utf8 headers
 - moved option setting
 - add fail msg to dzdo
 - use tuple for multiple options on fail/missing
 - fix relative plugin paths
 - shift from play context to play
 - all tasks already inherit this from play directly
 - remove obsolete 'set play'
 - correct environment handling
 - add wrap_exe option to pfexec
 - fix runas to noop
 - fixed setting play context
 - added password configs
 - removed required false
 - remove from doc building till they are ready

future development:
  - deal with 'enable' and 'runas' which are not 'command wrappers' but 'state flags' and currently hardcoded in diff subsystems

* cleanup

  remove callers to removed func
  removed --sudo cli doc refs
  remove runas become_exe
  ensure keyerorr on plugin
  also fix backwards compat, missing method is attributeerror, not ansible error
  get remote_user consistently
  ignore missing system_tmpdirs on plugin load
  correct config precedence
  add deprecation
  fix networking imports
  backwards compat for plugins using BECOME_METHODS

* Port become_plugins to context.CLIARGS

This is a work in progress:
* Stop passing options around everywhere as we can use context.CLIARGS
  instead

* Refactor make_become_commands as asked for by alikins

* Typo in comment fix

* Stop loading values from the cli in more than one place

Both play and play_context were saving default values from the cli
arguments directly.  This changes things so that the default values are
loaded into the play and then play_context takes them from there.

* Rename BECOME_PLUGIN_PATH to DEFAULT_BECOME_PLUGIN_PATH

As alikins said, all other plugin paths are named
DEFAULT_plugintype_PLUGIN_PATH.  If we're going to rename these, that
should be done all at one time rather than piecemeal.

* One to throw away

This is a set of hacks to get setting FieldAttribute defaults to command
line args to work.  It's not fully done yet.

After talking it over with sivel and jimi-c this should be done by
fixing FieldAttributeBase and _get_parent_attribute() calls to do the
right thing when there is a non-None default.

What we want to be able to do ideally is something like this:

class Base(FieldAttributeBase):
    _check_mode = FieldAttribute([..] default=lambda: context.CLIARGS['check'])

class Play(Base):
    # lambda so that we have a chance to parse the command line args
    # before we get here.  In the future we might be able to restructure
    # this so that the cli parsing code runs before these classes are
    # defined.

class Task(Base):
    pass

And still have a playbook like this function:

---
- hosts:
  tasks:
  - command: whoami
    check_mode: True

(The check_mode test that is added as a separate commit in this PR will
let you test variations on this case).

There's a few separate reasons that the code doesn't let us do this or
a non-ugly workaround for this as written right now.  The fix that
jimi-c, sivel, and I talked about may let us do this or it may still
require a workaround (but less ugly) (having one class that has the
FieldAttributes with default values and one class that inherits from
that but just overrides the FieldAttributes which now have defaults)

* Revert "One to throw away"

This reverts commit 23aa883cbed11429ef1be2a2d0ed18f83a3b8064.

* Set FieldAttr defaults directly from CLIARGS

* Remove dead code

* Move timeout directly to PlayContext, it's never needed on Play

* just for backwards compat, add a static version of BECOME_METHODS to constants

* Make the become attr on the connection public, since it's used outside of the connection

* Logic fix

* Nuke connection testing if it supports specific become methods

* Remove unused vars

* Address rebase issues

* Fix path encoding issue

* Remove unused import

* Various cleanups

* Restore network_cli check in _low_level_execute_command

* type improvements for cliargs_deferred_get and swap shallowcopy to default to False

* minor cleanups

* Allow the su plugin to work, since it doesn't define a prompt the same way

* Fix up ksu become plugin

* Only set prompt if build_become_command was called

* Add helper to assist connection plugins in knowing they need to wait for a prompt

* Fix tests and code expectations

* Doc updates

* Various additional minor cleanups

* Make doas functional

* Don't change connection signature, load become plugin from TaskExecutor

* Remove unused imports

* Add comment about setting the become plugin on the playcontext

* Fix up tests for recent changes

* Support 'Password:' natively for the doas plugin

* Make default prompts raw

* wording cleanups. ci_complete

* Remove unrelated changes

* Address spelling mistake

* Restore removed test, and udpate to use new functionality

* Add changelog fragment

* Don't hard fail in set_attributes_from_cli on missing CLI keys

* Remove unrelated change to loader

* Remove internal deprecated FieldAttributes now

* Emit deprecation warnings now
2019-02-11 11:27:44 -06:00
James Cassell
953058d025 standardize connection variable names (#51776)
* standardize user/password connection vars

* docs: use ansible_user and ansible_password

* docs: var precedence for connection vars

* docs: ansible_become_pass -> ansible_become_password etc
2019-02-11 10:43:10 -05:00
Matt Martz
3c85ac1788
Promote include_tasks/role and import_tasks/role to stableinterface (#51975) 2019-02-11 09:06:38 -06:00
Felix Fontein
4d3d8dd60f ufw: check values for direction depending on situation (#50402)
* Check values of 'direction'.

* Add changelog.

* Update lib/ansible/modules/system/ufw.py

Co-Authored-By: felixfontein <felix@fontein.de>

* Update lib/ansible/modules/system/ufw.py
2019-02-11 14:47:35 +00:00
Felix Fontein
a279892fae ufw: allow gre and igmp protocols (#51166)
* ufw: allow gre and igmp protocols.

* Add changelog.
2019-02-11 14:46:38 +00:00
Jérôme BAROTIN
b99de25f32 Enable changed var with ufw check mode (#49948)
* Enable 'changed' var with ufw check mode

* Fix from comment of the PR + Unit Test

* Fix on ufw module after the second review

- delete rules change works in check mode
- simplify execute def & use it on every call process
- improved regexp
- rename vars defaults to current_default_values

* Add ignore error to execute() and use it in get_current_rules()

* Update after third code review (introduce change in changed status)

* Adjust tests and fix some problems (#1)

* 'active' also appears in 'inactive'.

* 'reject' is also a valid option here.

* For example for reloaded, changed will be set back to False here.

* Improve and adjust tests.

* Fix after merging integration test

* handle "disabled" on default routed

* Add /var/lib/ufw/.. rules files

* add unit test

* Fix pep8 formatting error

* Separate ipv6 and ipv4 rules process from checkmode

* fix non-ascii error on ci

* Some change after review

* Add unit test with sub network mask

* rename is_match function by is_starting

* add changelog fragment
2019-02-11 11:05:35 +00:00
Felix Fontein
9b1cbcf3a4 openssl_csr: ignore empty strings in altnames (#51473)
* Ignore empty strings in altnames.

* Add changelog.

* Add idempotence check without SAN.

* Fix bug in cryptography backend.
2019-02-11 10:30:56 +00:00
Adam Miller
2721ed260e Properly handle unauthenticated yum proxy config (#51915)
Fixes #51548

Signed-off-by: Adam Miller <admiller@redhat.com>
2019-02-09 01:17:22 -05:00
Jeremiah Mahler
ffbc9d99de fix Amazon system-release version parsing (#51521)
Previously it was assumed that the Amazon system-release
number was the final value of the string.  This isn't always
the case.  Some releases have the name at the end.

  Amazon Linux release 2
  Amazon Linux release 2 (Karoo)

Fix by instead looking for a number in the string.

Fixes #48823
2019-02-07 17:58:34 -05:00
Adam Miller
9bb05b72b2 correctly detect pkg_mgr on fedora/rhel/centos rpm-ostree installed (#49256)
Check the path /run/ostree-booted which I'm told by upstream that it
will always be present when a host system is Fedora/RHEL/CentOS
Atomic/CoreOS vs "traditional" distro instance to detect the
non-traditional instance and ensure pkg_mgr selection is correct

Signed-off-by: Adam Miller <admiller@redhat.com>
2019-02-07 15:16:38 -05:00
Mike Sgarbossa
c459f040da use list instead of tuple and remove md5 on ValueError (#51357)
* use list instead of tuple and remove md5 on ValueError

Signed-off-by: michael.sgarbossa <msgarbossa@cvs.com>

* convert algorithms to list and add comment

Signed-off-by: michael.sgarbossa <msgarbossa@cvs.com>

* only convert to list if algorithms is not None

Signed-off-by: michael.sgarbossa <msgarbossa@cvs.com>

* new fragment for PR 51357

Signed-off-by: michael.sgarbossa <msgarbossa@cvs.com>

* fix lint: remove blank line
2019-02-07 11:23:11 -05:00
Viktor Utkin
d40f0313e2 spot instance request stay opened when module exit with timeout (#51535)
Fixes: #51534

* set valid_until equal to current time + spot_wait_timeout
* add setting ValidUntil to  value
* add changelog fragment
* fix shebang issue
2019-02-07 21:38:19 +05:30
plumbeo
4d93c440b9 mysql_user: Match both single quotes and backticks when checking curr… (#40092)
* mysql_user: Match quotes, double quotes and backticks when checking current privileges

* Add changelog fragment for PR #40092
2019-02-06 14:20:43 +00:00
Felix Fontein
c9b08db979 acme_challenge_cert_helper: fix bad module.fail_json() call (#51795)
* Fix bad module.fail_json() call.

* Add changelog.
2019-02-06 15:45:35 +10:00
Jordan Borean
146a89b612
psrp - do not display bootstrap wrapper for eachach task (#51779) 2019-02-06 12:05:15 +10:00
Martin Krizek
33b07f322c
yum: disableexcludes is supported on centos6 (#51698)
* yum: disableexcludes is supported on centos6

* Add changelog
2019-02-05 18:18:56 +01:00
Hannes Ljungberg
4a5d38b55a docker_swarm_service: Enable tests (#51170)
* Enable tests

* Comment fixes

* Try lowering timeouts

* Comment fix

* Comment fix

* Comment fix

* Add a pause to let service update

* Fix comment

* Disable dns_search tests

* Disable dns_servers test

* Fix comment

* Fix comment

* Fix comment

* Fix comment

* Fix comment

* Fix comment

* Fix comment

* Revert "Disable dns_servers test"

This reverts commit 763e9da716b78f4986f313b3ba1ab98faacb742e.

* Revert "Disable dns_search tests"

This reverts commit 2859e4e3a5ebdca078de84d821bb53bbdf967dfd.

* Revert "Add a pause to let service update"

This reverts commit e990dfae1a62e9a42b07960819818bc75fd04427.

* Revert "Try lowering timeouts"

This reverts commit 1617772de81ecef0e560b38c7564646ec3874c3c.

* Ensure that services are running while testing

* Retry tasks on update out of sequence error

* Remove unnecessary check for APIError.explanation

Co-Authored-By: hannseman <hannes@5monkeys.se>

* Ignore errors when tearing down test suite

* Retry with a loop instead of tail recursion

* Initialize self.diff_trace in run

* Add change log fragment

* Actually raise error

* Add unit test for retrying

* Lint

* Change to bugfix

* Remove whitespace

* Mock docker dependency

* Use download.fedoraproject.org

* Revert "Use download.fedoraproject.org"

This reverts commit 5931791f7c.
2019-02-05 08:25:29 +00:00
Pilou
7a3582d651 uri: check unexpected failure doesn't occur when file cannot be saved (#45824)
* uri: fix TypeError when file can't be saved

Fix the following exception (and others):

    Traceback (most recent call last):
      File "/home/lilou/debug_dir/__main__.py", line 604, in <module>
        main()
      File "/home/lilou/debug_dir/__main__.py", line 554, in main
        write_file(module, url, dest, content, resp)
      File "/home/lilou/debug_dir/__main__.py", line 320, in write_file
        module.fail_json(msg="Destination dir '%s' not writable" % os.path.dirname(dest), **resp)
    TypeError: fail_json() got multiple values for keyword argument 'msg'

I would rather remove **resp from returned values but this module is
flagged as stableinterface.

* Static imports are more straight forward and preferred unless dynamic inclusion is required.
2019-02-04 10:29:05 -05:00
Felix Fontein
89a1c68f98 docker_volume: improve force option (deprecate, add new option) (#51145)
* docker_volume: Deprecating force option, adding recreate option.

* Add changelog.

* Remove mis-placed force: yes for docker_volume.
2019-02-03 15:09:24 -05:00
Abhijeet Kasurde
18ed84b877 hashi_vault: add support for userpass authentication (#51538)
Added support for username and password authentication in hashi_vault
lookup plugin.

Fixes: #38878

Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
2019-02-02 12:32:53 +01:00
Andrea Tartaglia
b8790abcbe Added description to single net interface (#51602)
* Added description to single net interface

* ec2_instance single iface description changelog
2019-02-01 13:19:33 +00:00
chronidev
240d1a6afb Add coherency between check and normal mode for copy plugin action see issue #24633 (#51582)
* Add coherency between check and normal mode see issue #24633

* Add changelog fragment for the PR

* Make change following PR comment

* Remove trailing whitespace
2019-02-01 13:47:23 +10:00
Simon Dodsley
c65909d6db Add network fact to obtain FC WWN initiator ports (#37043) 2019-01-31 21:59:38 +00:00
Jordan Borean
f27078df52
win_power_plan: fix for Windows 10 and Server 2008 compatibility (#51471) 2019-02-01 06:32:12 +10:00
Simon Dodsley
8707f1793e Add default fact for NVMe support (#50164) 2019-01-31 16:05:45 +00:00
Jordan Borean
6a2aac487d
win_stat - add follow option and fix broken tests (#51522)
* win_stat - add follow option and fix broken tests

* fix docs issues
2019-01-31 15:56:06 +10:00
Fabian von Feilitzsch
0be66113d4 [k8s] Always check envvars when auth parameter is not provided (#51495)
* Always check envvars when auth parameter is not provided

This will make it so that all code using the get_api_client
method will make use of the environment variables, instead of
silently ignoring them if default values haven't been set. This
affects at least the k8s lookup plugin.

* Add changelog
2019-01-30 16:52:12 -05:00
Brian Coca
abb964a5a0
move extravars and option vars loading into VM (#51070)
* move extravars and option vars loading into VM

  also safedir setting, all these are intrinsic to VM
  avoid uneeded and inefectual shallow copy
  remove setters/getters as VM now does most of the work in init
  updated and added tests

* feedback + fixes

* keep extra_vars property for vars_prompt

* pass values not objects
2019-01-30 16:25:36 -05:00
Brian Coca
4ac0c23db6
added unsafe toggle to vars_prompt (#49219)
* added unsafe toggle to vars_prompt

	fixes #47534
2019-01-30 15:01:13 -05:00
Brian Coca
4a0fceaa3b remove bare var handling in conditionals (#51030)
* remove bare var handling in conditionals

  this makes top level and multilevel vars (dicts keys) behave the same
  it will require adding |bool for 'string comparissons' in indirect templates

  - added new tests to ensure uniform handling
  - switched to 'is' testing for status
  - changed warning to 'conditional' as 'when:' is not only place it gets triggered

* updated to include toggle and deprecation

* fix deprecated

* updated tests to handle toggle

* fixed typo and added note about the future
2019-01-30 15:00:24 -05:00
Brian Coca
50b40c47df aws_ec2 Implement the missing 'region discovery' (#51333)
* aws_ec2 Implement the missing 'region discovery'

  fixes #45288

  tries to use api as documented (which seems to fail in latest boto3 versions)
  and fallback to boto3 'hardcoded' list of regions

* fixes and cleanup, add error for worst case scenario

* fix tests, remove more unused code

* add load_name

* acually load the plugin

* set plugin as required

* reverted test changes, removed options tests

* fixes as per feedback and cleanup
2019-01-29 14:59:38 -06:00
Brian Coca
3ba3af5058
toggle for stripping empty shell/command output (#51342)
* toggle for stripping empty shell/command output

  fixes #45367

* Update lib/ansible/modules/commands/command.py

Co-Authored-By: bcoca <bcoca@users.noreply.github.com>
2019-01-29 15:55:38 -05:00
Will Thames
23b5599244 Add k8s module_defaults group and document (#51093)
It makes sense to use module_defaults with k8s modules, and thus
have a k8s module_defaults group.
2019-01-29 14:23:27 -06:00
Adam Miller
61ed229732 dnf load substitutions from installroot (#51206)
Fixes #51059

Signed-off-by: Adam Miller <admiller@redhat.com>
2019-01-29 15:10:53 -05:00
Dag Wieers
d8a0e1a9b7
aci_aaa_user: Fix changing user description (#51408)
This fixes a reported problem with the aci_aaa_user module.
2019-01-29 03:16:58 +01:00
Matt Martz
134b77961b
Add inject_ovf_env functionality for vmware_deploy_ovf (#51074)
* Add functionality to set hidden properties. Fixes #50299

* Add inject_ovf_env functionality

* Add xml declaration

* Revert "Add functionality to set hidden properties. Fixes #50299"

This reverts commit 4b41bb7520.

* Add changelog fragment

* Minor changes

Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
2019-01-28 09:55:21 -06:00
Hannes Ljungberg
72a44e144a docker_swarm_service: Compare image by digest (#51134)
* Compare image by digest

* Add changelog fragment

* Fix version check

* Remove unused import

* Add note about image resolving

* Don’t overwrite image

* Fix documentation error

* Add resolve_image option

* Add version_added

* Remove whitespace

* Remove unused attribute

* Remove unused attribute
2019-01-27 11:48:16 -05:00
Hannes Ljungberg
b426daa064 docker_swarm_service: Remove root as default user (#51110)
* Remove root as default user

* Add changelog fragment

* Add deprecation documentation

* Tweak user default docs for docker_swarm_service

Co-Authored-By: hannseman <hannes@5monkeys.se>

* Tweak user default deprecation docs

Co-Authored-By: hannseman <hannes@5monkeys.se>
2019-01-27 16:26:41 +00:00
Dusan Matejka
2133f0821a zabbix_template: Fixed interactions between options and data within JSON object (#51222) 2019-01-26 13:15:32 +01:00
Brian Coca
be776daefe
add static facility and apply to register (#49737)
* add static facility and apply to register

* added warning

* added test for templated register

* test register 'static' status

* rely on subshell to deal with quote context

* use corrects pb for test

* bring constants back cause new code in devel
2019-01-24 11:51:52 -05:00
Ganesh Nalawade
70bf9b9919
Add backup filename and dir path option for config network modules (#50801)
* Add configurable backup path option for network config modules

Fixes #50283
Fixes #32724

*  Add back_options in network config module argspec
*  Handle backup path options in network action plugin

* Fix review comments

* Add integration tests

* Update changelog
2019-01-24 09:36:16 +05:30
Martin Krizek
11fb0a5d6a
facts: detect IP addresses on busybox properly (#51131)
* facts: detect IP addresses on busybox properly

Fixes #50871

* Check rc before parsing data

* Ooops
2019-01-23 22:24:29 +01:00
Matt Martz
8c08d03989
Fieldattribute inheritance with defaults (#50891)
* Add tests for check_mode at play and task level

These test inheritance of check_mode from the various levels (command
line, as a play attribute and as a task attribute) so they will be
useful for checking that the change to fieldattribute inheritance with
defaults works

* Add a sentinel object

The Sentinel object can be used in place of None when we need to mark an
entry as being special (usually used to mark something as not having
been set)

* Start of using a Sentinel object instead of None.

* Handle edge cases around use of Sentinel

* _get_parent_attribute needs to deal in Sentinel not None

* No need to special case any_errors_fatal in task.py any longer

* Handle more edge cases around Sentinel

* Use Sentinel instead of None in TaskInclude

* Update code to clarify the vars we are copying are class attrs

* Add changelog fragment

* Use a default of Sentinel for delegate_to, this also allows 'delegate_to: ~' now to unset inherited delegate_to

* Explain Sentinel stripping in _extend_value

* Fix ModuleArgsParser tests to compare with Sentinel

* Fixes for tasks inside of roles inheriting from play

* Remove incorrect note. ci_complete

* Remove commented code
2019-01-23 11:40:07 -06:00
Brian Coca
ad57efff8f
[WIP] force install role and its deps (#49347) 2019-01-23 12:34:26 -05:00
Sam Doran
9d4c0dc111 Catch sshpass authentication errors and don't retry multiple times to prevent account lockout (#50776)
* Catch SSH authentication errors and don't retry multiple times to prevent account lock out

Signed-off-by: Sam Doran <sdoran@redhat.com>

* Subclass AnsibleAuthenticationFailure from AnsibleConnectionFailure

Use comparison rather than range() because it's much more efficient.

Signed-off-by: Sam Doran <sdoran@redhat.com>

* Add tests

Signed-off-by: Sam Doran <sdoran@redhat.com>

* Make paramiko_ssh connection plugin behave the same way

Signed-off-by: Sam Doran <sdoran@redhat.com>

* Add changelog

Signed-off-by: Sam Doran <sdoran@redhat.com>
2019-01-23 11:32:25 -05:00
Brian Coca
b6824669df
Handle complex quoting in extra args in pull cli (#50212)
* Handle complex quoting in extra args in pull cli

fixes #40729
2019-01-23 10:58:37 -05:00
Peter Oliver
9edeb19354 Populate product_name and system_vendor facts on Solaris (#44114)
* Populate product_name and system_vendor facts on Solaris

* Add QEMU as Solaris "hardware" vendor.

* Lint fix.
2019-01-23 13:51:23 +01:00
Felix Fontein
d2c4f57f16 docker_service: rename to docker_compose. (#51035)
* Rename docker_service -> docker_compose.

* Added changelog.

* Update scenario guide.

* Clean up module.
2019-01-23 12:21:57 +00:00
Matt Davis
2cb9ec9f0e fix include_vars non-ASCII error handling (#51198) 2019-01-22 19:35:34 -05:00
Jordan Borean
419727a6da
file - allow touch on files not owned by user (#50964)
* file - allow touch on files not owned by user

* use Sentinal value and preserved existing args

* Do no instantiate the Sentinel object
2019-01-23 10:14:59 +10:00
AlanCoding
f018b9d07d Fix missing tracebacks in ansible-inventory
(cherry picked from commit b62693299b)
2019-01-22 17:33:20 -05:00
Jonathan
20936bbc3d module mongodb_user fix roles default value (#46443) (#46526)
* module mongodb_user fix roles default value (#46443)

* mongodb_user remove ignoring test E324

* mongodb_user add changelog (#464443)

* mongodb_user change doc to set parameter roles as None (#464443)

* mongodb_user fix lint in changelog fragment (#464443)

* mongodb_user : remove E325 exception in test
2019-01-22 15:57:49 -05:00
MarkusTeufelberger
c1bc556b0a Relative time support for crypto modules (openssl_certificate) (#50570)
* Move relative time handling to module_utils and rewrite it

* Fix cases with no seconds defined

* fix a small typo along the way

* add relative time handling to the ownca provider in openssl_certificate

* add initial integration test for relative time ownca

* quote the documentation to produce valid yaml

* move timespec conversion and validation to the init function

* fix small edge case in conversion function

* add relative timestamp handling to the selfsigned provider

* add get_relative_time_option

* add relative timestamp handling to valid_in

* pep8 fix indentation

* add quotes in error message

* add changelog fragment

* Update changelogs/fragments/50570-relative_time_crypto.yaml

Co-Authored-By: MarkusTeufelberger <mteufelberger@mgit.at>
2019-01-22 20:41:02 +00:00
John Nelson
5540d66747 win_chocolatey: Fix hang on missing/required base env vars (#51154)
* win_chocolatey: Fix crash on missing/required base env vars

* Add changelog fragment
2019-01-22 10:13:02 +10:00
Martin Krizek
9ec9f18b13 dnf: allow to operate on file paths (#51080)
Fixes #50843
2019-01-21 17:20:27 -05:00
Jan Sušnik
70a39d358b Docker Network module labels support (#50883)
* Added support for labels for Docker Network

* Fixed missing comma in Docker Network module

* Specified minimal versions for dependencies and added changelog

* Fixes based on suggestions after code review

* Added integration tests
2019-01-21 16:19:34 -05:00
Hannes Ljungberg
e3f61f4480 docker_swarm_service: Add command option (#50984)
* Add command option

* Fix test task name

* Changelog fragment

* Fix indendation

* Add version_added

* Better command description

* Test passing command as list

* Handle invalid command types

* Cleaner command type checking

* Check that all items in command list are strings

* Better error about command list items

* Better type checking errors

* Add tests for command type checking

* Update command tests

* Fix messed up rebase
2019-01-21 16:01:22 -05:00
Hannes Ljungberg
393bf5e4b1 docker_swarm_service: Add placement_preferences option (#51082)
* Add placement_preferences option

* Add changelog fragment

* Python 2.6 compat

Python 2.6 compat

* Cleaner check

* Better description

* Don’t compare placement_preferences if None

* Add placement_preferences example
2019-01-21 14:55:26 -05:00
Hannes Ljungberg
7ceb2ac95a docker_swarm_service: Fix publish idempotency when mode is None (#50882)
* Fix publish idempotency when mode is None

* Add changelog fragment

* Python 2.6 compat

* Use self.publish

* Check length of publish before comparing content

* Sort publish lists before zipping

* Enable publish tests

* python3 compat

* Don’t sort by mode as it is not safe

* Document publish suboptions and add them to args

* Add type to publish documentation

* Add choices to publish argument_spec suboptions

* Make tcp the default protocol

* Make documentation reflect protocol default

* Simplify setting mode

* Remove redundant string quoting

* Test order of publish

* Add comment about publish change detection
2019-01-21 14:02:08 -05:00
Felix Fontein
345011e024 openssl_csr cryptography backend, try II (#50894)
* Revert "Revert "openssl_csr: Allow to use cryptography as backend (#50324)""

This reverts commit bbd2e31e9f.

* Remove more complicated selection copy'n'pasted from openssl_privatekey.

* Add tests for backend selection.

* Add openssl_csr test for arbitrary string commonName.

* Allow to disable commonName -> SAN copying (fixes #36690).
2019-01-21 17:19:05 +00:00
Ganesh Nalawade
1b6228fa10
Increase persistent command_timeout default value (#51056)
* Increase persistent command_timeout default value

*  Increase command_timeout default value from 10 to 30 sec
   to reduce frequent timeout issue for network connection
   types (netconf/network_cli/httpapi/napalm)

* Fix review comments
2019-01-21 10:50:52 +05:30
Brian Coca
30da7a363c
allows loop pause for subseconds (#50461)
* allows loop pause for subseconds
* skip test on os x and bsd since date commands lacks nano

fixes #49951
2019-01-18 22:41:29 -05:00
Jeffrey Noehren
2eaf0956b5 Spotinst - adding support for instance health check validation (#49211)
[src] - adding changlog fragment
2019-01-18 20:30:03 +00:00
Alan Rominger
baf59ccaac Put in documented default for gcp_compute filters (#50025) 2019-01-18 11:39:24 +00:00
Jordan Borean
9fa46e7f94 reboot - Fix connection timeout reset (#51000)
* only reset if we could retrieve the conn timeout
2019-01-17 10:45:41 -05:00
Martin Krizek
3b42b1796c
facts: set virtualization_role for KVM hosts (#50770)
* facts: set virtualization_role for KVM hosts

Fixes #49734

* Add changelog
2019-01-17 09:47:16 +01:00
Yunge Zhu
0f846f39ca fix new inventory azure_rm.py (#50006)
* fix new inventory

* fix lint

* resolve comments

* resolve comments

* add defensive code

* fix response not match handler

* remove useless import

* fix lint

* add changelog
2019-01-16 14:16:18 -08:00
Brian Coca
eca7c3c8c7 Prevent duplicate role insertion into roles: (#50552)
* Corner case in which import_role would add another instance of a role with the same signature into roles: when it already existed there.

  roles:
	- name: a
  tasks:
       - import_role: name=a

  would execute role 'a' 3 times instead of the intended 2 (x2 in roles: phase +1 in tasks:)

* added tests
2019-01-16 13:39:03 -05:00
Brian Coca
a7e81ba500
ensure we have required systemd env var (#50607)
* ensure we have required systemd env var
* add clarification about systemd and user scope

  fixes #50272
2019-01-16 12:36:41 -05:00
Ricardo Carrillo Cruz
1beb6f433b
Add object_type param to checkpoint_object_facts (#50982)
* Add object_type param to checkpoint_object_facts

* Add changelog fragment

* Fix sanity

* Fix sanity

* Pass type param to payload

Otherwise it does not do what is expected to do

* Add ip-only default to docstring
2019-01-16 17:15:50 +01:00
Brian Coca
119b65f919
Clarify clear facts (#50667)
* Revert "avoid x2 setting of set_fact when 'cacheable' (#50564)"

This reverts commit 207848f354.

* clarify clear_facts with set_fact cacheable

 revert previous 'fix' as it will break playbooks by changing precedence
 opted to leave current behaviour but document it on both plugins to mitigate confusion

 fixes #50556

 also fix grammer, add comment, remove unused e
2019-01-15 15:20:33 -05:00
Fabian von Feilitzsch
09bfe42a5c Bubble up import exception content for k8s module (#50657)
* Bubble up import exception content for k8s module

Signed-off-by: Fabian von Feilitzsch <fabian@fabianism.us>

* Track down other places import exception is reported

* Add changelog fragment
2019-01-15 10:44:59 +10:00
Strahinja Kustudic
eb8294e6d9 Fix create home dir fallback (#49262)
When a user home dir is not created with `useradd`, the home dir will now
be created with umask from /etc/login.defs. Also fixed a bug in which
after a local user is deleted, and the same user exists in the central
user management system, the module would create that user's home.
2019-01-14 16:01:26 -05:00
Jacob Olsen
37960ccc87 check for chroot in systemd module (#43904)
* check for result['status'] in systemd module

* instead of checking for result['state'], actually check for chroot and warn

* allow systemctl status to work if in a chroot, update warn text

* simply change warning message
2019-01-14 15:45:05 -05:00
Manuel Molina Cuberos
3b5ac77a16 Preventing '/dev/tty not found' problems (#49950)
* Preventing '/dev/tty not found' problems when ' apt_repository` calls GPG in order to import keys.
2019-01-14 15:38:54 -05:00
Felix Fontein
bbd2e31e9f Revert "openssl_csr: Allow to use cryptography as backend (#50324)"
This reverts commit 409f8a15bd.
2019-01-14 09:10:38 -08:00
Felix Fontein
8dfdd9abf3 Move changelog fragment to correct place. (#50869) 2019-01-14 10:10:19 -05:00
Felix Fontein
409f8a15bd openssl_csr: Allow to use cryptography as backend (#50324)
* Allow to use cryptography as backend for openssl_csr.

* Use different curve.

* Adding changelog.

Includes changelog fragment for #49416, which didn't include one.
2019-01-14 13:33:51 +00:00
Hannes Ljungberg
644057e9ec docker_swarm_service: Documentation fixes (#50861)
* Describe labels and container_labels correctly

* Clarify reserve_memory and limit_memory docs

* Remove default from container_labels doc

* Remove trailing whitespace

* Document min api version for configs and secrets

* Add changelog fragment

* Specify type on labels and container_labels

* Consolidate required API version descriptions

* Update reserve and limit memory docs

* Use correct power-of-two units

* Remove description about limit_memory minimum 4mb
2019-01-14 13:32:03 +00:00
Rich Wareham
fd32760d7a docker_swarm_service: use exact name match when finding services (#50665)
* docker_swarm_service: use exact name match when finding services

The Docker API's filtering support allows filtering for substring
matches which means that when we filter the list of running services we
may accidentally match a service called "foobar" when looking for a
service named "foo".

Fix this by filtering the list of services returned from the Docker API
so that name matches are exact. It is still worth passing the filter
parameter to the Docker API because it reduces the number of results
passed back which may be important for remote Docker connections.

Closes 50654.

* add changelog fragment for #50654
2019-01-14 12:00:34 +01:00
Hannes Ljungberg
cde292cc43 docker_swarm_service: Don’t add difference when update_order is None (#50655)
* Don’t add difference when update_order is None

* Add changelog fragment
2019-01-14 11:58:05 +01:00
Felix Fontein
0e7a9a2771 docker_volume: revert #47390 (#50663)
* Revert "Fix option change detection / force support for docker_volume. (#47390)"

This reverts commit 8ef994fbc5.

* Update changelog.

* Adjusting tests.
2019-01-11 14:41:37 -06:00
Alan Rominger
be5b7889f9 Do not load user kube config if path specified (#49952) 2019-01-11 17:26:53 +00:00
Abhijeet Kasurde
af914695e6
VMware: Fix vmware_vm_inventory (#50592)
* Added documentation around using vmware dynamic inventory plugin
* Fixed bug for populating host_ip in hostvars for given inventory host
* VMware: Add properties in vmware_vm_inventory

Fixes: #50249

Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
2019-01-11 21:33:14 +05:30
Dhanuka
94a1d86d70 redfish_utils: fix reference to local variable 'systems_service' (#50298)
* fixes issue 50296

* fixes the indentation of the return statement

* Adds a conditional test into `_find_systems_resource()` to check the existence
of the Members of System resource

* updates the error message

* harden the conditional test

* Add a changelog
2019-01-11 14:16:20 +00:00
Brian Coca
91d8383898 added missing docs for option in acl module (#50775)
* added missing docs for option in acl module
* remove acl from ignore
2019-01-11 09:49:43 +01:00
Matt Martz
8a2d39bcb2
Guard creating HTTPSClientAuthHandler behind HTTPS checks (#50523)
* Guard creating HTTPSClientAuthHandler behind HTTPS checks. Fixes #50339

* linting fixup
2019-01-10 09:41:13 -06:00
Abhijeet Kasurde
17bb4f4932 default: callback plugin allow unreachable task to stderr (#50533)
Provide toggle flag to allow display of unreachable task to stderr
using default callback plugin.

Fixes: #48069

Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
2019-01-09 11:43:59 -05:00
Renato Orgito
6f9bca9de3 Add auth_timeout parameter when supported by paramiko (#50448)
* Add auth_timeout parameter when supported

Paramiko 2.2 introduces the auth_timeout parameter. This will set the
parameter to the same value of the timeout parameter to prevent
"Authentication timeout" errors.

* Conditionally add auth_timeout to ssh.connect

Renamed sock_kwarg to ssh_connect_kwargs and conditionally added the
auth_timeout parameter based on the installed paramiko version.

* Add changelog fragment
2019-01-09 01:25:17 +01:00
trogdor_the_burninator
1dac10e5c3 Add AIX support to reboot module (#50353)
* Add ability for reboot module to work for AIX

* changelog for AIX reboot support
2019-01-08 18:12:30 -05:00
Brian Coca
207848f354 avoid x2 setting of set_fact when 'cacheable' (#50564)
* avoid x2 setting of set_fact when 'cacheable'

  fixes #50556

* ammend docs to new behaviour

* added period
2019-01-08 10:12:49 -05:00
vpiserchia
774a667591 Add Devuan Support for ascii release - resolve 49615 (#49616)
* Add Devuan Support for ascii release - resolve 49615

* Devuan Ascii does not have the VERSION_ID in the /etc/os-release file, we need to set NA
2019-01-07 17:08:01 -05:00
Toshio Kuratomi
27f9c3fba0 Clarify the change made to reverse_inventory 2019-01-07 10:17:06 -08:00
Martin Krizek
6d604f9b01 Allow for vaulted templates in template lookup (#49819)
Fixes #34209
2019-01-07 10:06:01 -05:00
Martin Krizek
82c95e07b5
Fix searchpath in the template lookup (#50488) 2019-01-07 11:33:39 +01:00
Matt Martz
9abeecb6d4
Add new AnsibleTemplateError to more easily catch templating issues (#50563)
* Add new AnsibleTemplateError to more easily catch templating issues. Fixes #50154

* Add changelog fragment
2019-01-04 14:33:05 -06:00
Toshio Kuratomi
40e7c7a210
Add a porting guide entry for ansible_distribution facts (#50251)
* Add a porting guide entry for ansible_distribution facts

Switching away from platform.distro() will cause changes sometimes due
to the new code using new sources of information that may be out of sync
with the old ones.  Just have to make people aware of that and also what
we are doing to mitigate it when appropriate.

* wordsmithed, added links for new distro backend
2019-01-04 10:03:56 -08:00
Jordan Borean
b967f4dcc1 dnf/yum - added install_weak_deps option (#50525)
* dnf/yum - added install_weak_deps option

* skip creating weak dep packages if rpm doesn't support it

* fix rpm check for older hosts
2019-01-04 11:37:59 -05:00
Toshio Kuratomi
afdbb0d9d5 Save the command line arguments into a global context
* Once cli args are parsed, they're constant.  So, save the parsed args
  into the global context for everyone else to use them from now on.
* Port cli scripts to use the CLIARGS in the context
* Refactor call to parse cli args into the run() method
* Fix unittests for changes to the internals of CLI arg parsing
* Port callback plugins to use context.CLIARGS
  * Got rid of the private self._options attribute
  * Use context.CLIARGS in the individual callback plugins instead.
  * Also output positional arguments in default and unixy plugins
  * Code has been simplified since we're now dealing with a dict rather
    than Optparse.Value
2019-01-03 18:12:23 -08:00
Matt Martz
3b49bbcfde Give IncludedFile more context via ansible_search_path (#50045)
* Give IncludedFile more context via ansible_search_path to template lookups. Fixes #49969

* Update units
2019-01-03 16:13:02 -05:00
Jordan Borean
63e454a4b2 dnf - fix conf_file loading (#50515) 2019-01-03 15:25:58 -05:00
Abhijeet Kasurde
a45063defe Update changed_when and failed_when examples (#50411)
Added examples in playbooks_error_handling doc for handlining
multiple conditions in changed_when and failed_when

Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
2019-01-03 09:50:59 -05:00
Felix Fontein
5c5cd2dc4d openssl_*: prevent error when path includes no path (#50322)
* Prevent error when path includes no path.

* Add changelog.
2019-01-03 17:04:46 +05:30
Felix Fontein
a5bf71ac6a openssl_csr: idempotency doesn't work correctly for keyUsage (#50361)
* Fix key usage idempotency bug.

* Extend tests.

* Add changelog.
2019-01-03 17:04:24 +05:30
Felix Fontein
6b33c588d0 docker_swarm_service: Fix typo for option type (#50483)
* Fix typo for option type in docker_swarm_service.

* Add changelog.
2019-01-03 17:03:59 +05:30
Adam Miller
b81a74f551 add changelog for #50242 (#50480)
Signed-off-by: Adam Miller <admiller@redhat.com>
2019-01-02 18:16:45 -05:00
Adam Miller
ca084889c7 fix order of dnf api operations so transactions don't fail (#50038)
* fix order of dnf api operations so transactions don't fail

Previously dnf.base.fill_sack() was called before
dnf.base.update_cache() which apparently breaks dnf transaction
logic as per https://bugzilla.redhat.com/show_bug.cgi?id=1658694

Fixes #49060

Signed-off-by: Adam Miller <admiller@redhat.com>

* add changelog and test case

Signed-off-by: Adam Miller <admiller@redhat.com>
2019-01-02 17:50:06 -05:00
Felix Fontein
26e3240315 docker_secret, docker_config: allow to base64-decode data (#49688)
* Adjust docker_config and docker_secret to be more similar.

* Add data_is_b64 parameter to docker_secret and docker_config.

* Add changelog.
2019-01-01 16:06:45 +00:00
René Moser
e761ea3f9d
vultr_server: fix multiple ssh keys not handled (#50337)
* vultr_server: fix multiple ssh keys not handled

* add changelog fragment
2019-01-01 10:11:10 +01:00
Simon Dodsley
507f89e693 Pure Storage facts fix (#50349)
* Add module for Pure Storage FlashBlade to manage directory services

* Fix facts not correctly passing into ansible_facts dict
2018-12-31 09:22:13 +00:00
Adam Miller
33156712a9 Provide both service state and status when possible in service_facts (#49618)
* Combine systemd units/unit-files output for service_facts

Fixes #47118

Previously we were only taking the output of `systemd units` which
would leave out information about the service units that were
disabled, static, masked, etc. Now we're aggregating the results so
that anything not active/inactive/dead at least is pulled as fact
data with it's state provided.

Signed-off-by: Adam Miller <admiller@redhat.com>

* provide state and status information about services

Fixes #45730

Signed-off-by: Adam Miller <admiller@redhat.com>
2018-12-26 13:24:03 +00:00
Abhijeet Kasurde
fc6c500b5b
postgresql_user: set type of conn_limit (#50178)
conn_limit type is set to 'int'. This will allow module to compare conn_limit with record value without type casting.

Fixes: #38118

Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
2018-12-22 20:28:56 +05:30
Nathaniel Case
f05979932b
Allow AnsibleVaultEncryptedUnicode to pass through exec_jsonrpc (#48306)
* Allow AnsibleVaultEncryptedUnicode to pass through exec_jsonrpc

* Add changelog
2018-12-21 11:15:18 -05:00
Abhijeet Kasurde
14eba662c8 Correct match test documentation (#50229)
Match test matches zero or more characters at the begining of the string.

Fixes: #32366

Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
2018-12-21 09:38:31 -05:00
Dag Wieers
0fe7d569c9 win_firewall_rule: Remove invalid 'bypass' action (#50207)
* win_firewall_rule: Remove invalid 'bypass' action

This fixes #50143

* Add changelog fragment
2018-12-21 12:05:28 +10:00
Dag Wieers
50ed152ab9 win_updates: Correctly report changes on success (#50188)
* win_updates: Correctly report changes on success

* Add changelog fragment
2018-12-21 11:44:49 +10:00
Jacob Floyd
069e0b8d57 Make modprobe module check for builtins as well (#37150)
Without this modprobe always reports changed when modprobe-ing a builtin module.

With this, if a kernel module is a builtin, the modprobe module will:
- succeed (without incorrectly reporting changed) if ``state`` is ``present``;
- fail if ``state`` is ``absent``

The failure will have whatever error message modprobe returns when
attempting to remove a builtin module. For example:
``modprobe: ERROR: Module nfs is builtin.``
2018-12-20 15:30:29 -06:00
Gavin Williams
01a1ce16ce Jenkins_plugin: Handle 'latest' version when installing plugin for first time (#49723)
* Handle 'latest' version when installing module for first time

Otherwise, a fresh install of a plugin with 'version: latest' gets installed without its dependencies, rendering the plugin effectively useless.

* Add changelog
2018-12-20 15:51:02 +00:00
Julien Girardin
3e303bea4c List correctly current PV in "lvg" module: fix lvg reduce (#49731)
* Refactor integration test for lvg module to introduce grow/reduce test

* List correctly current PV in lvg module: fix lvg reduce

Previous behaviour was to only take into account PV passed in 'pvs'
argument. This lead to reduce not working as expecting:

* with state=present and list of wanted pvs, lvg found only the pvs to
  add or already present and ignored the pv to remove (obviously absent
  from the list of given PV)

* with state=absent and a pv to remove, lvg found that the remaining pvs
  list is empty (ignoring possible other PV in the vg) and decides to
  remove the vg entirely (as supposely no PV are left anymore to store
  lvm metadata)

* Add changelog fragment
2018-12-20 15:43:18 +00:00
Abhijeet Kasurde
b132593861 Move doc fragments to changelogs/fragments dir (#50179)
Move changelog fragment to changelogs/fragments dir
2018-12-20 09:21:55 -05:00
Miguel Duarte Barroso
4951e5a5b7 os_security_group_rule proper module exit (#50076)
When the security group the rule belongs to does not exist and
the state is absent, the module is not properly exited, leading
to a playbook execution failure.

Fixes issue #50057
2018-12-20 11:49:52 +00:00
Michael Rose
bcae7f24cb influxdb_user: Fixed unhandled exception on invalid login credentials (#50134) 2018-12-20 11:47:39 +00:00
Andrea Tartaglia
65c7424a35 Added organization in the scm_credential get (#49884)
* Added organization in the scm_credential get

* Fallback looking for cred in project org

* Tests project with multi org credential

* Fixed CI issue

* Added changelog fragment
2018-12-19 12:01:12 +00:00
Jordan Borean
65ce1b727e
win_copy - fix remote dir copy when it contains an empty dir (#50126) 2018-12-19 14:55:09 +10:00
Martin Krizek
545edc9114 facts: detect FreeBSD KVM guests (#50030)
Fixes: #49158
2018-12-19 06:57:53 +10:00
Martin Krizek
29c3bb48e9 facts: correctly detect multiple ipv6 addresses per device (#50020)
Fixes #49473
2018-12-19 06:49:28 +10:00
Jordan Borean
efda3eaf1c
win_lineinfile - fix malformed returned json (#50066) 2018-12-19 05:39:25 +10:00
Brian Coca
88c87a3583
added handlers_from (#49220)
* added handlers_from

fixes #46769
2018-12-18 11:28:24 -05:00
Jérémy Lecour
2fb9b46752 Lineinfile must not insert lines multiples times with insertbefore/insertafter (#49409)
* Change test suite to fit expected behaviour

This reverts some changes from ansible/ansible@723daf3
If a line is found in the file, exactly or via regexp matching, it must 
not be added again.
insertafter/insertbefore options are used only when a line is to be 
inserted, to specify where it must be added.

* Implement the change in behaviour mentioned in the previous commit

* Fix comment to reflect what the code does

* Set the correct return message.

In these cases, the lines are added, not replaced.

* Add a changelog
2018-12-17 16:42:24 -05:00
Matt Martz
7eb1ab45a7
Allow tags to be templated from a variable (#49833)
* Allow tags to be templated from a variable. Fixes #49825

* Restore _load_tags to ensure we do csv tag splitting

* Add tests for csv tags and templated tags

* evaluate_tags doesn't need to accept strings, because _load_tags handles this
2018-12-17 15:40:26 -06:00
Matt Martz
a0d71e7735
Fix reverse_inventory order to work on python3 (#49895) 2018-12-17 15:39:29 -06:00
Aleksander Kovtunenko
ba562043e1 changed if logic Type to boolean (#49628)
* changed Type to boolean

* fix after review

* created fragment
2018-12-17 16:21:36 -05:00