Commit graph

51708 commits

Author SHA1 Message Date
Matt Clay 14ff5e213c Fix ansible-test docker container IP detection. 2021-04-22 11:54:54 -07:00
Sandra McCann 6119fb0a9a
lighten navigation background to make section labels easier to read for core docs (#74356)
* make section labels for /ansible-core/ docs easier to read, with black text and lighter gray background
2021-04-22 13:54:27 -05:00
Matt Martz bf7d4ce260
Abstract away libyaml details into yaml utils (#72607)
* Add yaml utils file and use it

* Linting fix and missing import

* Abstract a few more details

* Parser imports

* Don't use CSafeDumper in AnsibleDumper

* Move and use convert_yaml_objects_to_native when libyaml is present

* yaml_load and yaml_dump, instead of safe_*

* re-use HAS_LIBYAML from utils.yaml

* add changelog fragment

* Address recent changes

* Use representer instead of recursive type converter

* Restore needed import

* move yaml utils to module_utils

* Properly guard imports

* Update from_yaml(_all)? to handle text wrappers with CSafeLoader

* Use yaml utils for legacy_collection_loader

* Add HAS_YAML, and ignore pylint issue

* oops

* GPL->BSD
2021-04-21 16:47:03 -05:00
Brian Coca 6418f368e3
Fix pb subs collapse (#74301)
* fix subdir parsing for plays

  fixes #74283

  Co-authored-by: Nikolaos Kakouros <nkak@kth.se>
2021-04-21 17:27:41 -04:00
Matt Martz a3e7cf0110
Update alpine repo to community for libuser (#74374) 2021-04-21 16:20:50 -05:00
Rick Elrod 738132da95
[ansible-test] add freebsd/13.0 remote (#74328)
Change:
- FreeBSD 13.0 was released on the 13th, add it to ansible-test.

Test Plan:
- ci_complete

Signed-off-by: Rick Elrod <rick@elrod.me>
2021-04-21 15:13:41 -05:00
Sam Doran fdbef02923
Update docs on working on docs (#74201)
* Fix the Makefile's htmlsingle command.
Co-authored-by: Toshio Kuratomi <a.badger@gmail.com>
2021-04-21 15:15:27 -04:00
Martin Krizek c21ad66e61
Remove unused PlayIterator.cur_dep_chain (#74366)
Introduced in fb797a9e77.
Usage removed in cae682607c.
2021-04-21 11:39:22 -04:00
Sam Doran 7625c8f3d3
arg_spec - remove unused imports (#74354) 2021-04-21 11:38:23 -04:00
Toshio Kuratomi 4c79dd16be
Update the porting guide for a new ansible version (#74362) 2021-04-21 10:23:31 -04:00
elara-leitstellentechnik 437a08eb6d
Map Debian 8 to Python 2 (#74152)
* Map Debian 8 to Python 2

If Python 3 is installed on Debian 8 Ansible cannot run, as the version
is too old (3.4)

* Add integration test for python interpreter discovery on Debian 8

* fix test issue on Debian 9, add changelog

* un"fix" not broken test :D

Co-authored-by: Fabian Klemp <fabian.klemp@elara-gmbh.de>
Co-authored-by: Matt Davis <mrd@redhat.com>
2021-04-20 15:28:24 -07:00
Matt Clay e6af2d6827 Fix ansible-test coverage traceback when no data.
If no coverage directory exists, ansible-test coverage would traceback.

Now it silently continues just as if the directory was present but empty.
2021-04-20 14:33:05 -07:00
Sam Doran 2cbfd1e350
Add porting guide and documentation for changes to argument spec validation (#74268)
* Add ArgumentSpecValidator to docs
* Improve docs for ArgumentSpecValidator
* Document removal of private methods

* Update module_utils documentation
    - Add docs for argument spec classes as well as validation and parameters files.
    - preserve the order in the source for errors.py
    - document DEFAULT_TYPE_VALIDATORS so it can be referenced elsewhere
    - fix automodule directive for validation.py

* Update docs in arg_spec and paremeters
    - This improves the generated documentation.

* Document breaking changes in porting guide.
* Update formatting in porting guide and add a Deprecated section
* Fine tune module_utils documentation


* Move instance docstring to the __init__ method
  Remove optional description since it fails the sanity test and I am not 100% it is valid anyway.

* Remoe incorrect parameter from docstring
  This was changed a while ago but wasn't removed from the docstring.

* Use attr rather than attribute
  The py:attribute: domain only exists in newer Sphinx >= 3.1.

* Improve documentation on exceptions
* Final pass
    - use args/kwargs instead of param
    - fix formatting errors that didn't display examples correctly
    - format TypeErrors so they are referenced as classes
    - specify complex types
2021-04-20 15:40:53 -04:00
Abhijeet Kasurde 6e56e72d99
vmware: Add a note about known issue (#73273)
Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
Co-authored-by: Sandra McCann <samccann@redhat.com>
Co-authored-by: Alicia Cozine <879121+acozine@users.noreply.github.com>
2021-04-20 14:11:45 -04:00
sry9681 c0cc574e65
Update lookup.rst (#73716)
Document that users must pass `allow_unsafe=True` as an option in the lookup to allow templating, with a note about security implications.

Co-authored-by: Alicia Cozine <879121+acozine@users.noreply.github.com>
Co-authored-by: Sandra McCann <samccann@redhat.com>
2021-04-20 12:54:54 -05:00
ml c9c84594d8
Docs: Fix k8s_config_resource_name YAML example (#74129)
The `name` key should be beneath `metadata`:
2021-04-20 13:37:44 -04:00
Abhijeet Kasurde 9ed0e37e53
Add a link to Jinja 2 templates (#74348)
Added a link to Jinja 2 templates in playbooks_templating documentation page.
Fixes: #74313

Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
2021-04-20 12:14:08 -05:00
Amin Vakil 49d4442378
Add umask option to user module (#73821)
* Add umask option to user module

* Fail on setting both umask and local: True

* Add integration test

* Add changelog

* Run integration tests only if HOME_MODE is not set

* Run integration tests only on Linux

Co-authored-by: Matt Clay <matt@mystile.com>
2021-04-20 12:01:56 -04:00
yuri 5f391a72ee
Update playbooks_filters.rst (#74242)
##### SUMMARY
Make the `random` filter description more clear.
2021-04-20 11:59:16 -04:00
schurzi 5e5bfa8116
remove deprecated ansible.module_utils._text from documentation (#73211)
According to comment in ansible.module_utils._text it is deprecated and
should not be used. This is now reflected in the documentation.
2021-04-20 11:53:27 -04:00
Baptiste Mille-Mathias 99a2b5f300
Provide results to examples (#73984) 2021-04-20 11:52:54 -04:00
Brian Coca 4494ef3a9d
defend against bad or missing crypt (#74304)
* defend against bad or missing crypt

  fixes #74279
2021-04-20 11:47:34 -04:00
David Shrewsbury d44eb03f49
Remove include from tests (#74330) 2021-04-20 11:19:29 -04:00
daeseokyoun 9369bd6ca1
correct how to install Docker SDK for Python (#74288)
* docs: correct guide for the latest Docker SDK for Python
Co-authored-by: Felix Fontein <felix@fontein.de>
Co-authored-by: Sandra McCann <samccann@redhat.com>
Co-authored-by: Daeseok Youn <daeseok.youn@navercorp.com>
Co-authored-by: Alicia Cozine <879121+acozine@users.noreply.github.com>
2021-04-20 11:03:30 -04:00
Brian Coca 7b39ee361d
corrected epmhasis line (#74254)
need to be careful when adding lines as you create a different offset
2021-04-20 09:38:06 -05:00
Brian Coca 2296da95a2
fix module schema (#74295)
* fix module schema

  not out of date hardcoded list anymore, uses 'current + 4' to
  set valid deprecation targets

Co-authored-by: Matt Clay <matt@mystile.com>
2021-04-20 10:02:39 -04:00
Rick Elrod 698eae3f3d [tests] Work around vixie-cron and PAM issue, el6
Change:
- This works around an issue that causes the cron test to fail sometimes
  on el6.

Test Plan:
- ansible-test integration cron --docker centos6

Signed-off-by: Rick Elrod <rick@elrod.me>
2021-04-19 20:41:30 -07:00
Rick Elrod 9f1513d4c0 [become] Add Solaris chmod ACL fallback
Change:
- Newer Solaris drops setfacl. Add a fallback for its chmod ACL syntax.

Test Plan:
- New units

Tickets:
- Fixes #74282

Signed-off-by: Rick Elrod <rick@elrod.me>
2021-04-19 20:28:57 -05:00
Rick Elrod 7d64aebdd3 [become] Fix solaris permissions regression
Change:
- Regression introduced in #70785
- When macOS chmod ACL syntax is used, Solaris-derived chmods return
  with a status of 5. This is also used for our sshpass handling,
  because sshpass will return 5 on auth failure. This means on Solaris,
  we incorrectly assume auth failure when we reach this branch of logic
  and try to run chmod with macOS syntax.
- We now wrap this specific use of chmod in an exception handler that
  looks for AnsibleAuthenticationFailure and skips over it. This adds
  another authentication attempt (something we normally avoid to prevent
  account lockout), but seems better than the regression of not allowing
  other fallbacks to be used.
- Without this patch, if setfacl fails on Solaris (and sshpass is used),
  we do not try common_remote_group or world-readable tmpdir fallbacks.

Test Plan:
- New unit

Signed-off-by: Rick Elrod <rick@elrod.me>
2021-04-19 20:28:57 -05:00
Matt Clay 7786dbbdc1 Split out module/module_utils unit test execution.
- Unit tests for `modules` and `module_utils` are now limited to importing only `ansible.module_utils` from the `ansible` module.
- Unit tests other than `modules` and `module_utils` are now run only on Python versions supported by the controller (Python 3.8+).
- Unit tests are now run in separate contexts (`controller`, `modules`, `module_utils`), each using separate invocations of `pytest`.
2021-04-19 15:44:58 -07:00
Matt Martz 3740d7b028
Only check if play.hosts is a template when the play hasn't been finalized (#73941)
* Extend finalized logic to strategy
* Add changelog fragment
2021-04-19 13:03:40 -04:00
Ganesh Nalawade d8bf4206e4
netconf - handle import error when running in FIPS mode (#73992)
* Handle netconf plugin ncclient import error when running in FIPS mode

*  While running in FIPS mode importing ncclient result in
   InternalError raised by cryptography
*  Refer https://github.com/ansible/ansible/pull/65477
2021-04-19 12:41:55 -04:00
Scott Sinclair 325ccf22fe
Fix issue with version 3 in docs version list (#74089)
Previously would subsitute the "3" in "s3" instead of the version location in the URL
2021-04-19 18:33:35 +02:00
Matt Clay 9ba6cf9a72 Relocate misplaced unit tests. 2021-04-16 22:23:40 -07:00
Matt Clay 277a06f641
Clean up ansible-test cloud plugins. (#74322)
- Improve code reuse.
- Add missing type hints, fix existing ones and convert them to PEP 484 style.
- Add missing imports and clean up existing ones.
- Add missing docstrings and clean up existing ones.
2021-04-16 18:49:22 -07:00
Matt Martz 17237c1d88
Deprecate Py2.6 support for target nodes (#74165) 2021-04-16 11:42:29 -05:00
Brian Coca 07939b04f3
[2.12] 'attributes' (#73707)
* wip 'attributes'

* added version added tests

* syntzx

* not bile

* correztlys merges

* moved desc to frag

* simpler as dict

* unused

* clog

* Update lib/ansible/utils/plugin_docs.py

Co-authored-by: Jacob Floyd <cognifloyd@gmail.com>

* unnoted

* added action plugins

* longer list

* add sttri schema

* huh?

* itsdict

* dictit

* yolo

* gnore for now

* moar attribs

* allow extras

* positive

* added loop, documented 'imports'

* support is now none/partial/full

* import_playbook is outside host loop

Co-authored-by: Jacob Floyd <cognifloyd@gmail.com>
2021-04-16 18:17:00 +02:00
Alex Willmer 185d410316
Factor out host_label() in default stdout callback plugin (#73814)
This simplifies rendering the hostname (or hostname+delegated host) in
the default callback module, and reduces code duplication

I've chosen not move where in each handler the host label is rendered,
in case subsequent operations has side effects. However I'm happy to
change that if considered safe.

I've chosen not to change the formatting operator used (%), to avoid
changes in rendering that might result.

Signed-off-by: Alex Willmer <alex@moreati.org.uk>
2021-04-16 11:12:25 -04:00
Amin Vakil a7c8093ce4
[2.12] Add accept_newhostkey option to git module (#73819)
* Add integration test for accept_newhostkey option

* Add changelog
2021-04-16 11:10:35 -04:00
Jordan Borean 019452dda7
uri - fix traceback on multipart-form int value (#74302) 2021-04-16 11:09:31 -04:00
Amin Vakil fdee5ca16d
Add cacheonly option to yum and dnf modules (#73820)
* Add integration test

* Add changelog

Co-authored-by: Matt Clay <matt@mystile.com>
2021-04-16 11:08:52 -04:00
Amin Vakil 0c101f3f76
Add epoch_int in date_time facts (#73822)
* Add unit test

* Add changelog
2021-04-16 11:03:07 -04:00
Ompragash Viswanathan 8d027436d4
Updated COLLECTIONS_4.rst to include ansible-inclusion repo link (#74309)
* Updated COLLECTIONS_4.rst to include ansible-inclusion repo link for new collection submission

* Update COLLECTIONS_4.rst

* Update COLLECTIONS_4.rst

* Update docs/docsite/rst/roadmap/COLLECTIONS_4.rst

Co-authored-by: Sandra McCann <samccann@redhat.com>

Co-authored-by: Alicia Cozine <879121+acozine@users.noreply.github.com>
Co-authored-by: Sandra McCann <samccann@redhat.com>
2021-04-16 13:12:51 +01:00
Martin Krizek 7fecb7ccc3
Actually run blocks/finalized_task test (#74291) 2021-04-16 08:04:11 +02:00
Rick Elrod 7ef3dc2b8b
[controller ansiballz] escape directory regex (#74270)
Change:
- We were passing a directory name directly to re.compile().
  If the directory isn't valid regex (or is) this can have odd side
  effects, such as crashing.
- Fix a few other similar cases, but less likely to be a real issue.

Test Plan:
- New test

Signed-off-by: Rick Elrod <rick@elrod.me>
2021-04-15 17:06:58 -05:00
Matt Martz cf4a9fcd0f
Prevent traceback when task depth exceeds python recursion depth (#73999) 2021-04-15 15:52:08 -05:00
Matt Martz 1082e2ab79
Catch errors getting filters (#74127)
* Catch errors getting filters, and fail

* Add changelog

* Switch to warnings instead of errors, to match other plugin loader behavior

* Add tests

* Handle collections
2021-04-15 15:51:41 -05:00
Matt Martz 28a2d9b4ae
Remove __requires__ attribute for pkg_resources (#74294) 2021-04-15 15:20:20 -05:00
Brian Coca e3eeb88f7c
removed unused imports (#74299) 2021-04-16 05:57:38 +10:00
Martin Krizek 664531d7d6
Prevent ansible_failed_task from further templating (#74290)
* Prevent ansible_failed_task from further templating

Fixes #74036

* Add changelog
2021-04-16 05:48:57 +10:00