Commit graph

3978 commits

Author SHA1 Message Date
Nick Busey
0894ea1b1d
Adding nested variable example (#69518)
* Adding nested variable example to lib/ansible/plugins/lookup/vars.py
Co-authored-by: Matt Martz <matt@sivel.net>
2020-05-28 15:48:52 -05:00
Rick Elrod
8b6c02fc69
Make connection plugins use password from config (#69670)
Change:
Rather than connection plugins directly accessing play_context and pulling
the password from there, have them pull it from the config system, and
have TaskExecutor store it there for now.

Internally, it still routes through play_context for now, but this is
the first step away from that.

Test Plan:
- Local test with `ansible -c ssh`
- grep -R play_context.pass lib/ansible/plugins/connection/
- CI

Signed-off-by: Rick Elrod <rick@elrod.me>
2020-05-27 09:59:55 -05:00
Felix Fontein
cb8f645e0f
Allow to deprecate / remove plugins by version. (#69712) 2020-05-26 18:43:40 -07:00
Rick Elrod
304c3e57e8
[ssh] Add new sshpass_prompt option (#68874)
Change:
Allows the user to configure sshpass (1.06+) to look for a different
substring than the default "assword" that it comes with.

Test Plan:
Set a custom ssh password prompt on a VM with PAM and tried connecting to
it. Without `ansible_sshpass_prompt` set in inventory: experienced hang.
With `ansible_sshpass_prompt` in inventory: connected successfully.

Tried setting `ansible_sshpass_prompt` with an older `sshpass` in PATH
and got a loud error, as expected.

Tickets:
Fixes #34722, fixes #54743, refs #11565.

Signed-off-by: Rick Elrod <rick@elrod.me>
2020-05-26 19:58:31 -05:00
Brian Coca
c987c0c8a1
provides per host/plugin world readable temp opt (#69393)
fixes #46174
2020-05-26 15:29:37 -04:00
Matt Davis
f7dfa817ae
collection routing (#67684)
* `meta/` directory in collections
* runtime metadata for redirection/deprecation/removal of plugin loads
* a compatibility layer to keep existing content working on ansible-base + collections
* a Python import redirection layer to keep collections-hosted (and otherwise moved) content importable by things that don't know better
* supported Ansible version validation on collection loads
2020-05-26 09:42:06 -07:00
Brian Coca
de3f7c7739
fix delegated interpreter discovery (#69604)
* fix delegated interpeter
* allow returning fact if it is 'the right host'
* added note for future fix/efficiency
 as it stands we rerun discovery for the delegated host
unless its saving facts to itself
 * fixed test lacking delegate_to mock
2020-05-22 09:31:34 -04:00
James Cammarata
a4072ad0e9
Split regular and handler results into their own queues (#69498)
When mixed with the free strategy (or any custom strategy that does not behave in
a lock-step manner), the linear methodology of _wait_on_handler_results may cause
race conditions with regular task result processing if the strategy uses
_process_pending_results directly. This patch addresses that by splitting the queues
used for results and adding a flag to _process_pending_results to determine which
queue to check.

Fixes #69457
2020-05-21 15:55:08 -05:00
Brian Coca
9281148b62
correctly merge multiple facts results (#68987)
* correctly merge multiple facts results

  fixes #68532
2020-05-20 18:53:37 -04:00
Matt Martz
b748edea45
Add multipart/form-data functionality (#69376)
* Add multipart/form-data functionality

* Fix some linting issues

* Fix error message

* Allow filename to be provided with content

* Add integration test

* Update examples

* General improvements to multipart handling

* Use prepare_multipart for galaxy collection publish

* Properly account for py2 vs py3, ensuring no max header length

* Address test assumptions

* Add unit tests

* Add changelog

* Ensure to use CRLF instead of NL

* Ignore line-endings in fixture

* Consolidate code, add comment

* Bump fallaxy container version

* ci_complete
2020-05-20 15:44:01 -05:00
Toshio Kuratomi
9780d3db18 Remove "keywords" field in DOCUMENTATION.
This doesn't seem to be used by config although it came in with the
config PR.  It's not displayed in docs.  Removing it as this is the only
place where it's present.
2020-05-19 22:36:53 -07:00
Jeff Geerling
d63a71e3f8
typofix - globbing instead of globing. (#69515)
Fix typo introduced in PR #69087
2020-05-15 13:23:35 +05:30
Felix Fontein
9767d592a8
Add resource_from_fqcr utility function. (#68474) 2020-05-14 13:50:29 -04:00
Bob Weinand
f200487414
Fix filedescriptor out of range in select() when running commands (#65058)
* Fix filedescriptor out of range in select() when running commands

* Simplify the run_command() code

Now that we're using selectors in run_command(), we can simplify some of
the code.

* Use fileobj.read() instead of os.read()
* No longer use get_buffer_size() as we can just slurp all of the data
  instead.

Also use a simpler conditional check of whether the selector map is
empty

Co-authored-by: Toshio Kuratomi <a.badger@gmail.com>
2020-05-14 11:46:34 -04:00
Brian Coca
cedfe34619
added unvault lookup plugin (#69087)
* added unvault lookup plugin
2020-05-14 11:19:19 -04:00
Mark Goddard
aa36b02ede
Fix fileglob plugin with non-existent subdirectory (#69451)
Since Ansible 2.9.8, if the fileglob plugin is passed a path containing
a subdirectory of a non-existent directory, it will fail. For example:

lookup('fileglob', '/'): ok
lookup('fileglob', '/foo'): (non-existent): ok
lookup('fileglob', '/foo/bar'): (non-existent): FAIL

The exact error depends on Python 2 or 3, but here is the error on
Python 2:

    AttributeError: 'NoneType' object has no attribute 'endswith'

And on Python 3:

    TypeError: expected str, bytes or os.PathLike object, not NoneType

This change fixes the issue by skipping paths that are falsey before
passing them to os.path.join().

Fixes: #69450
2020-05-12 09:12:21 -04:00
Kenyon Ralph
f6860a7a89
generator inventory plugin: remove "strict" from example (#69178)
This "strict" option appears to be unused. It's probably a copy-paste error from the constructed plugin.
2020-05-05 15:09:31 -05:00
Matt Davis
47da0f7a4f
restore jsonfile cache plugin (#69337)
* restore jsonfile

* update botmeta for jsonfile restoration
2020-05-05 10:50:39 -07:00
flowerysong
d446a4f70d
yum: avoid running non-yum modules via the action (#69296)
If the system's detected package manager is not yum or dnf it should
refuse to run without an explicit backend, instead of running the
non-yum module.
2020-05-05 11:48:54 -05:00
Brian Coca
bbdf77a59f
preserve json parsing error (#58461)
* preserve json parsing error
* added test
2020-05-01 15:03:07 -04:00
David Shrewsbury
1142faa213
Do not pass file mode during recursive copy on symlink files. (#69011)
* Do not pass file mode during recursive copy on symlink files.

The 'file' module cannot deal with mode=preserve. Do not pass that
mode to the module when 'preserve' is used.

* Fix changelog fragment filename
2020-04-30 14:22:16 -05:00
Chris Holland
d42151e676
Removed redundant conditional in paramiko_ssh.py (#69164)
* Removed redundant conditional

* Added changelog fragment

* Removed trailing whitespace
2020-04-28 10:36:22 -04:00
Kenyon Ralph
91d02e1c1f
constructed inventory plugin: correct example (#69165)
Fixed 'intersect' filter name in constructed inventory plugin example.
2020-04-27 12:04:51 +05:30
Rick Elrod
cace616aab
Filter BLACKLIST_EXTS in PluginLoader (#69029)
Change:
Rather than hardcoding .pyo and .pyc, filter on all BLACKLIST_EXTS in
the non-legacy logic of PluginLoader (_find_fq_plugin). The two harcoded
extensions are part of BLACKLIST_EXTS already and this simply adds the
rest of the blacklisted extensions to the check.

In addition, check .endswith() instead of an exact match of the suffix,
like everywhere else that uses BLACKLIST_EXTS. This allows for
blacklisting, for example, emacs's backup files which can appear after
any extension, leading to things like `foo.py~`.

Test Plan:
Ran `ansible-playbook` against a collection where a `foo.py~` module was
getting executed instead of `foo.py` which also appeared in the same
directory. `foo.py~` is no longer executed.

Tickets:
Fixes #22268
Refs #27235

Signed-off-by: Rick Elrod <rick@elrod.me>
2020-04-22 17:20:12 -05:00
rwagnergit
977b58740b
update ActionBase._low_level_execute_command to honor executable (#68315)
* update ActionBase._low_level_execute_command to honor executable

* adding changelog fragment

* renaming changelog fragment to .yml

* noop change to bump shippable

* adding raw_executable integration test

* copying aliases from raw

* removing blank lines

* skipping aix and freebsd

* noop to bump shippable

* moving tests to raw/

* removing become_method: sudo ; it doesn't work on AIX

* removing trailing blank line

* forcing become_method: su to try to get AIX to work

Co-authored-by: Rob Wagner <rob.wagner@sas.com>
2020-04-22 11:56:35 -05:00
Robert de Bock
fd8b874273
Update docs, pointing to an existing chapter. (#69026)
The chapter that described more information about become to an unprivileged user has moved. This commit points to an existing chapter

Relates to #69021
2020-04-18 07:52:29 -05:00
Brian Coca
561725bace
corrected comment (#69006) 2020-04-17 16:07:26 -05:00
Brian Coca
d3cab602a5
Fix fileglob when using 'file*' vs 'stuff/file*' (#68945)
* Fix fileglob when using 'file*' vs 'stuff/file*'

 when not having dir in glob, files/ subdir was being ignored.

* tests for fileglob
2020-04-17 09:51:05 -04:00
Jordan Borean
de6b047fc3
Add variable for DEFAULT_NO_TARGET_SYSLOG (#68971)
* Add variable for DEFAULT_NO_TARGET_SYSLOG

* Added version_added to new var
2020-04-16 20:25:09 +10:00
Jordan Borean
702949e64c
windows - fix up env var quoting for unicode single quotes (#68968)
* windows - fix up env var quoting for unicode single quotes

* Add sanity ignore check for smart quotes
2020-04-16 20:24:23 +10:00
Jordan Borean
cce6153cd1
Remove unused functions (#68969) 2020-04-16 13:01:20 +10:00
Brian Coca
8077d8e401
avoid mkdir -p (#68921)
* also consolidated temp dir name generation, added pid for more 'uniqness'
* generalize error message
* added notes about remote expansion

CVE-2020-1733
fixes #67791
2020-04-13 17:16:29 -04:00
Matt Martz
d86d20a378
Fix label lookup in the default callback for includes (#68822)
* Replace included_file._args w/ included_file._vars

* Fix item value in output of include_tasks loop

Signed-off-by: Yadnyawalk Tale <ytale@redhat.com>

* Update tests for loop callback fix. Add changelog

Co-authored-by: Yadnyawalk Tale <ytale@redhat.com>

Fixes #65904
Fixes #66018
2020-04-09 13:27:58 -05:00
Jordan Borean
780067e6a1
url_windows - Add not around no redirection for auth headers (#68791) 2020-04-09 11:46:54 -04:00
Brian Coca
ba87c225cd
fixed fetch traversal from slurp (#68720)
* fixed fetch traversal from slurp

  * ignore slurp result for dest
  * fixed naming when source is relative
  * fixed bug in local connection plugin
  * added tests with fake slurp
  * moved existing role tests into runme.sh
  * normalized on action excepts
  * moved dest transform down to when needed
  * added is_subpath check
  * fixed bug in local connection

fixes #67793

CVE-2019-3828
2020-04-08 14:28:51 -04:00
Matt Martz
087be1da50
Allow tasks to notify a fqcn handler name (#68213)
* Allow tasks to notify a fqcn handler name

* Add tests. Fixes #68181

* Add changelog fragment

* Add test to ensure handlers are deduped properly with fqcn, role, and just handler names

* Add some docs about new special vars
2020-04-08 11:36:38 -05:00
Matt Martz
123c624b28
Always set the discovered interpreter on the delegated host (#64906)
* Always set the discovered interpreter on the delegated host. Fixes #63180

* Make code a little more generic

* Move code into a function

* Implement some changes based on reviews

* Add changelog fragment
2020-04-06 15:09:00 -05:00
Jordan Borean
e785bdaa5b
Un-migrate url_windows doc fragment (#68602)
* Un-migrate url_windows doc fragment

* Removed from routing file
2020-04-02 05:20:49 +10:00
Jordan Borean
6db66bcadd
Add relative module_util support for powershell (#68321)
* Add relative module_util support for powershell

* Added ansible-test classification support
2020-04-01 09:01:18 +10:00
Rick Elrod
835ad75a0a
add test coverage for core filters (#68518)
Also remove now-useless exception handling.
2020-03-27 17:18:27 -07:00
Sloane Hertel
5945415398
fix using inventory and cache plugins in a collection (#56469)
* Allow custom inventory plugins and cache plugins

If _load_name is not set correctly the cache plugin can't load the documentation (which is also the arg spec)

Fix the existing inventory plugin in the collections tests

Add integration tests for using a cache plugin in a collection

* Set the attribute on the instance instead of the class

Deprecate importing custom CacheModules directly - they should use the cache_loader
2020-03-26 12:05:46 -04:00
Rick Elrod
01638e0ea2
[mathstuff] Get coverage into the 90% range (#68395)
Signed-off-by: Rick Elrod <rick@elrod.me>
2020-03-25 15:33:37 -05:00
Jordan Borean
aaf575f0b2 Internally redirect win modules to collection name (#68317)
* Internally redirect win modules to collection name

* Added comment for how this should be fixed in a subsystem plugin

* add collection plugins for base tests
2020-03-23 11:14:21 -05:00
Matt Martz
26da443fd2 Address compat issue for collection loading on py26 (#68219)
* Address compat issue for collection loading on py26

* Move import_module shim to utils for compat across the codebase

* Enable collection tests on py2.6

* Update changelog fragment

* Simplify code using sys.moduls

* Move compat to module_utils/compat/importlib

* Add back errantly deleted newline

* Remove hack comment

Co-Authored-By: Matt Clay <matt@mystile.com>

Co-authored-by: Matt Clay <matt@mystile.com>
2020-03-23 11:14:21 -05:00
Matt Martz
930d89dd5e core promotions 2020-03-23 11:14:21 -05:00
Ansible Core Team
c788ee69d9 Migrated to wti.remote 2020-03-23 11:14:21 -05:00
Ansible Core Team
cc2feea51b Migrated to vyos.vyos 2020-03-23 11:14:21 -05:00
Ansible Core Team
d101834d28 Migrated to ibm.qradar 2020-03-23 11:14:21 -05:00
Ansible Core Team
ab914b9ab6 Migrated to azure.azcollection 2020-03-23 11:14:21 -05:00
Ansible Core Team
7449ec1546 Migrated to google.cloud 2020-03-23 11:14:21 -05:00
Ansible Core Team
b82d084e90 Migrated to skydive.skydive 2020-03-23 11:14:21 -05:00
Ansible Core Team
dd5a8dec21 Migrated to hetzner.hcloud 2020-03-23 11:14:21 -05:00
Ansible Core Team
36a545553e Migrated to dellemc_networking.os6 2020-03-23 11:14:21 -05:00
Ansible Core Team
bc40fe0b6f Migrated to dellemc_networking.os9 2020-03-23 11:14:21 -05:00
Ansible Core Team
0b633b3703 Migrated to dellemc_networking.os10 2020-03-23 11:14:21 -05:00
Ansible Core Team
d1f86d7151 Migrated to ovirt.ovirt 2020-03-23 11:14:21 -05:00
Ansible Core Team
02541a15b2 Migrated to awx.awx 2020-03-23 11:14:21 -05:00
Ansible Core Team
35063de590 Migrated to junipernetworks.junos 2020-03-23 11:14:21 -05:00
Ansible Core Team
0c8d6f0805 Migrated to splunk.enterprise_security 2020-03-23 11:14:21 -05:00
Ansible Core Team
8ee0187388 Migrated to openstack.cloud 2020-03-23 11:14:21 -05:00
Ansible Core Team
6ce86295c0 Migrated to f5networks.f5_modules 2020-03-23 11:14:21 -05:00
Ansible Core Team
675129ae19 Migrated to cisco.ucs 2020-03-23 11:14:21 -05:00
Ansible Core Team
3149db0869 Migrated to cisco.nxos 2020-03-23 11:14:21 -05:00
Ansible Core Team
ae8fb5e371 Migrated to cisco.mso 2020-03-23 11:14:21 -05:00
Ansible Core Team
8a3f3e41f8 Migrated to cisco.meraki 2020-03-23 11:14:21 -05:00
Ansible Core Team
5aa37733c3 Migrated to cisco.iosxr 2020-03-23 11:14:21 -05:00
Ansible Core Team
7e04b5ba8b Migrated to cisco.ios 2020-03-23 11:14:21 -05:00
Ansible Core Team
8a2e2e8af2 Migrated to cisco.intersight 2020-03-23 11:14:21 -05:00
Ansible Core Team
ab5a3b4305 Migrated to cisco.asa 2020-03-23 11:14:21 -05:00
Ansible Core Team
3f1cea89fb Migrated to cisco.aci 2020-03-23 11:14:21 -05:00
Ansible Core Team
14b0ab63ac Migrated to arista.eos 2020-03-23 11:14:21 -05:00
Ansible Core Team
6da1ec1d8c Migrated to check_point.mgmt 2020-03-23 11:14:21 -05:00
Ansible Core Team
f0cf2c159b Migrated to netapp.ontap 2020-03-23 11:14:21 -05:00
Ansible Core Team
bdd82adf61 Migrated to netbox.netbox 2020-03-23 11:14:21 -05:00
Ansible Core Team
0743e733bb Migrated to theforeman.foreman 2020-03-23 11:14:21 -05:00
Ansible Core Team
09d8d46983 Migrated to fortinet.fortios 2020-03-23 11:14:21 -05:00
Ansible Core Team
48d4e9370e Migrated to ansible.windows 2020-03-23 11:14:21 -05:00
Ansible Core Team
829eb0f1d1 Migrated to ansible.posix 2020-03-23 11:14:21 -05:00
Ansible Core Team
9a7a574ffc Migrated to ansible.netcommon 2020-03-23 11:14:21 -05:00
Ansible Core Team
6d910034a0 Migrated to ansible.amazon 2020-03-23 11:14:21 -05:00
Ansible Core Team
8f7e9f73ce Migrated to servicenow.servicenow 2020-03-23 11:14:21 -05:00
Ansible Core Team
bb3494356a Migrated to community.windows 2020-03-23 11:14:21 -05:00
Ansible Core Team
40218535ee Migrated to community.vmware 2020-03-23 11:14:21 -05:00
Ansible Core Team
f8c4936c10 Migrated to community.vmware_rest 2020-03-23 11:14:21 -05:00
Ansible Core Team
46b865c7d6 Migrated to community.mongo 2020-03-23 11:14:21 -05:00
Ansible Core Team
0ed8af9021 Migrated to community.crypto 2020-03-23 11:14:21 -05:00
Ansible Core Team
fb6bc5058a Migrated to community.kubernetes 2020-03-23 11:14:21 -05:00
Ansible Core Team
43f47d553e Migrated to community.grafana 2020-03-23 11:14:21 -05:00
Ansible Core Team
4e488d8435 Migrated to community.general 2020-03-23 11:14:21 -05:00
Ansible Core Team
58e8a91f4d Migrated to community.amazon 2020-03-23 11:14:21 -05:00
Ansible Core Team
32bf1b8115 Migrated to frr.frr 2020-03-23 11:14:21 -05:00
Ansible Core Team
38c652712c Migrated to containers.podman 2020-03-23 11:14:21 -05:00
Martin Nečas
4ef7bd4c79
ovirt: update botmeta deprecated (#67826)
* ovirt: update botmeta deprecated

* correct deprecate option

* remove duplication

* add removed_module

* add removed_module to external_provider

* add imports and metaclass

* update misc ovirt

* update sanity tests to have correct misc ovirt name

Signed-off-by: mnecas <necas.marty@gmail.com>

* remove unnecessary sanity ignore
2020-03-02 10:18:35 +00:00
Adharsh Srivats R
f3ddf1bc95
NX-OS ACL interfaces module (#67505)
* Rebase

* Completed integration tests

* Added unit tests

* Added warning detection

* Updated tests

* Completed tests

* Linting

Linting II

YAML Lint

Linting

* Updated review changes

* Updated examples, fixed reviews

* Added failure condition

* Resolved merge conflict
2020-03-02 09:52:32 +05:30
Abhijeet Kasurde
b3381704e3
Misc documentation fixes (#67863)
Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
2020-03-01 10:44:53 +01:00
Ruheena Ansari
e0eee3c37e
Run Powershell modules on windows container via docker connection (#67832)
* Run modules on windows container

This provides an ability to run Powershell modules on windows container via docker connection. Otherwise, Ansible tries to run python modules on windows containers and fails.

* Removing whitespace in the blank lines

* Adding a changelog fragment
2020-02-28 23:05:53 +01:00
Paul Belanger
357ae7ec0e
Remove unused import from frr cli plugin (#67790)
Signed-off-by: Paul Belanger <pabelanger@redhat.com>
2020-02-26 16:48:07 -05:00
James McClune
059a193dff
lib/ansible/plugins/inventory/ini.py: added spacing for error message (#67361)
Signed-off-by: James McClune <falcon78921@users.noreply.github.com>
2020-02-24 09:26:48 -05:00
Matt Clay
65646179f1 Fix become for network_cli in collections. 2020-02-20 15:13:39 -08:00
Nabil BENDAFI
1c15a485c2 Allow SSH synchronization between Docker containers 2020-02-20 17:44:40 -05:00
Paul Belanger
2de4e55650
Remove unused import for six in ipaddr filter (#67595)
This was caught in our ansible.netcommon collection testing.

Signed-off-by: Paul Belanger <pabelanger@redhat.com>
2020-02-20 10:58:47 -05:00
Christophe Drevet-Droguet
e867535a57
regex_replace multiline support (#65051)
* document multiline parameter for regex_replace
* add changelog fragment
* tests for regex_replace_multiline
2020-02-19 12:19:40 -05:00
Alex Stephen
650c3c5df3
doc fragment needs proper types (#67545) 2020-02-18 16:40:00 -05:00
Sloane Hertel
ed6a6aca25
Allow botocore configuration for aws modules (#55217)
* Allow botocore configuration to be configurable for boto3 modules

* Allow modification of the boto user agent

* play nicely with modules that might be modifying config

* changelog
2020-02-18 13:12:10 -05:00
Abhijeet Kasurde
70b9bdbce6
Fix links in Postgresql modules (#67511)
Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
2020-02-18 13:18:16 +05:30
Abhijeet Kasurde
7dcf32294b
Update URLs in documentation (#67376)
Partially fixes: #67357

Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
2020-02-18 09:00:30 +05:30
Lukas Kämmerling
62cc120dce
Add support for networks to hcloud inventory (#67453) 2020-02-17 13:39:37 +00:00
Daniel Sternig
11483921f2
Added additional error handling inside the hcloud.py inventory plugin… (#66381)
* Added additional error handling inside the hcloud.py inventory plugin. Otherwise, errors may happen, if the HCloud API is not able to correctly identify the server image.

* Corrected the previous commit to not check for None on variables that are always set. Additionally, used image.description if image.name was not set, instead of the previously added default string.
2020-02-15 11:09:18 -05:00
Mads Jensen
f978b6c789
Use https for Ansible Slack icon. (#65625) 2020-02-15 14:53:18 +00:00
Tomer Brisker
a4f5c2e993
Post reports to newer Foreman API endpoint (#64955)
The `/api/v2/reports` endpoint has been deprecated a long time ago and should
no longer be used. This changes to callback to use the correct API
endpoint and paramerter.
2020-02-15 13:01:27 +00:00
akatch
936bd83614
Fix duplicate log entries (and add item support for failures) (#66098) 2020-02-15 12:48:05 +00:00
ihard
ad2428c176
fix hashi_vault lookup generates warning at LDAP authenticate #52131 (#67251) 2020-02-15 12:46:44 +00:00
Jim Ladd
a5af649a73
foreman: ansible_ssh_host should consider ip, ipv4, ipv6 (#67401) 2020-02-15 10:05:08 +00:00
John McDonough
210e799375
UCS Emulator link to Doc Fragment use cs.co domain (#67434) 2020-02-14 15:20:17 -05:00
Fortinet Core CSE NA
c1d8bdb87a
FortiAnalyzer Network Manager Hotfix (#62919)
* Hotfix for FortiAnalyzer HTTPAPI Plugin in response to connection issues introduced in Ansible 2.9.

* Changed _connect behavior per Mr. Case.

Co-authored-by: Luke Weighall <lweighall@users.noreply.github.com>
Co-authored-by: Nathaniel Case <this.is@nathanielca.se>
2020-02-13 19:36:48 -05:00
Martin Krizek
a2c620819f
Remove a host from a play after meta: end_host (#66851)
* Remove a host from a play after meta: end_host

* Fix changelog
2020-02-13 15:35:00 -05:00
Felix Fontein
11e75b0af2
Fix broken links in crypto, docker and hetzner modules. (#67360) 2020-02-12 16:41:40 -05:00
tchernomax
53e043b5fe
combine filter: fine list handling (option b) (#57894) 2020-02-12 16:40:36 -05:00
Fortinet Core CSE NA
33f136292b
Hotfix for FortiManager Network Connection Plugin (#62534)
* Hotfix for connection manager persistent connection initialization.

* PEP8 Fixes

* First Round of fixes requested by Qualthos.

* Removed _connection check per Mr. Case.

* Somehow the wrong version got sent... should be all good.

Co-authored-by: Luke Weighall <lweighall@users.noreply.github.com>
Co-authored-by: Nathaniel Case <this.is@nathanielca.se>
2020-02-12 14:30:59 -05:00
Felix Fontein
f6815040fd
add_file_common_arguments: fix defaults and tpyes, improve sanity checking (#67243)
* Make validate-modules stop ignore FILE_COMMON_ARGUMENTS.

* Add types to FILE_COMMON_ARGUMENTS and update document fragment to match it.

* Update ignore.txt.

* Add changelog.
2020-02-12 01:44:11 -05:00
Felix Fontein
f725dce936
Clean up FILE_COMMON_ARGUMENTS (#66389)
* Clean up FILE_COMMON_ARGUMENTS.

* postgresql_pg_hba doesn't declare the backup option.

* uri doesn't declare the remote_src option.

* Add documentation.

* maven_artifact seems to use directory_mode, which it doesn't declare.

* Update changelogs/fragments/66389-file-common-arguments.yml
Update docs/docsite/rst/porting_guides/porting_guide_2.10.rst

ci_complete

Co-Authored-By: Jill R <4121322+jillr@users.noreply.github.com>
2020-02-07 18:56:01 -05:00
Allen Smith
fd8eb77cc3
pmrun - quote success command (#66929)
* Recreate the older behavior where the entire success command was quoted

* Use shlex_quote for a correct fix of this

* Add changelog fragment
2020-02-07 12:15:55 -05:00
Dennis Israelsson
68b981ae21
update nmap inventory plugin to not depend on rdns (#56457) 2020-02-05 17:29:59 -05:00
James Cassell
fd954a9c5c
wait_for_connection: also retry interpreter discovery (#67040)
self._discovered_interpreter_key is None unless a previous iteration
has attempted discovery.  In that case, force re-discovery, as the
previous attempt certainly failed.
2020-02-04 11:40:09 -08:00
Brian Scholer
fc7980af9a
Fix UNC path support in the powershell shell plugin (#66604)
* Fix UNC path joining in the powershell shell plugin, add test

* Remove testy bits and a redundant line

* Fix style nits

* Update to use os.ntpath

* Add changelog for #66604
2020-02-04 16:34:11 +10:00
Jordan Borean
6d792838e4
Move url option from util to individual modules (#67068) 2020-02-04 10:43:33 +10:00
Toshio Kuratomi
f5e194cbcd
Move random_mac into its own file (#67000)
* Move random_mac into its own file

This is likely to be the only filter which is not included in
ansible-base.  So it needs to be in its own file.
2020-01-31 14:33:16 -08:00
Petr Mikusek
725bb4d173
Fix typo in shell_windows.py (#66964) 2020-01-31 11:48:28 -05:00
Sam Doran
5112feeace
Make get_bin_path() always raise an exception (#56813)
This makes it behave in a more idiomatic way

* Fix bug in Darwin facts for free memory
    If the vm_stat command is not found, fact gathering would fail with an unhelpful 
    error message. Handle this gracefully and return a default value for free memory.

* Add unit tests
2020-01-30 12:54:25 -05:00
Andrew Klychkov
c9a34ae33e
mysql modules: fix the module's documentation (#66848) 2020-01-30 11:44:47 -05:00
Paul Belanger
adf73d47ec
Remove unused imports from paramiko_ssh connection (#66948)
These were caught by flake8 testing for ansible.netcommon collection.

Signed-off-by: Paul Belanger <pabelanger@redhat.com>
2020-01-30 11:01:34 -05:00
rule88
6a1f82f174
url lookup - add options to match those in urls.py (#64892)
Add 'force_basic_auth' option
By default "force_basic_auth" option is set to False, with this adjustment it is up to the user if it wants to enforce basic authentication.
2020-01-29 16:45:25 -05:00
Joseph Hobbs
72fbbbeb34
Typo correction (#66869)
* Corrected typo in documentation
* Corrected typo in the log statement
2020-01-29 19:46:43 +05:30
Eitan Adler
86663abf37 all: fix all the the duplicate words (#66784) 2020-01-28 14:06:40 -05:00
Geri Jennings
b482857fd3 Update conjur_variable.py (#66763)
Update the link in the Conjur documentation to point to the correct current URL
for information on Conjur machine identity.
2020-01-28 13:15:12 -05:00
Sam Doran
cc2376b782 include_vars - fix stack trace when run ad-hoc with dirs parameter (#66581)
Add integration test

There are a number of other parameters that result in stack traces as well when this module is used ad-hoc. I'm not sure if we're interested in fixing them all since this module isn't meant to be run ad-hoc.
2020-01-28 11:50:34 -05:00
Alex Stephen
cba0feab18 folder support on gcp_compute (#66511)
* folder support on gcp_compute

* fixed issues associated with projects with no vms

* linter fix

* more linter

* linter
2020-01-27 22:37:14 +00:00
Pilou
bbbdc1c25c throttle: fix linear based strategies (#65422)
* throttle tests: fix detection of parallel execution

The test wasn't able to detect if too many workers were running.

On my laptop:
- without this change, the 'throttle' target takes ~20 seconds
- with this change, the 'throttle' target takes ~70 seconds
- 1 second isn't long enough to encounter the issue

* Fix throttle test when strategy is 'free' based

'free' strategy allows multiple tasks to be executed in parallel: use
one 'throttledir' per task.

Use 'linear' strategy with a dedicated play for cleanup/setup tasks

* throttle: reset worker idx before queuing a new task

* TestStrategyBase: define task.throttle

otherwise '1' will be used instead of the default value due to the
following expression being equal to '1':

    int(templar.template(task_mock.throttle))

Co-authored-by: James Cammarata <jimi@sngx.net>
2020-01-24 08:18:08 -06:00
Jiri Tyr
913037731f Update examples in documentation for env lookup plugin (#62662) 2020-01-23 15:27:30 -05:00
Albert Siersema
4a0c875447 Working Cisco IOS macro editing (fixes #55211) (#55220)
* Working Cisco IOS macro editing (fixes #55211)

* Working Cisco IOS macro editing [fixed pylints] (fixes #55211)

* Added integration tests for edit_macro

* Added conditional integration tests for ios_config macro

* Cosmetic fix: when near block for added conditional integration tests for ios_config macro

* Move teardown to always for block
2020-01-23 21:19:15 +05:30
Sam Doran
2b7393141f
reboot - add boot_time_command parameter (#62680)
Allow the built in commands for checking boot time to be overridden. This is mainly for containers and other odd systems where it would add too much complexity to the plugin code to try and discern the correct command to use.
2020-01-21 13:42:32 -05:00
Chris Van Heuveln
7fabb28d22 nxos_gir timeout fixes (#66043)
* nxos_gir timeout fixes

* additional setup/teardown cleanups for sanity test

* Add timeout extension comment to module header

* lint

* rework logic to use action plugin
2020-01-20 12:45:49 +05:30
Adam Miller
077a8b4898 podman - fix rootless container copy no pause (#66583)
Fixes #66263

Signed-off-by: Adam Miller <admiller@redhat.com>
2020-01-17 16:41:10 -05:00
Sam Doran
9b7198d25e
file - change _diff_peek type in argument_spec (#60428)
* Add integration tests
* Handle error in _get_diff_data()
* Change to warning rather than error
* Also change failure to warning in assemble action plugin
2020-01-17 16:02:28 -05:00
Gonéri Le Bouder
cd760782c9 vmware_rest_client: define 'port' parameter (#66506)
Ensure the `vmware_rest_client` based modules accept the `port`
parameter.
2020-01-17 08:11:24 +05:30
Paul Belanger
0fa556f751
Fix flake8 errors related to vyos.vyos collection (#66516)
Signed-off-by: Paul Belanger <pabelanger@redhat.com>
2020-01-16 08:22:51 -05:00
jainnikhil30
ea6bc98398 Foreman: support for want_collectionhosts and want_ansible_ssh_host
* Add support for want_collectionhosts and want_ansible_ssh_host in foreman plugin
2020-01-16 14:55:45 +05:30
Evgeni Golov
ee3dcb4d35 use query instead of q in "if files exist" example (#66409)
##### SUMMARY
It's not obvious that `q` is the same as `query` (which is referred to in the name of the task) and using long-names is generally preferred in examples.

##### ISSUE TYPE
- Docs Pull Request

+label: docsite_pr
2020-01-15 14:19:16 -05:00
ad1rie1
9272e3d547 Fix Bug (#64553) 2020-01-14 11:08:38 -05:00
ndclt
d64b49e8a0 Delete linter ignore lines for keycloak modules (#66406)
* linter: auth_client_id is not required, default value

Delete the lines linked to this mistake in ignore.txt.

* doc: state is not required
2020-01-13 10:41:07 +00:00
Felix Fontein
b070fd1630
Fix typo. (#66403) 2020-01-13 07:27:07 +01:00
Ganesh Nalawade
654b9e2754
Add collection support with local for supported network platforms (#66302)
* Add collection support with local for supported network platforms

*  The legacy behavior of network action plugins using persistent
   the framework is to override the connection=local with the actual connection type (network_cli/netconf/httpapi) based
   on the value of transport option in provider.
*  After the actual connection plugin is identified try to load it from
   `ansible.netcommon` collection, if it fails load it from ansible
   core. This is done to work with Ansible 2.10 and also maintain backward compatibility for
   Ansible 2.9 version to ensure it works with network collections.
*  To support this need to pass collection_list value to connection
   plugins. As in case of connection=local it loads `persistent`
   connection within action plugin which in turn invokes `network_cli`
   or `netconf` connection. Similarly `network_cli` connection plugin invokes
   `terminal` and `cliconf plugins and `netconf` connection plugin invokes `netconf`
   `plugins` based on value on `ansible_network_os`.
*  Add deprecation warning for connection=local support and
   provider support for applicable platforms

* Fix CI failures
2020-01-13 09:49:55 +05:30
Felix Fontein
a79ca57d22
Fix aws_ssm connection plugin. (#66393) 2020-01-12 23:59:25 +01:00
psharkey
f8fb391548 new connection plugin aws_ssm (#49652)
* new connection plugin aws_ssm

Return code may be at the end of the last command output line.

Marking regex.

Ensure command status code is on it's owm line - last 3 lines are not part of command stdout.

* Adding timeout parameter - aws_ssm_timeout

Default 10 second timeout (https://docs.ansible.com/ansible/2.4/intro_configuration.html#timeout) is marginal.
This avoids changing this default and allowing the SSM timeout to be controlled via inventory.
This change wraps commands so commands which may never return do timeout.

* Added integration tests

Added AWS SSM Executor, target and config functions

Fixed more code for integration tests

Improved execution

Added S3 bucket name

Fixed pylint

Reverted lib changes

Reverted few more changes

Improved support for integration test execution

added ansible role for aws_ssm_integration_test setup and teardown and modifiled runme.sh

Reset to 17fa565 commit

inventory file location changed

change inventory file location

deleted meta and handlers folder as it is not required

deleted main.yml inside vars, removed extra space from tasks/main.yml, Added appropriate tags for ec2 and delete test folder as it is not required

deleted main.yml inside vars, removed extra space from tasks/main.yml, Added appropriate tags for ec2 and delete test folder as it is not required

modified task/main.yml

added region variable and fixed pattern for using variable

modified policy for IAM role

moved to first line of scrip set -eux

Updated Session Manager plugin installation

edited custme policy

Included tags for Session Manager plugin installation

Added README.md

Upddated README and added support for ssm-plugin for Amazon-Linux

Added Windows Integration test support

Improved user data for Linux

Added random value generation for the role and policy,delete vars_to_delete.yml

upadte README in vars

fixed typo

update policy

Updated IAM policy file

update playbook

Updated playbook to include ssm-agent userdata

modified jing2 template

modified jing2 template

modified jing2 template and fixed role deletion

fixed role name issue while deleting and task name

Updated playbook to include wait_connection for ec2

Corrected Synatx changes and updated ssm-plugin debian file

Changed region variable to us-east-1

Removed vars file and updated  to /tmp dir

fixed typo

Improved setup

Fixed boto3 dependency

Fixed missing tag

Added boto as dependency as well

Improved execution workflow

Trying other way of defining tags

Fixed undefined var

Changed AMI ID to Amazon Linux

Improved Tags

Ok, created different directory for WIndows test execution

Fixed IAM Role Name for Windows

Fixed inventory not found

Improved integration test execution

Fixed Windows Inventory path

Fixed wrong Windows AMI ID

Fixes issue for windows test execution

* Don't attempt to terminate sessions without a session id.

* Added Unit test cases file for AWS SSM Connection plugin

updated test file with close

updated unit test file with start_session

updated test files

* Eliminate AWS CLI dependency for terminal session.

* Removing unused code, cleanup logic.

Reduce mark length - 52^26 should be plenty
Be explicit about subprocess.Popen options
Simplify if/else for mark end
_stdin_readline is not used now

* updated test file

Added exec command and fixed close session unit tests

updated test files

Improved ansible ssm test command

updated file for lint checks

updated for pylint checks

New Unit_testcases for pre-signed URL file

removing additonal spaces and white spaces

remaning error changes

fixed changes

fixed spaces issues

python 2.7 version and whitespaces

python 2.7 version and whitespaces

python 2.7 skip if

space issue with 16:1

Unit test cases for windows and linux

Unit test cases for windows and linux with issues fixed issues

Unit test cases for windows and linux with issues fixed issues1

* Added support for S3 Pre-signed URLs

* Updated documentation and comments

* Documentation and curl dependency removal for controller machine

Fixing lint errors and removing requirements.

* Adding support for Windows remote EC2 instances.

* Added Encoding fixes

* Updating author section and adding obvious requirement for the SSM agent.

* Refactor stdout post processing
Attempt to get real return code on error (test using ansible -m raw -a 'cmd /c exit 99'.
Fixes problem at terminal width (ansible windows -i ./hosts.yml -m setup).

* Refactor back to a single module.

* Fixed fetch file for windows

* ssm usage examples for linux and windows

* Update aws_ssm.py

Service state corrected.

* Strip line continuation when at terminal width - otherwise replace.
Strip ANSI control sequences only for Windows.

Test playbook:

---
- name: test
  hosts: windows
  gather_facts: False
  vars:
    small: 'abc'
  tasks:
  - name:
    set_fact:
      large: "{{ lookup('password', '/dev/null length=2000 chars=ascii_letters,digits,hexdigits,punctuation') }}"
  - name: small fixed
    raw: echo '{{ small }}'
    register: small_result
    changed_when: False
  - name: check
    assert:
      that:
        - "(item | length) == (small | length)"
        - "item == small"
      msg: "'{{ item | length }} must equal '{{ small | length }}' and '{{ item }}' must match '{{ small }}'"
    with_items:
      - "{{ small_result.stdout_lines[0] }}"
  - name: large random
    raw: echo '{{ large }}'
    register: large_result
    changed_when: False
  - name: check
    assert:
      that:
        - "(item | length) == (large | length)"
        - "item == large"
      msg: "'{{ item | length }} must equal '{{ large | length }}' and '{{ item }}' must match '{{ large }}'"
    with_items:
      - "{{ large_result.stdout_lines[0] }}"
  - name: gather facts
    setup:

* Correct module parameter names.

* Updated Windows Executable variable.

Updated Windows Executable variable to "ansible_shell_type".

Fixing Examples with raw declaration

Updated the plugin timeout variable.

* Fix to work with dynamic inventory plug-in

* IntegrationTest template updates

* Removing unsupported flag for integration tests.
Fixing unit test.

* Adding shippable group.

* SSM Usage examples with dynamic inventory plugin

* Fixing yamllint errors.

* Fixed Integration tests

* Fixed Integration tests

* Updates for python3.

Removing python3 restriction.

* Remove python3 restriction.
Change block from retry to always

* Fixed Integration tests with Python 3

* Fixed shellcheck

* Fix for Windows which could pick up end mark prematurely
Move debug to _wrap_command and use a single return point

Single-quotes not needed around linux marks
Fix typo in comment

End mark to new command.

* Unit test cases now works on Python2 and Python3

* Skip tests on Python 2.6

* Fix for wait_for_connection module for windows.

* Updated changes as per review comments

* Fixing broken pipe error seen with session-manager-plugin version 1.1.17.0.
Eliminating sleep as this looks to be fixed in session-manager-plugin version 1.1.17.0.

* Adding back delays for Windows with session-manager-plugin 1.1.17.0.

* Updating Windows AMI ID for integration Test

* Upgrading windows ssm agent to the latest

* Adding boilerplate code.

* Windows ami and integration test updates

* Revert "Windows ami and integration test updates"

This reverts commit cd6ca3579b7cda584bd9c065f9c0835bddb23627.

* Updating windows ami for Integration tests

* Integration test suite updates and fixes.

* Updates and fixes

* Eliminate duplicate processing for exit code on failed command.

* Add powershell wrap.

* Refactor windows post_process.

* AMI Lookup, aliases, OSC filter, test suite updates

Co-authored-by: Gaurav Ashtikar <gau1991@gmail.com>
Co-authored-by: Deepak Choudhary <40276333+deepsvc@users.noreply.github.com>
Co-authored-by: Hanumanth <46720371+hanumantharaomvl@users.noreply.github.com>
Co-authored-by: KUMAR MAYANK <mayank@flux7.com>
2020-01-11 15:22:01 +10:00
Nathaniel Case
0a3a81bd12
Persistent connections: These timeouts seem unused (#66267)
* These timeouts seem unused

* Add changelog
2020-01-10 23:09:21 -05:00
Ganesh Nalawade
0d85ab1fe3 Add collection support for network platform agnostic modules (#66342)
*  Refactor net_base action plugin to invoke platform
   action plugin with implementation module name updated
   in the new task copy.
2020-01-10 12:42:53 -05:00
Chris Van Heuveln
3ebc96e5c7 nxos_l3_interfaces: fix states, add new minor attributes (#64853)
* (WIP) nxos_l3_interfaces: fix states, add new minor attributes

* sa cleanup

* more regression fixes

* test_8 for add'l code coverage

* Fix regressions to handle mgmt w/o IP

* add 'no system default switchport' to regression setups

* add err msg to terminal_stderr_re so that cli_config will catch L2 failures

* regression test change: /int4/int3/

* Add default rsvd_intf_len for Zuul CI

* Fix replaced-with-no-ipaddr and ip redirect issues
2020-01-10 16:33:22 +05:30
Jordan Borean
c92b538cc5
WebRequest - remove generically named aliases from util (#66325)
* WebRequest - remove generically named aliases from util

* Fix location of deprecated aliases key
2020-01-10 13:01:26 +10:00
Paul Belanger
7a7f70612a
Revert "Fix net_put module text file issue (#66065)" (#66328)
This PR didn't properly run testing for network jobs. As a result it has
broken jobs for ios and junos.

This reverts commit fa66813696.
2020-01-09 21:51:59 -05:00
Jordan Borean
d3427bb860
Make sure warnings are printed during fact gathering (#66258) 2020-01-10 06:16:20 +10:00
Ganesh Nalawade
fa66813696
Fix net_put module text file issue (#66065)
*  Modify the parent class for net_put and net_get
   module to refer from `ActionModule` class in
   network.py action plugin which contains the
   common code for network plugins.
*  Replace `_handle_template` with `_handle_src_option`
   function name which is defined in common class.
2020-01-09 18:42:00 +05:30
Abhijeet Kasurde
42b0c967d0
FreeIPA: Fix documentation (#66194)
* Add datatype whereever it is missing
* Fix documentation

Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
2020-01-09 15:32:26 +05:30
Egor Zaitsev
fff613dd3e routeros_command – add support for dot in username (#65905) 2020-01-08 23:04:47 -05:00
Marc Hörsken
53e405dd42 Fix 'CyberarkPassword' object has no attribute 'delimiter' (#66268)
This is a very small follow up to PR #59500
2020-01-08 15:36:41 -05:00
nkshrishail
01e4c41be4 nxos: Removing local-nxapi plugin and related parameters' usage from the integration tests. (#65068)
* nxos_integration_tests: Removing obsolete provider parameter

* nxos: removing support for local-nxapi plugin

* nxos: removing LocalNxapi plugin implementation

* nxos_nxapi: removing local plugin usage

* REVERT - nxos: removing LocalNxapi plugin implementation

* Addressing yamllint issues

* Removing the condition on the debug messages

* Restoring changes done to nxos_nxapi* tests

* Retaining timeout of 500 on nxos_smoke test

* Some cleanup

* Addressing latest comments

* Restoring the nxos_smoke and removing timeout from nxos_config and nxos_rollback
2020-01-08 13:43:23 +05:30
Nathaniel Case
e19b94f43b
Add test for reboot & wait_for_connection on EOS & IOS (#63014)
* Add test for reboot & wait_for_connection

* Add test for ios

* Collection-proof block test

* Add junos test

* Don't try to evaluate cli context unless using the connection

* Prevent infinite recursion
2020-01-07 14:24:26 -05:00
Mads Jensen
ec34235e2e Use a context handler for file handling in paramiko_ssh.Connection. (#65624) 2020-01-06 13:09:57 -05:00
Anthony Bourguignon
d3e9ef3c35 add a path_join filter which joins path components (#62713) 2020-01-06 11:56:40 -05:00
Abhijeet Kasurde
9a13d56b26
Misc typo fixes (#66120)
Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
2020-01-04 21:13:30 +05:30
Abhay Kadam
2fa8f9cfd8 Fix env lookup plugin error on utf8 values (#65541)
This commit fixes issue #65297.

The env lookup plugin used to fail when environment variable value
contained any UTF-8 characters (e.g., δ, ζ).
2019-12-25 17:24:38 +05:30
Sloane Hertel
d50fac9905 Remove illusion of caching in the inventory script plugin (#64151)
* Load the cache plugin for the inventory script plugin and fix update cache logic

* Remove the illusion and let individual scripts deal with it

* reword that

* Deprecate instead of a hard failure

* changelog
2019-12-20 11:44:07 -05:00
Ganesh Nalawade
1cfab26fab
Fix netconf plugin related to collections (#65718)
* Fix netconf plugin related to collections

Fixes #65655 (partly)

*  Make netconf plugins configurable so that the
   information of ncclient device handler
   for give platform resides in the platform
   specific netconf plugin.
*  If the device handler value in ncclient is
   different from the ansible_network_os value
   the right value of `ncclient_device_handler`
   should be set in the plugin documentation.

* Fix review comments

* Fix CI issue

* Fix review comment
2019-12-20 12:25:59 +05:30
Sloane Hertel
c870457339 free strategy - include failed hosts that were notified (#65576)
* free strategy - include failed hosts that were notified so --force-handlers is used

* trim line length a bit

* Loop over the force handler tests with the strategies linear and free

* rename changelog

* Use the play iterator instead of TQM for accurate failure representation in blocks

* Remove hack in a backwards compatible way for 3rd party plugins
2019-12-19 14:10:51 -05:00
Paul Belanger
0310163bb9
Remove unused json import for iosxr terminal (#65879)
Signed-off-by: Paul Belanger <pabelanger@redhat.com>
2019-12-16 13:25:01 -05:00
Sam Doran
6f76a48f59
Make sorting in collection_loader match plugin loader (#65776)
* Simply sorting of Windows files below other plugin types
    Using the sort method with a custom key function uses less memory than creating multiple lists then joining them.

    This seemed to be an acceptable use of a lamdba, even though I geneally try to avoid them.

* Fix sorting of plugins inside of collections
    Explicitly sort Windows files below others, mimicking what we do in plugin/loader.py

* Add documentation about ansible.builtin and ansible.legacy
    Also document to the two different methods used for searching based on the candidate type.

* Add changelog
* Add integration test
* Update comment with expected sort order
2019-12-16 11:28:24 -05:00
Paul Belanger
093d1500b9
Clean up flake8 for ansible.netcommon collection (#65842)
We noticed the following flake8 errors when we ran the migration script
for ansible.netcommon.

Signed-off-by: Paul Belanger <pabelanger@redhat.com>
2019-12-16 08:24:38 -05:00
Ganesh Nalawade
06d997b2b2 Fix nxos_file_copy argument error handling. (#65861)
*  Use `option_type` instead of `type` for error
   handling in task options
2019-12-16 13:05:18 +05:30
Ganesh Nalawade
88008badb1
Fix nxos_file_copy option value path validation (#65423)
* Fix nxos_file_copy option value path validation

*  Modify `local_file`, `local_file_directory` and
   `remote_file` option type from `str` to `path`
   so that the option value is validated in Ansible
   for a legitimate path value

* Fix review comments
2019-12-15 10:41:33 +05:30
Ganesh Nalawade
ff5253fa0e Fix network_cli become check to be compatible with collections (#65829)
*  The become method name check is not required in network_cli
   as the become command is specific to platform and is implemented
   in the platform specific terminal plugins
2019-12-14 16:50:51 -05:00
Ganesh Nalawade
2ef47148cd
Fix action plugin issue with network connection type in common collection (#65078)
* Fix action plugin isse with network connection type in common collection

*  For network connection in common collection the value of
   ansible_connection is the FQCN of the connection type
   For example ansible_connection=network.common.network_cli

*  Add fix in supported network action plugins to extract
   the connection name from FQCN

* Fix CI issue

* Fix review comments and update community network action plugins
2019-12-13 19:22:56 +05:30
Tim Gates
cbc513e748 Fix simple typo: workind -> working (#65758)
Closes #65757
2019-12-12 15:37:14 +05:30
Abhijeet Kasurde
e82b28a920
cgroup_perf_recap: Check if user wants to write to files or not (#64988)
if user sets 'write_files' to False or does not set value, then
handle file write related operations.

Fixes: #64936

Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
2019-12-11 20:21:38 +05:30
Joseph Jacobs
d9f0703b45 Update generator.py documentation (#65573) 2019-12-10 09:29:00 -05:00
Alex
4239dc1bb5 ANSIBLE_CACHE_PLUGIN_TIMEOUT - docs (#65311) 2019-12-10 09:19:54 -05:00
JP Mens
f8216db21f Update iocage.py: remove 'docker' (#65656)
It seems to me as though the term 'docker' was copy/pasted in; I don't understand what it would mean in the context of iocage. As such, I think removal is best.
2019-12-10 11:09:54 +05:30
Dusan Matejka
880bbb9946 fixed inconsistent required set to True in zabbix modules 2019-12-09 10:20:17 -08:00
Matt Martz
03a4edb477 Add method to automatically clean up after an action plugin (#65509)
* Use correct var, move cleanup for async
* Add changelog and tests. Fixes #65393. Fixes #65277.
* Kill off all long running async tasks from listen_ports_facts
* Update task to work with older jinja2
2019-12-06 17:29:26 -05:00
Abhijeet Kasurde
c97360d21f vmware: vmware_vm_inventory use port value when with_tags:True (#65568)
If user specifies a port number in vmware_vm_inventory plugin configuration,
then use that port to connect to vCenter rather than connecting to 443 which
is default port.

Fixes: #64096
2019-12-06 15:23:12 -05:00
Ganesh Nalawade
3919a891c2
Fix iosxr netconf plugin get device info (#65489)
* Fix iosxr netconf plugin get device info

Fixes https://github.com/ansible/ansible/issues/64634

*  Catch execption if the xml payload to get
   device info is not valid for iosxr version
   running on remote host.

* Fix CI issue
2019-12-06 08:58:03 +05:30
Satyajit Bulage
770430fd07 Added required parameter to document DOC-string to produce Documentation. (#65230)
* Added required parameter to document DOC-string to produce Documentation.

Signed-off-by: Satyajit Bulage <sbulage@redhat.com>

* Just copy short_description as it was
2019-12-05 06:23:45 +10:00
Sylvain Monné
03c16096d7 Fix extract filter when key does not exist in container (#64959)
Fixes #64957
2019-12-04 13:24:52 +01:00
Fabrice
49b457016e k8s: persist refreshed tokens (#63219)
When the ansible k8s module is refreshing the tokens from the local kube
config, it should save those token to the kube config file.

If this is not done, this might break the next kube client call as the
token in the local kube config file is not valid anymore and refreshing
can fail.

This commit is adding an env var K8S_AUTH_PERSIST_CONFIG that can be
used to set this flag to true (default is false, same as current
behavior).
2019-12-03 12:22:26 +10:00
mmallet
4b240a5d74 Azure RM: Fix missing ipConfiguration 'primary' attribute (#63722)
If a NIC has no primary ipConfiguration, the 'primary' field returned
by Azure is set to 'null' thus removed from the 'nic_model'
ipConfigurations properties. Unfortunately the code generating the
hostvars dict. assumes the 'primary' key always exists, leading the
entire host parsing to fail.

This patch changes the way the 'primary' field is accessed by using the
dict. 'get' method with a default value set to 'False'.

Resolves #63721

Testing Done: Run ansible-inventory with an azure_rm plugin that points
to a resource group that contain a two VMs, on with a primary
ipConfiguration and another one without. Check that without the patch
the inventory output does not contain the VMs (or just the one with the
primary ipConfiguration set, depending on the VM names). Finally check
that with the patched azure_rm.py file, both VMs show up.
2019-11-27 15:53:05 +08:00
JeferCatarina
4c589661c2 Fixed want_facts in the foreman inventory plugin - fixes #65111 (#65114)
* Replaced 'ansible_facts' by 'foreman_facts'

'foreman_facts' is the key that the foreman inventory script used
'ansible_facts' is a special key that is overwritten internally and has never worked in this inventory plugin

* Added changelog
2019-11-26 13:41:28 -05:00
Abhijeet Kasurde
8d0c2cd4d5 include_vars: Check NoneType for raw_params (#64979)
Lookup 'first_found' returns empty list which results in
raw_params checking. Check NoneType for 'raw_params' before
proceeding.

Fixes: #64939

Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
2019-11-26 13:11:02 -05:00
Ganesh Nalawade
ee3f8d28a4
Fix cli context check for network_cli connection (#64697)
* Fix cli context check for network_cli connection

Fixes #64575

*  Check cli context for network_cli connection
   at the start of new task run only.

* Pass task_uuid around to identify start of new task run

* Handle for local connection
2019-11-26 08:40:49 +05:30
Trevor Pounds
8daa42bb3d Support non-KV and KV v1/v2 secret engines (#64288)
* Support generic and KV v1/v2 secret engines.

Fixes #41132
Fixes #50598
Fixes #54462
Fixes #64150

* Update KV v2 compatibility notes/usage docs.

* Add tests for KV v1/v2 and generic secrets engines.

* Add changelog fragment.

* Add KV v2 behavior changes to porting guide.

* Fix pylint blacklisted name warnings.
2019-11-25 06:18:49 +01:00
Maxime Guyot
c08f536260 Add support for all_projects in OpenStack inventory module (#55965) 2019-11-21 10:35:44 -05:00
Xu Yuandong
da8ec327cc Update plugins/netconf/ce.py to fix a bug(failed to get veriosn information via neocnf). (#65065)
* fix version fail.

* add a changelog fragment.

* Update ce.py

* Rename plugins-netconf-ce-fix.yaml to 65065-plugins-netconf-ce-fix.yaml

* Update ce.py
2019-11-20 22:18:24 +01:00
Ganesh Nalawade
502fc2087e
Add support for jumphost setting in junos_scp and junos_package (#64086)
* Add support for jumphost setting in junos_scp and junos_package

* Since junos_scp and junos_package module uses junos-eznc library
  to transfer file and load package respectively to a remote device
  it does not read the jumphost related configuration in netconf
  connection plugin unlike other junos modules which uses the
  Ansible persistent.
* Add `ssh_config` and `ssh_private_key_file` to add support to
  read custom ssh config file and mention ssh private key file
  for junos_scp and junos_package module

* Fix CI issue and update note section
2019-11-20 17:29:41 +05:30