Commit Graph

32668 Commits (c7334ea92cb061fc9dd8cc7ed41d0c7e15440eb9)

Author SHA1 Message Date
Sloane Hertel 694c11d5bd
argspec - fix validating type for required options that are None (#79677)
* Only bypass type validation for null parameters if the default is None. A default is mutually exclusive with required.

* Prevent coercing None to str type. Fail the type check instead.
1 year ago
Sloane Hertel 964e678a7f
ansible-galaxy - fix installing dir sources with a trailing path separator (#79110)
* strip trailing path separator from type=dir sources
1 year ago
Rogier Krieger 6aac0e2460
Extend OpenBSDStrategy to also update current hostname. (#80521)
Fixes #80520
1 year ago
kloud-byun 2e62724a8a
feature: add support for symbolic links when passing "dir" (#80460)
* update the include_vars action plugin to always follow symbolic links when traversing directories
1 year ago
Sloane Hertel bd6feeb6e7
Validate task attributes with first finalized attrs after loop (#80476)
* Validate task attributes `run_once` and `action` with finalized attrs after individual loop results

* Validate task attribute `ignore_unreachable` using individual loop results

Once there's a way to post validate only certain fields, we can use self._task.post_validate() instead

This replaces the fix introduced in https://github.com/ansible/ansible/pull/80051.
1 year ago
Matt Martz f3774ae7d4
--syntax-check is only applicable to ansible-playbook. Fixes #80506 (#80507) 1 year ago
Martin Krizek 09dd80b4ec
Last handler defined runs, fix for roles (#79558)
Fixes #73643
* clear_notification method and simplify ifs
* Deduplicate code
* Limit number of Templar creations
* Fix sanity
* Preserve handler callbacks order as they were notified
1 year ago
Martin Krizek bc3cc426bf
fetch_url: remove auto disabling decompress when gzip is not available (#80474) 1 year ago
Martin Krizek 9f0a9cf20d
get_action_args_with_defaults: remove deprecated redirected_names arg (#80473) 1 year ago
Martin Krizek 5ddd530d1d
Templar: do not add dict to globals (#80475)
All required Jinja2 versions (>=3.0) already do this, see
f9d804ead7
1 year ago
Sean Reifschneider 243aea45ce
Symbolic modes with X or =[ugo] always use original mode (#80132)
* Symbolic modes with X or =[ugo] always use original mode (Fixes #80128)

Here's what's happening, by way of this mode example: u=,u=rX

At the first step in the loop, the "u" bits of are set to 0. On the next
step in the loop, the current stat of the filesystem object is used to
determine X, not the "new_mode" in the previous iteration of the loop. So
while most operations kind of operate left to right, "X" is always going
back to the original file to determine whether to set x bit.

The Linux "chmod" (the only one I've tested) doesn't operate this way. In
it, "X" operates on the current state the loop understands it is in,
based on previous operations (and starting with the file permissions).

This is an issue with "X" and any of the "=[ugo]" settings, because
they are lookups. For example, if a file is 755 and you do "ug=rx,o=u",
file module produces 0557 and chmod produces 0555.

This really becomes a problem when you want to recursively change a
directory of files, and the files are currently 755, but you want to
change the directory to 750 and the files to 640. In chmod you can do
"a=,ug=rX,u+w" (or "a=,u=rwX,g=rX"), and have it apply equally to the
directory and the files. I can't come up with a single way in the ansible
file module to deterministically, recursively, set a directory to 750
and the contents to 640 no matter what the current permissions are,
as the code currently is.

The fix is to pass in "new_mode" to _get_octal_mode_from_symbolic_perms
in lib/ansible/module_utils/basic.py inside _symbolic_mode_to_octal. And
then take "new_mode" as an argument and use it instead of the filesystem
object stat.st_mode value.

* Fixing my new unit test, fixing bug in test comments
1 year ago
aaronk1 bf4e0166a5
Update password.py documentation (#80297)
* Update password.py documentation with new semantic markup
2 years ago
Alicia Cozine 032881e4f1
documents approaches to octal modes better (#80112) 2 years ago
Sviatoslav Sydorenko 88a380c8f0
📝 Document macOS user deletion over SSH (#80358)
Co-authored-by: Matt Clay <matt@mystile.com>
Co-authored-by: Don Naro <dnaro@redhat.com>
2 years ago
flowerysong fc5c0aadc9
Correct bypass_host_loop attribute for group_by (#80380)
This action originally bypassed the host loop, but it does not
currently.
2 years ago
Martin Krizek 12ce7d2e4e
dnf5: fix module/pkg names in the failed respawn msg (#80402) 2 years ago
Martin Krizek 8d5c250234
dnf5: use the logs API to determine transaction problems (#80401) 2 years ago
Matt Martz 6d1e355639
Only use the selectors code path when we are prompt matching (#79931) 2 years ago
Sloane Hertel 460abe0cef
Fetch signatures from galaxy after the dependency resolver runs (#80334)
Reduce the number of Galaxy API calls made during dependency resolution by fetching remote signatures afterwards, since these are not used in backtracking.

Reduce the verbosity to `-vvvv` (to match other Galaxy API calls) to see this activity.

Co-authored-by: Sviatoslav Sydorenko <webknjaz@redhat.com>
2 years ago
Geoffroy Doucet c1e19e4bdd
Fix getting timeout for get mounts facts on Linux (#79847)
* Fix how to get the gather_timeout setting while getting the
mounts facts on Linux.

Issue: #79844
2 years ago
Matt Davis 5e131a96c0
bump devel to 2.16.0.dev0 (#80390) 2 years ago
Brian Coca 4b20191c52
list all tags (including never) when listing tags (#80309)
* Ensure we default to show all tags when listing tags

 'never' was being excluded by default,as it is not part of the 'run tags'
 runtime default ('all'). For listing we now add it to the default 'run tags'.
2 years ago
tu1h 043a0f3ee8
Fix run_once by instantly tiny post_validate (#78492) (#80051)
Signed-off-by: tu1h <lihai.tu@daocloud.io>
2 years ago
Felix Fontein 0e509ecf25
Support role extension for semantic markup. (#80305) 2 years ago
Martin Krizek a81b787a05
Add new dnf5 module (#80272) 2 years ago
Sloane Hertel 666188892e
fix using templated values for include/import role FA (#80320)
* fix using templated values for include/import role options 'public', 'allow_duplicates', and 'rolespec_validate'

* pass templated values without changing the instance

* Fix templating by setting always_post_validate to True and calling IncludeRole.post_validate() instead

ci_complete

* add changelog
2 years ago
Matt Martz d2f6ea4179
New deb822_repository module (#80018)
Fixes #77073
2 years ago
Matt Martz 9faf94468b
Enforce that `Display.display` requires a `str` (#80327)
* Enforce that Display.display requires a str

* clog frag

* ci_complete
2 years ago
Jordan Borean fb6b90fe42
Improve Ansible.Basic.cs tempdir uniqueness (#80328)
* Improve Ansible.Basic.cs tempdir uniqueness

The current tempdir naming scheme can result in the same name if the
remote worker starts at the same time as another. By using the process
id it should add enough uniqueness to avoid this situation.

* Fix sanity issues

* Fix up compile issue on older hosts
2 years ago
Jordan Borean ba4505f5cb
Ansible.Basic - Improve temporary file cleanup process (#80293)
* Ansible.Basic - Improve temporary file cleanup process

* Add comment on struct value used
2 years ago
Daniel Ziegenberg 93beef053e
Improve dirname and basename filter doc (#80054) 2 years ago
Brian Coca 0fd88717c9
password lookup, handle ident properly when saved (#80251)
* password lookup, handle ident properly when saved

  Currently we format and save ident when present but we didn't account for this when reading the saved file
  Also added some more robust error handling.
2 years ago
Wong Hoi Sing Edison 016b7f71b1
ansible-galaxy - support `resolvelib >= 0.5.3, < 1.1.0` (#80196)
* ansible-galaxy - support `resolvelib >= 0.5.3, < 1.1.0`

<https://pypi.org/project/resolvelib/1.0.1> released on 2023-03-09:

-   <https://github.com/sarugaku/resolvelib/blob/main/CHANGELOG.rst#101-2023-03-09>
-   <https://github.com/sarugaku/resolvelib/releases/tag/1.0.1>

Signed-off-by: Wong Hoi Sing Edison <hswong3i@pantarei-design.com>

* Trigger CI by pinning resolvelib with latest version

Since resolvelib is pre-installed in our test containers, we should temporarily pin the latest version allowed to force the tests to run with that version. Once the tests have passed that commit can be reverted.

Please make those changes without force pushing, so that we keep the reference to the passing CI run. We can squash the commits when merging the PR so the temporary commits won't be in the final commit merged to the devel branch.

Signed-off-by: Wong Hoi Sing Edison <hswong3i@pantarei-design.com>

* https://github.com/ansible/ansible/pull/80196#discussion_r1136003637

Also test resolvelib with multiple supported versions.

Signed-off-by: Wong Hoi Sing Edison <hswong3i@pantarei-design.com>

* Revert "Trigger CI by pinning resolvelib with latest version"

This reverts commit 5518e5dbca.

---------

Signed-off-by: Wong Hoi Sing Edison <hswong3i@pantarei-design.com>
2 years ago
Felix Fontein b398613120
Add support for plugin field in seealso. (#80212) 2 years ago
Matt Martz ed4b1afc6c
Don't double loop, ensuring that machine formats don't dupe collections onto all paths (#80277)
* Don't double loop, ensuring that machine formats don't dupe collections onto all paths

* Add tests
2 years ago
Matt Martz 42355d181a
Do not double calculate loops and `delegate_to` (#80171) 2 years ago
Felix Fontein fafb23094e
ansible-doc: fix broken seealso links in text output (#80280)
* Fix broken URLs.

* Also remove auto-generated description for modules outside ansible.builtin.
2 years ago
Felix Fontein 4ea50cef23
validate-modules: check_mode attribute and compare with supports_check_mode parameter (#80090)
Co-authored-by: Brian Scholer <1260690+briantist@users.noreply.github.com>
2 years ago
Matt Martz 2ae013667e
ansible-galaxy collection install retry improvements (#80180)
* clog frag

* Fix retries so that each explicit call to _call_galaxy is retried for the correct number of attempts. Fixes #80174

* Extend retry logic to common URL related connection errors. Fixes #80170

* Extend retries to downloading artifacts

* Extend param docs for change

* Rework the exception handling

* Don't be overly broad, reduce to TimeoutError, and BadStatusLine for now

* _download_file needs to raise AnsibleError.orig_exc

* Remove unused import

* Add IncompleteRead

* Add socket.timeout for py39

* Add 502 to retry codes

* Move http error code checking first

* Use itertools.tee to replay the backoff_iterator instead of using a callable

* Actually set a CLI default of 60s for timeout, to prevent implicit galaxy from using 10s as default from Request.open

* Import typing

* fix type hints

* Use http.HTTPStatus instead of int HTTP error codes where feasible

* Split exception handling

Co-authored-by: Sviatoslav Sydorenko <wk.cvs.github@sydorenko.org.ua>

* Add missing import

---------

Co-authored-by: Sviatoslav Sydorenko <wk.cvs.github@sydorenko.org.ua>
2 years ago
Felix Fontein a2dc5fcc7d
Implement semantic markup support for Ansible documentation in ansible-doc. (#80242) 2 years ago
Ken Dreyer fc8203168e
uri: improve force_basic_auth documentation (#80211)
Add more details about what "true" and "false" mean for the
force_basic_auth setting. Give example scenarios when clients may want
to use this setting.
2 years ago
Sumanth Lingappa 0a6333f7d0
corrected class documentation (#80241) 2 years ago
Ikko Eltociear Ashimine 516cb9a52e
fix typo in plugin_docs.py (#80195)
lable -> label
2 years ago
Hugo van Kemenade 1c156c0d16
Replace deprecated BadZipfile with BadZipFile (#80198)
* Replace deprecated BadZipfile with BadZipFile

* Retain support for Python 2.7
2 years ago
Sloane Hertel 6165dfea40
ansible-galaxy role info - fix unhandled AttributeError
* catch GalaxyError instead of its base class to ensure it will have a http_error attribute
2 years ago
Harmdhast cb2180e286
Fixed typo (#80184)
`uvault` should be `unvault`
2 years ago
Sloane Hertel b7a0e0d792
copy - fix check mode with remote_src=True (#78624)
* Don't create dest directory in check mode

uncomment existing test

Fix checking for file attribute changes in check mode and add a test
2 years ago
Martin Krizek cfa7acbc19
Raise an error on invalid FA.isa value (#80040)
Avoids bad definitions of playbook classes
2 years ago
Brian Coca a1bff416ed
paramiko connection now uses the correct source of data (#79704)
* paramiko connection now uses the correct source of data

* keep orig name

* added missing port to docs

* Update changelogs/fragments/paramiko_config.yml

Co-authored-by: Sloane Hertel <19572925+s-hertel@users.noreply.github.com>

* test ansible_host templating

* added missing private_key_file

* removed all play_context fallbacks

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

Co-authored-by: Jordan Borean <jborean93@gmail.com>

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

Co-authored-by: Jordan Borean <jborean93@gmail.com>

---------

Co-authored-by: Sloane Hertel <19572925+s-hertel@users.noreply.github.com>
Co-authored-by: Jordan Borean <jborean93@gmail.com>
2 years ago
Martin Krizek 694f12d01b
Avoid redundant unsafe wrapping in ansible_eval_concat (#80143)
The wrap_var is done in do_template for all concat functions after their
return.
2 years ago
Zachary Peschke 12c1891ce6
Fix spelling and grammar in subelements filter doc (#80137) 2 years ago
Brian Coca ca604513db
apt_repository, dont assume only missing apt-key will populate stderr (#79827)
fixes #79825
2 years ago
Brian Coca ff3ee9c4bd
ansible-inventory prevent duplicating host entries (#80059)
this happened after implementing limits we introduced a bug that a host would be duplicated if it existed in a group's children
2 years ago
Klaus Frank 809727a7c7
improve password lookup syntax in examples (#80092) 2 years ago
Sam Doran 292c70368b
unarchive - log errors from underlying commands (#75329)
* unarchive - log errors from underlying commands

When a command run by the module fails, log the errors if debugging is enabled.

* Use debug() method
2 years ago
Sam Doran a56428de11
unarchive - properly handle relative path for `dest` (#75267)
* unarchive - properly handle relative path for dest

* Add integration test

* Return output of underlying commands with increased verbosity

* Revert "Return output of underlying commands with increased verbosity"

This reverts commit a2790c8275cdc5697b65670a0beffdc74b741bf6.

* Warn when a relative destination path was provided
2 years ago
Sloane Hertel b981a9dfcd
add a worker queue to get updates from the main results thread (#79886)
* Create a queue per WorkerProcess to receive intra-task updates
* Update `pause` action to use the worker queue
* Deprecate ConnectionBase()._new_stdin
* Add new `Display`  convenience method `prompt_until` to manage both controller- and worker-sourced prompting without cross-fork stdin sharing, in-worker mechanism to handle request-response over new worker queue.
2 years ago
Klaus Frank 39fd899d83
Clarify combine filter examples (#80078) 2 years ago
Yaakov Selkowitz c028006aaf
Define all processor facts on s390x (#19755) (#79806)
Signed-off-by: Yaakov Selkowitz <yselkowi@redhat.com>
2 years ago
Martin Krizek 3fd0e12571
Introduce Delegatable and Notifiable mixin classes (#80077)
* Introduce Delegatable and Notifiable mixin classes

* fix sanity

* fix sanity
2 years ago
Desmond Obisi 43aa47c2af
package_facts requires python-rpm on SUSE systems in ansible 2.12.1 (#80041) 2 years ago
Martin Krizek 6c3d2a4e51
Use FAs with inheritance only when applicable (#80026)
... and set default value of an attribute on an object
only in NonInheritableFA.

Fixes #79777

ci_complete
2 years ago
devon-mar 2f8f7fba4c
Update lookup to use positional only arg for name to avoid conflicts (#79839) 2 years ago
Miklos Sagi b7ef2c1589
ansible-playbook -K breaks when passwords have quotes (#79837)
Now only 'unquote' when ini config file is the source
2 years ago
Matt Clay 21fc699b77
Remove trailing spaces from lines in YAML (#80032) 2 years ago
Jordan Borean 1e6b8249e7
Add condition that causes a when to skip a task to output msg (#78918)
* Add condition that causes a when to skip a task

* Fix up tests

* Use false_condition instead of failed_condition

* Remove formatting accidentially added

* Fix sanity
2 years ago
Martin Krizek bd329dc543
Make using blocks as handlers a parser error (#79993)
Fixes #79968
2 years ago
Sloane Hertel 556dadba6d
user - fix comparing existing group names to group IDs (#79981) 2 years ago
Matt Clay 715ab99462
ansible-test - Improve code formatting (#79983)
* ansible-test - Add blank lines after docstrings

* ansible-test - Preserve formatting of arg pairs

* ansible-test - Remove unused string

* ansible-test - Remove pointless dict() usage

* ansible-test - Clean up initial func arg indenting

* ansible-test - Clean up constructor arg indenting

* ansible-test - Clean up func arg wrapping

* ansible-test - Clean up comma and paren placement
2 years ago
Brian Coca e2f147bcec
ansible-inventory, add --limit option (#79596)
* ansible-inventory, add --limit option

* also graph

* optimize the when not providing limit

* added tests and clog

* avoid empty groups, fix tests

* i swear there as an ignore_errors there already!!?!?!?

* Fix stdout test fallback

Co-authored-by: Sloane Hertel <19572925+s-hertel@users.noreply.github.com>

* simpler approach using subset against inventory directly

* tyupose

* renamed funciton to what it actuall does
got yaml in line with others about removing empty groups

* have graph ignore limts, also note same for --host

* fixed typo long line

* better test

* cause hosvars are not a thing

---------

Co-authored-by: Matt Davis <6775756+nitzmahone@users.noreply.github.com>
Co-authored-by: Sloane Hertel <19572925+s-hertel@users.noreply.github.com>
2 years ago
Matt Clay 71f2e777ed
Update mypy to version 1.0.0 (#79963) 2 years ago
Sebastian Gumprich b5ff981369
Change `yes` to `true` in uri-module (#79934) 2 years ago
Martin Krizek d43d8274b1
Remove unneeded fallback code for nested defined/undefined tests (#79960)
* Remove unneeded fallback code for nested defined/undefined tests

The code used to handle defined/undefined tests on objects containing
nested undefined variables. Due to changes in lazy evalution of Jinja2
expressions it is no longer needed, see #56116.
2 years ago
Matt Martz 243d1b5e3d
Replace deprecated stacked `@classmethod` and `@property` (#79952) 2 years ago
Martin Krizek 09e0fb3516
Change ansible_job_id format (#79951)
* Change ansible_job_id format

...to be something that does not resemble float or other type which
value could be changed by literal_eval that jinja2_native uses.

Specifically the format of '%d.%d' is converted from str to float and
then back to float which may result in truncating the number resulting
in the job not being found because the job id does not exist.
2 years ago
Matt Davis e1d298ed61
don't ignore templated _raw_params that k=v parser failed to parse (#79913)
fixes #79862
2 years ago
Matt Clay 2525d0a136
basic.py - Perform Python version check earlier (#79954) 2 years ago
Matt Clay e6900f5cad
pycompat24 - Remove support for Python <= 2.5 (#79953) 2 years ago
Sloane Hertel fcdd7493ae
improve password_hash warning for unsupported algorithms (#79872)
* password_hash - give a warning for unsupported algorithms (that raise a TypeError)

* add suggested changes, a test and changelog
2 years ago
Matt Clay 9d65e122ff
Fix detection of available hashlib algorithms (#79946)
* Fix detection of available hashlib algorithms

Detection of hashlib algorithms now works on Python 3.x.
The new implementation works on Python 2.7 and later.

Test coverage is provided by both integration and unit tests.

* Add additional details about hashlib in docs
2 years ago
Matt Clay 716631189c
Fix "pointless" strings detected by pylint (#79943)
Convert these strings to comments, since they are not valid docstrings.
2 years ago
Matt Clay 02f6e40534
Clean up pointless statements (#79941)
* Add ignores for intentional pointless statements

* Remove redundant docstring

* Fix function docstring placement
2 years ago
Sloane Hertel fa1564c548
include_vars - document hash_behaviour + dir (#79790)
* document that hash_behaviour does not apply to individual files of variables when using the dir option

* add tests
2 years ago
Mateus Rangel 32672c6326
Improving the RETURN and its docs on the apt_repository module (#79658)
* Improving the documentation on how we generate the default value of the filename parameter

* fix pep8

* removing unnecessary documentation and improving the module's return

* making the RETURN docs

* pep8

* version_added and changelog

* module._diff

* module._diff fix

* add rudimentary tests for new outputs

---------

Co-authored-by: Matt Davis <mrd@redhat.com>
2 years ago
Sloane Hertel ce6e53e1f6
Remove another unwanted comma from pause action (#79926) 2 years ago
Matt Clay 379058e10f
Update collections.abc imports (#79911)
* Update `collections.abc` imports

- Use `six.moves` for modules and module_utils
- Use `collections.abc` for controller code

This avoids using `ansible.module_utils.common._collections_compat`,
which was added before the vendored `six` was updated to provide these
imports.

* Update _collections_compat to use six.moves

Also update the custom pylint rule to reflect this change.
2 years ago
Matt Clay 3b4f3c066a
Ignore necessary unused imports in module_utils (#79904) 2 years ago
Matt Clay 9e2aad6e51
Remove unwanted comma from pause action (#79908) 2 years ago
Matt Clay 51fadd0aac
Clean up unused imports in plugins (#79899) 2 years ago
Matt Clay 833909ac19
Clean up unused imports in core (#79900)
* Clean up unused imports in core

* Add changelog fragment
2 years ago
Matt Clay b3307f1aa7
Remove unused stdlib imports from module_utils (#79905) 2 years ago
Matt Clay 639e3e30d7
Remove unused internal imports from module_utils (#79906) 2 years ago
Matt Clay 2fa8ee503c
Clean up unused imports in modules (#79898) 2 years ago
Matt Clay d637e87a9e
user - Remove invalid return docs (#79891) 2 years ago
Matt Martz 0a00263a53
Use arg validation in debug action (#79866)
* Use arg validation in debug action. Fixes #79862

* Add clog frag

* Move the msg default into the argspec
2 years ago
Konrad Gawda 1c01eab3fb
Remove irrelevant line (#79865)
Remove irrelevant comment line form example code
2 years ago
Bartłomiej Kida 0ab53aefc9
Update dnf.py (#79679) 2 years ago
Tabah Baridule M 913e4863af
Description for changing User ID to match user value (#79470) 2 years ago
Jordan Borean 652a74e087
AddType - Support compiling with /unsafe C# code (#79853)
* AddType - Support compiling with /unsafe C# code

* Update Ansible version in docstring
2 years ago
Matt Clay 83fe75db07
Ansible.Basic.cs - Fix compile error on PS 7.3.x (#79848) 2 years ago
Hofer-Julian 6cd1a1404a
docs: Extend password entry of ansible.builtin.user (#79694)
* docs: Extend password entry of ansible.builtin.user

Clarify that `password` sets the password hash.
Not the actual password.
Fixes part of  #79684
2 years ago
Sloane Hertel 321848e98d
fix installing collections from git repos that contain MANIFEST.json (#79808)
* add null 'manifest' key to metadata for git repo collections containing MANIFEST.json

changelog

* set to Sentinel instead of None

* Test installing a collection in a git repo that contains a MANIFEST.json

* fix test

* Update changelogs/fragments/ansible-galaxy-install-git-src-manifest.yml
2 years ago
Matt Clay 27cd5e77d8
Update mypy and its dependencies. (#79812)
* Update mypy and its dependencies.

* Fix requirements.

* Remove unnecessary matching constraints.
2 years ago
Brian Coca 281474e809
strategy fix invalid variables being registered (#79706)
also added tests for normal and bad cases
2 years ago
Matt Clay 330af433f3 Use `raise ... from` instead of `six.raise_from` 2 years ago
Martin Krizek 10eda5801a
Fix conditionally notified include handlers (#79804)
Fixes #79776

ci_complete
2 years ago
Martin Krizek 4f5ed24972
Fix traceback in template action with ANSIBLE_DEBUG=1 (#79764)
Fixes #79763
2 years ago
Felix Fontein 8a7185c224
Argument spec alias handling: actually report deprecated aliases in suboptions, and fix warning message in suboptions when two aliases of the same option are used (#79740)
* Normalize deprecation records.

* Fix alias deprecations in suboptions.

* Report in which option an alias warning happened for suboptions.

* Add deprecation tests for suboptions.

* Also test deprecation in list of dicts.

* Adjust unit tests for toplevel alias deprecation field name change.
2 years ago
Carsten Grohmann 6c0559bffe
Show filename additionally if missing secrets prevents decryption (#79732)
Fixes #79723
2 years ago
antonc42 cf50d8131f
Fix regex filter docs (#79736)
* Fix notes in regex_replace doc

The documentation says that this maps to 'regex.replace' when it should say 're.replace'. The distinction is important because of the third-party 'regex' module that has more features than the built-in 're' module. https://pypi.org/project/regex/

* Fix notes in re.search docs

The documentation says that this maps to 'regex.search' when it should say 're.search'. The distinction is important because of the third-party 'regex' module that has more features than the built-in 're' module. https://pypi.org/project/regex/
2 years ago
Hofer-Julian b756a08d89
Truthy value should be one of false or true (#79730)
Otherwise ansible-lint complains: https://yamllint.readthedocs.io/en/stable/rules.html#module-yamllint.rules.truthy
2 years ago
Felix Fontein 1a47a21b65
Fix reporting of deprecated arguments for modules. (#79681) 2 years ago
Martin Krizek e38b3e64fd
Correctly count rescued tasks in play stats (#79724)
Fixes #79711

ci_complete
2 years ago
Matt Martz 74cdffe30d
Better json content type detection for uri (#79719)
* Better json content type detection for uri

* typo
2 years ago
Matt Martz 2143bcd6b1
Ensure we are passing ciphers to all url_get calls (#79718)
* Ensure we are passing ciphers to all url_get calls. Fixes #79717

* Add clog frag

* Fix tests
2 years ago
Felix Fontein 50a673f9e7
normal action plugin: remove superfluous code (#79690)
* Remove obsolete 'if'

The result dict returned by super.run() will never have a 'skipped' entry.
Without the if, it is more clear that wrap_async is actually defined at the end of the function.

* Remove more dead code.

The result dict will also not contain invocation.

* Remove notes.
2 years ago
Rune Juhl Jacobsen 602824db1d
Fix broken reference to FAQ (#79621) 2 years ago
Matt Martz 56d142350d
Add support for importlib.resources (#78915)
* Add support for importlib.resources

* Remove the importlib.resources imports

* return the correct data

* Some code comments, and re-order for consistency

* Disallow traversing packages below an individual collection

* Add a traversable class for namespaces

* Re-use variable

* Utilize itertools.chain.from_iterable

Co-authored-by: Sviatoslav Sydorenko <wk.cvs.github@sydorenko.org.ua>

* Simplify logic to check for packages from ansible loaders

Co-authored-by: Sviatoslav Sydorenko <wk.cvs.github@sydorenko.org.ua>

* Just a generator expression, instead of a generator

* docstrings

* Add comment about find_spec for our namespaces

* Add some initial unit tests for importlib.resources

* normalize

* Utilize importlib.resources for listing collections

* collections_path is already in config, just use config

* install uses a different default for collections_path

* Remove unused import

* Remove duplicate __truediv__

* Bring back TraversableResources

* Apply some small suggestions from code review

Co-authored-by: Sviatoslav Sydorenko <wk.cvs.github@sydorenko.org.ua>
Co-authored-by: Matt Davis <6775756+nitzmahone@users.noreply.github.com>

* Remove cross contamination between plugin loader code and CLI code

* Remove unused import

Co-authored-by: Sviatoslav Sydorenko <wk.cvs.github@sydorenko.org.ua>
Co-authored-by: Matt Davis <6775756+nitzmahone@users.noreply.github.com>
2 years ago
Sloane Hertel b5b239fd71
fix role argument spec error for invalid suboptions (#76578)
fixes https://github.com/ansible/ansible/issues/75536
2 years ago
Sloane Hertel acbf4cc60e
ansible-galaxy - fix turning off the ConcreteArtifactManager's validate certs at the global level (#79561)
Fix ignoring certs when downloading tarballs

Fix ignoring certs when downloading a collection from a specific source that isn't in the configured servers list
2 years ago
Sloane Hertel fd325c00bd
ansible-galaxy collection|role init - fix preserving symlinks (#79134)
* Preserve symlinks in custom role/collection skeletons

* changelog
2 years ago
Olaf Klischat 32c5793de5
systemd: ignore errors in daemon_reload and daemon_reexec when running in a chroot or with $SYSTEMD_OFFLINE==1 (#79643)
Signed-off-by: Olaf Klischat <olaf.klischat@gmail.com>
2 years ago
evangelionlion 6f8c1da0c8
correct the mistake of example repeat_original (#79659)
there is a little mistake 


##### ISSUE TYPE
- Docs Pull Request

+label: docsite_pr
2 years ago
Jonathan Rietveld 4a29591b98
Fix a typo in the warning message (#79635) 2 years ago
jbreitwe-rh 38cedc7f1a
Fixed incorrect spelling of the word overridden. (#79620) 2 years ago
Brian Coca b7e948e623
filter/test plugin listing, fix bug on file sorting (#79591)
* filter/test plugin listing, fix bug on file sorting

avoid legacy/builtin special casing for 'all'
2 years ago
Rafał Osiecki 0f01c69f1e
Update split.yml (#79570)
typo fix
2 years ago
Martin Krizek 60f76436c1
Simplify AnsibleJ2Vars by using ChainMap for vars (#78713)
Co-authored-by: Matt Martz <matt@sivel.net>
2 years ago
Thomas Poindessous 6a7fb7d2ab
fix: broken link (#79461) 2 years ago
zitatorocsik bc13099e56
fixed misleading setup example (#79495) 2 years ago
Sloane Hertel 11e43e9d6e
Set locale for python apt (#79546)
* set locale to get_best_parsable_locale for the python-apt API

* add a test case

* add changelog

* remove test that tests nothing
2 years ago
Matt Davis 1424484be0
Prevent stdio deadlock in forked children (#79522)
* background threads writing to stdout/stderr can cause children to deadlock if a thread in the parent holds the internal lock on the BufferedWriter wrapper
* prevent writes to std handles during fork by monkeypatching stdout/stderr during display startup to require a mutex lock with fork(); this ensures no background threads can hold the lock during a fork operation
* add integration test that fails reliably on Linux without this fix
2 years ago
Brian Coca 5b51b560d0
Removed sorting to preserve original order (#74839)
updated tests to reflect new order
2 years ago
Matt Martz 1998521e2d
Always create new role (#78661)
Don't use role cache for determining whether to create a new instance of role
2 years ago
Martin Krizek 3bda4eae6f
Fix repr(Task) to check action when testing for a meta task (#79464)
Fixes #79459
2 years ago
Sloane Hertel 01ff57bdff
add ansible-galaxy cli documentation for parallel execution (#79433)
* add ansible-galaxy cli documentation for parallel execution

Co-authored-by: saranti <tsarantis@proton.me>

* Update lib/ansible/cli/galaxy.py

* Update lib/ansible/cli/galaxy.py

Co-authored-by: Sviatoslav Sydorenko <wk.cvs.github@sydorenko.org.ua>

Co-authored-by: saranti <tsarantis@proton.me>
Co-authored-by: Sviatoslav Sydorenko <wk.cvs.github@sydorenko.org.ua>
2 years ago
Gaudenz Steinlin c33a782a9c
Fix password lookup rewrites file when using encrypt (#79431)
* Remove unused mock from test_password_already_created_encrypt

The _get_paths mock is never used in the
test_password_already_created_encrypt test case.

* Add test to assert the password file is not rewritten

If the password file already contains the salt and the hasing algorithm
does not use the ident parameter, the password lookup should not write
to the password file.

* Fix "changed" if using "encrypt" in password lookup

When using the "encrypt" parameter to the password lookup without the
ident parameter, the password file was always marked as "changed". This
caused the file to be rewritten with the same content. This is fixed by
only marking the file as changed, if an "ident" value needs to be added
to the file.

Fixes #79430.

Add changelog entry
2 years ago
sbettid 3936b5c471
Fix file touch check mode result (#79360) (#79422)
Fixes #79360
2 years ago
Maxwell G ab76916b14
galaxy: Add license_file to manifest directives (#79420)
* galaxy: Add license_file to manifest directives

* ag collection build: Test license handling

This adds tests to ensure that
    - REUSE licensing files: .reuse/dep5, LICENSES/*, anyfile.license
    - galaxy.yml license_file
are always included in the manifest.
2 years ago
Brian Coca 5f3a6b78db
local connection: avoid tb when running in container with invalid user (#79414)
* local connection: avoid tb when running in container with invalid user

* clog

* cannot use uid, leave empty and ~/ will resolve itself

* get back to what it did
2 years ago
Christian Loos f79a54ae22
Update vendored distro (#79227)
Commit bb35d41 in branch python2.7-support from 2022-10-10:
https://github.com/python-distro/distro/commit/bb35d41
2 years ago
Brian Coca 505b29b2a9
more strftime docs (#79417)
* more strftime docs

fixes #79397
Co-authored-by: Matt Martz <matt@sivel.net>
Co-authored-by: Don Naro <dnaro@redhat.com>
Co-authored-by: Sloane Hertel <19572925+s-hertel@users.noreply.github.com>
2 years ago
Wong Hoi Sing Edison b148fd8dd7
ansible-galaxy - support ``resolvelib >= 0.5.3, < 0.10.0`` (#79399)
* Upgrade `resolvelib >= 0.5.3, < 0.10.0`

https://pypi.org/project/resolvelib/0.9.0/ released on 2022-11-17:

  * https://github.com/sarugaku/resolvelib/blob/master/CHANGELOG.rst#090-2022-11-17
  * https://github.com/sarugaku/resolvelib/releases/tag/0.9.0

Signed-off-by: Wong Hoi Sing Edison <hswong3i@pantarei-design.com>
2 years ago
Brian Coca 1bda6750f5
fix reject list (#79391) 2 years ago
Matt Martz 942bcf6e7a
Add manifest includes for reuse licenses (#79403)
* Add includes for reuse licenses

* Add additional exludes to follow REJECT_EXTS

* clog frag
2 years ago
Matt Martz d925ece764
Allow pip like version syntax for installing collections (#79405) 2 years ago
seachanged 6cec31574f
Update fileglob.py (#78887)
Improve documentation for relative file paths
2 years ago
Joseph Shraibman f089aae5ee
Clarify that b64decode does not work with binary output (#79294) 2 years ago
faust 0a2b96f402
typos (#79377) 2 years ago
saranti b7ea661807
Update pull.py (#79387) 2 years ago
Rabi Mishra 6059116a64
Replace _valid_attrs with fattributes (#79376)
It was missed in one place it seems.
2 years ago
Felix Fontein 1705ec98cd
ansible-doc and validate-modules: remove underscore deprecation handling for collections (#79362)
* Remove underscore deprecation handling for collections.

* Also consider ansible.legacy.
2 years ago
Brian Coca 3448fcabc5
file lookup now works with general lookup error framework (#79339)
* file lookup now works with general lookup error framework
2 years ago
Tom Page d72326b6af
Allow force deletion of group (#78172)
* Allow force deletion of group

* Update version_added

Co-authored-by: Jordan Borean <jborean93@gmail.com>
2 years ago
Darshan eae42ec57e
openbsd factgs, use physmem instead of usermem for total mem (#79316)
Signed-off-by: darshanip <darshancoding@gmail.com>
2 years ago
stmps 4759590467
Move collection playbook output from "warning" to "-v" (#79320)
* lib/ansible/executor/playbook_executor.py: fix minor typo in comment

* lib/ansible/executor/playbook_executor.py: move 'running playbook inside collection' from warning to -v debugging output
2 years ago
Louis Mandel 0ae963a311
Add missing type to the `reference` option of the documentation of the `git` module (#79305)
* Add missing type to the `reference` option of the `git` module

* No more doc-missing-type error in validate-modules
2 years ago
Felix Fontein 2a03c8028e
Fix typo 'Ansbile'. (#79318) 2 years ago
Sloane Hertel f700047e69
blockinfile - document multiline marker behavior (#79292) 2 years ago
inifares23lab e2450d4886
added --allow-change-held-packages for apt remove (#78203)
* added --allow-change-held-packages for apt remove

* add tests for apt remove (allow_change_held_packages=yes)

* add changelog for apt remove (allow-change-held-packages=yes)

* update tests for apt remove (allow_change_held_packages=yes)
2 years ago
Jordan Borean 6def4a3180 Fix up sanity problems 2 years ago
Alicia Cozine bfcb557777
replace yes/no with true/false in docstrings (#79274)
Co-authored-by: Alicia Cozine <acozine@users.noreply.github.com>
2 years ago
Felix Fontein 6e379e5d65
validate-modules: do not treat falsy non-`False` defaults as `None` (#79267)
* Do not treat falsy non-False defaults as None.

* Fix various instances of this in modules.

* Add changelog fragment.
2 years ago
Alex Willmer 6d9e2bc5e9
De-duplicate initialisation of ConnectionBase._connected (#79256)
The same value is unconditionally set 4 lines down.
2 years ago
Brian Coca 0f18ddca9f
mention acl in permissions errors (#79209)
as chmod/mode is not the only thing we attempt and Ubuntu not shipping acl
  in newer versions can lead to some confusion

  fixes #79146
2 years ago
Brian Coca aaab0791d9
File lookup handle missing file more gracefully (#79230)
previously it would have a 2nd tb due to bad error raising
 also remove superfluous warning
2 years ago
Kenyon Ralph 0bacea70c4
plugins/lookup/pipe: docs typo fixes (#79222) 2 years ago
Sloane Hertel da3a7618ba
give a warning when no roles match the search instead of returning rc 1 (#79195)
* give a warning when no roles match the search instead of returning rc 1

* porting guide note

* Update docs/docsite/rst/porting_guides/porting_guide_core_2.15.rst

Co-authored-by: Sviatoslav Sydorenko <wk.cvs.github@sydorenko.org.ua>
2 years ago
prasadpatil49 465480f755
documentation fix for file module 78988 (#79182) 2 years ago
Sandra McCann bcdc2286e8
Revert "Fix yum exclude example to align to parameter doc (#79128)" (#79179)
This reverts commit 062315ecaa.
2 years ago
Bart Dorlandt 1182059d46
Setting indentation correctly in the Example section (#79072) 2 years ago
Olivier Clavel 062315ecaa
Fix yum exclude example to align to parameter doc (#79128) 2 years ago
Sloane Hertel 89d682464b
Fix isinstance check (#79159)
Use GalaxyAPI for isinstance check instead of RoleDistributionServer, since the latter is defined in __main__ sometimes (when running integration tests or ansible-galaxy from source) and importing from ansible.cli.galaxy won't reference the same object.
2 years ago
Brian Coca f66016df0e
copy, avoid moving non temp remote 'non' files (#79102)
* copy, avoid moving non temp remote files that are not dirs/files
fix tests
2 years ago
Sloane Hertel cb2e434dd2
ansible-galaxy install - fix unnecessary api check when installing a role from git repo (#79090)
* delay server api evaluation until a GalaxyRole needs to make an api call for info, list, and install
2 years ago
Don Naro 8d94a95ccf
Docs: file parameter import_tasks and include_tasks (#79077)
* issue #79022 file parameter import_tasks and include_tasks

* adding details back

* Update lib/ansible/modules/import_tasks.py

Co-authored-by: Felix Fontein <felix@fontein.de>

* Update lib/ansible/modules/include_tasks.py

Co-authored-by: Felix Fontein <felix@fontein.de>

* use pipe as in original version

Co-authored-by: Felix Fontein <felix@fontein.de>
2 years ago
Matt Martz f53dbf90ea
Don't assume column index for netmask and broadcast (#79121)
* Don't assume column index for netmask and broadcast. Fixes #79117

* fix typo
2 years ago
Martin Krizek d34b578685
jinja2_native: preserve quotes in strings (#79119)
Fixes #79083
2 years ago
Sloane Hertel f9cb679675
compile role with all parents in the dep chain (#79079)
fix inheriting from parents when role depth exceeds 3

Fixes #47023
2 years ago
mtoivo cc2e7501db
Disable IP address lookups in iptables -module when listing (#78828)
* add --numeric to list

Co-authored-by: Mikko Toivola <mikko.toivola@insta.fi>
2 years ago
Brian Coca 5d253a1380
fix password lookup's use of f=v settings (#76551)
update tests
2 years ago
Martin Krizek 58637702b4
Cache field attributes list on the playbook classes (#79091)
* Cache field attributes list on the playbook classes
2 years ago
Abhijeet Kasurde a48c442275
Misc Typo fixes (#79088) 2 years ago
Sloane Hertel eecc4046e8
Fix empty str defaults in config/base.yml (#77733)
* fix empty str default for config/base.yml config options by rendering '' instead of ``''``

Co-authored-by: Brian Coca <bcoca@users.noreply.github.com>
2 years ago
Sloane Hertel e208fe5932
copy module - fix copying directories recursively with remote_src=True (#76997)
* copy module - fix copying directories containing modified subdirs with remote_src=True. Previously, the first changed subdir would prevent recursively checking for changes for in subdirs at the same level.

* Fix reporting changed for copying empty directories with remote_src=True. If a directory is created on the remote but nothing else, changed is True.
2 years ago
Brian Coca 27ab589ee8
ansible-config, only subvalues should use yaml shorthand (#79073)
* ensure we only use shorthand for assigned values

* fix ansible-config std display

* split baby

* killed offending whitespace

* moved to func instead

* the revenge of whitespace
2 years ago
Brian Coca fcea07bbef
Custom salt for ansible-vault encrypt (#79063)
* Custom salt for ansible-vault encrypt

  add VAULT_ENCRYPT_SALT config
  add salt testing


Co-authored-by: Abhijeet Kasurde <akasurde@redhat.com>
Co-authored-by: Piotr Stawarski <p@stawarski.pl>
2 years ago
sbettid 8cf7a0d3f0
Fix collection install from source respects symlinks (#78983)
* Fix installation from source transforms symlinks of dirs to empty dirs

* Add test to check symlinks to dirs are respected when installing from source

* Add changelog for collection install from source symlink to dirs issue
2 years ago
Matt Martz 420564c5bc
Ensure that we do not squash keywords in validate (#79049)
* Ensure that we do not squash keywords in validate. Fixes #79021

* become_user: nobody should only apply to the test tasks, not the setup_test_user role

* Update how become_user is specified

* Add test to ensure keyword inheritance is working for become

* Add clog frag

* Cache fattributes to prevent re-calculation

* ci_complete

* Remove unnecessary getattr
2 years ago
Donatas Abraitis 11c1777d56
facts: List all local (scope host) IP address ranges (#79018)
After changes:
```
        "ansible_locally_reachable_ips": {
            "ipv4": [
                "127.0.0.0/8",
                "127.0.0.1",
                "192.168.0.1",
                "192.168.1.0/24"
            ],
            "ipv6": [
                "::1",
                "fe80::2eea:7fff:feca:fe68",
                ...
            ]
        },
```

192.168.1.0/24 is a local prefix, where any IP address inside this range
is reachable locally (or outside this host if this prefix is announced via
EGP/IGP).

Signed-off-by: Donatas Abraitis <donatas.abraitis@hostinger.com>
2 years ago
Martin Krizek e1daaae42a
Fix using FQCN for flush_handlers (#79057)
Fixes #79023
2 years ago
Leo Ochoa f8f1c6a6b5
Add password_hash filter and fix some nits (#78743)
Co-authored-by: Abhijeet Kasurde <akasurde@redhat.com>
2 years ago
Matt Martz 44581289e8
Use python re to parse service output instead of grep (#79015)
* Use python re to parse service output instead of grep. Fixes #78541

* Add clog frag

* Add an extra guard to abort if rc is 4, and /etc/init.d is missing
2 years ago
Brian Coca ff6e4da36a
fixes to FA inheritance (#78990)
finalized applies to all field attributes
fix getting parent value
also remove unused/needed extend/prepend signature
moar testing
2 years ago
Dmytro Khomutnyk b5db71e318
ansible-vault: add newline to the output of the 'encrypt_string' command (#79017)
* ansible-vault: add newline to the output of the 'encrypt_string' command

* Add comment with issue description and improve string joining

* Add changelog fragment

* Update changelogs/fragments/79017-ansible-vault-string-encryption-ending-with-newline.yml

Co-authored-by: Sviatoslav Sydorenko <wk.cvs.github@sydorenko.org.ua>

* Fixed some typos in changelog fragment

* Improve comment regarding newline character at the end of file

Co-authored-by: Sviatoslav Sydorenko <wk.cvs.github@sydorenko.org.ua>

Co-authored-by: Sviatoslav Sydorenko <wk.cvs.github@sydorenko.org.ua>
2 years ago
Felix Fontein 6d0aeac1e1
Do not crash templating when filter/test name is not a valid Ansible plugin name (#78913)
* Do not crash templating when filter/test name is not a valid Ansible plugin name.
* Store and re-raise KeyError if there was one.

Co-authored-by: s-hertel <19572925+s-hertel@users.noreply.github.com>
2 years ago
Brian Coca 9650ddb11c
omit keyword should reset to context (#78917)
* omit keyword should reset to context

  ensure we use context/inheritance when calculating value,
  using default only when context is unavailable.

  fixes #75692
2 years ago
Jasper cee9872605
apt_key, fix example indentation
Co-authored-by: Matt Clay <matt@mystile.com>
2 years ago
Jordan Borean ba6da65a0f
Fix connection/become task loop settings (#78565)
* Fix connection/become task loop settings

* Remove old code
2 years ago
Matt Martz c3fc8db41c
Deprecate using a list of dicts for vars. See #78920 (#78927) 2 years ago
Joel McGuire ae66d9a1f4
Fixed spelling (#78911) 2 years ago
Brian Coca 0b678d5036
avoid roles exporting vars: (#69040)
- correct 'vars:' precedence to allow phasing out of include_params
 - actually merge vars and always include role_vars
 - avoided dupe deps from giving wrong vars
 - use 'first' instance of dep as others are from previous instances/invocations
   and can have diff values for vars
 - ensured deps only provide exportable vars themselves
 - added COMMENTS
 - added tests
 - apply export restrictions setting to defaults
 - use 'public' as cutoff

Co-authored-by: Sloane Hertel <19572925+s-hertel@users.noreply.github.com>

ci_complete
2 years ago
Felix Fontein 3423a6609f
Fix docs for new commonpath and normpath filters (#78897) 2 years ago
Brian Coca 4b0697ee03
make pager and editor configurable, specifically for ansible (#78816)
* make pager and editor configurable, specifically for ansilbe

  fallback on common ways to configure
2 years ago
Brian Coca c7cde2645d
apt_repository, handle both new/old gpgp stds (#78735)
* apt_repository, handle both new/old gpgp stds
2 years ago
Brian Coca 7acd4f75c0
apt module, prevent tb from invalid type for pkg (#78666)
* apt module, prevent tb from invalid type for pkg

 see #78663
2 years ago
Brian Coca 95236c5569
slight var loading optimization (#78835)
Avoid having to recalculate these values since they don't change from first access
2 years ago
Oskar Ahner 3515b3c5fc
winrm - fix reducing 'Read timed out' error (#78869)
* winrm - fix reducing 'Read timed out' error

This fix reduces the exceptiopn 'Read timed out. (read timeout=nnn)' occurring seemingly randomly and
unpredictable on some networks (which have long latency and/or many hops or other problems). The fix
ensures that the involved timeout is set to a value so this issue is reduced.

* Add changelog fragment

Co-authored-by: Jordan Borean <jborean93@gmail.com>
2 years ago
Shivam Durgbuns 6e949d8f5d
Added normpath filter (#78894)
Signed-off-by: Shivam Durgbuns <sdurgbun@redhat.com>
2 years ago
Brian Coca 7c4d5f5099
documented windows filters (#78876)
* documented windows filters

Co-authored-by: Felix Fontein <felix@fontein.de>
Co-authored-by: Sandra McCann <samccann@redhat.com>
2 years ago
Shivam Durgbuns 8444d47b11
Adding two new os.path filters and its docs (#78794)
* Adding two new os.path filters and its docs

Signed-off-by: Shivam Durgbuns <sdurgbun@redhat.com>
2 years ago
Brian Coca 4115ddd135
plugin loader fix existing config testing (#78859)
create specific function to find config entry to avoid repopulating constantly
2 years ago
Felix Fontein 9aa9b4eac0
Improve filter docs (#78839) 2 years ago
sbettid de4ff281ab
Fix known_hosts changed status when removing non-existing key (#78748)
* Ensure no change is reported when removing missing key for host with other keys

Co-authored-by: Matt Martz <matt@sivel.net>
2 years ago
Olivier Clavel f8f76c5886
Update yum.py (#78829)
##### SUMMARY
The entire yum command should be highlighted, not only its options.


##### ISSUE TYPE
- Docs Pull Request

+label: docsite_pr
2 years ago
Martin Krizek 228d25a321
Remove deprecated ANSIBLE_COW_WHITELIST/cow_whitelist (#78831)
Fixes #78819
Fixes #78820
2 years ago
Martin Krizek d514aeb2a1
Remove deprecated ANSIBLE_CALLBACK_WHITELIST/callback_whitelist (#78830)
Fixes #78821
Fixes #78822
2 years ago
Matt Martz 76b746655a
Add `use_rsa_sha2_algorithms` option for paramiko (#78789)
Fixes #76737
Fixes #77673

Co-authored-by: Matt Clay <matt@mystile.com>
2 years ago
Matt Martz 1b47def5ed
Add ssh_args and friends back, add var for proxy_command (#78826)
Fixes #78750
2 years ago
Matt Martz f8e8326437
Bump devel to 2.15.0.dev0 (#78817) 2 years ago
Brian Coca 3b937123d2
final docs for filters (#78800)
Co-authored-by: Felix Fontein <felix@fontein.de>
2 years ago
Brian Coca b1ff0f4ebc
vault secrets file, keep context when symlink (#78734)
* vault secrets file, keep context when symlink

	fixes #18319

Co-authored-by: Sloane Hertel <19572925+s-hertel@users.noreply.github.com>
2 years ago
Sloane Hertel a02e22e902
Add --offline option to 'ansible-galaxy collection install' (#78678)
* Add --offline option to 'ansible-galaxy collection install' to prevent querying distribution servers

This allows installing/upgrading individual tarfiles to have dependency resolution.
Previously needed to be done manually with --no-deps or else all collections and dependencies needed to be included in the requirements.

Co-authored-by: Sviatoslav Sydorenko <wk.cvs.github@sydorenko.org.ua>
2 years ago
Felix Fontein 813c25eed1
plugin docs: look at all potential sidecar docs extensions before giving up (#78788)
* Look at all potential sidecar docs extensions before giving up.

* Do not process Python files twice.
2 years ago
Ruediger Pluem 1d410ca700
Fix local facts unreadable (#76095)
* Catch exceptions during stat calls

If such an exception is not caught it causes the complete
local facts gathering to fail.
2 years ago
Felix Fontein 9b8e60c36d
While the Python function is called ismount, the filter has the names mount and is_mount. (#78792) 2 years ago
Markus Opolka 616ad883ad
Add OSMC to Debian OS_FAMILY_MAP (#78778)
* Add OSMC to Debian OS_FAMILY_MAP

 - os_family fact of the Debian-based OSMC distribution was not detected correctly

* tweak changelog

Co-authored-by: Matt Davis <6775756+nitzmahone@users.noreply.github.com>
2 years ago
Sloane Hertel f26f3325ba
apt - fix module short-circuiting when a package is not installed and only_upgrade is True (#78790) 2 years ago
Sloane Hertel 4b45b4b09d
apt - fix failure when package is not installed and only_upgrade=True (#78781)
* apt - fix module failure when package is not installed and only_upgrade is True

* changelog
2 years ago
Sloane Hertel 86b86398f0
add ansible_name/ansible_aliases attrs to plugin objects (#78700)
*  new _fqcn attribute to plugin objects
* unbreak plugins in subdirs
* Fix inadventent changes to _load_name and use existing vars
* add plugin aliases and name property, and replace plugin._load_name where incorrect
* Fix listing plugin names

Fix listing legacy and builtin together
test deprecated plugin documentation
fix doc extensions
remove sometimes inaccurate _load_name handling from plugin.name

* Add tests for REJECT_EXTS and doc extensions

Fix unpredictable collection redirects so non-fqcns in the redirect list are guaranteed to be legacy (instead of determined by the collections keyword)

Move aliases and name properties to _update_object so all plugin types, including doc fragments, can use them

* make legacy plugin names internally consistent
* rename attributes to ansible_name and ansible_aliases
2 years ago
Felix Fontein cbffb77f57
Document some more filters (#78548) 2 years ago
Ronan f50ff1c2db
Fix Issue #78564 (#78741) 2 years ago
wnjuguna 952ee88f33
Documented connection parameters required to enable scp (OpenSSH >=9.0) (#78745) 2 years ago
Sorin Sbarnea 9f16bdbdda
Ensure syntax check errors include filenames (#77679)
This fixes bug which prevents identification of broken playbook when
passing multiple playbooks as arguments, something that is common
especially with `--syntax-check`.

Affects: ansible-lint
2 years ago
Felix Fontein 695c48957d
Fix test docs (#78756) 2 years ago
Martin Krizek 8090ee3e78
post_validate LoopControl (#75715)
avoid having to template/post_validate each part of the object
2 years ago
Sloane Hertel 563f3ecc11
Error for context-dependent redirects (#78755) 2 years ago
David Moreau Simard 86ab63f281
Recover unix load average into an ansible_loadavg fact (#75319)
* Recover unix load average into an ansible_loadavg fact

The average load is available out of the box with os.getloadavg().
It adds useful context to the existing ansible_memory_mb and ansible_mounts
facts that provide size and utilization or memory and disk space.

* Add an integration test
2 years ago
Martin Krizek a6d4c3ff7c
Print skip reason for skipped meta tasks instead of an empty msg in -vv (#78681)
Fixes #77315
2 years ago
Artur a26c325bd8
uri: added use_netrc argument to allow ignoring netrc (#74397) (#78569) 2 years ago
Matt Martz b8025ac160
Allow selection of TLS/SSL ciphers (#78650)
* Allow selection of TLS/SSL ciphers. Fixes #78633
* Never pass None as the password. Fixes #53373
2 years ago
Felix Fontein fa093d8adf
ansible-doc: remove manual formatting (#78668)
* remove manual formatting and make the output align closer with the original YAML

Co-authored-by: Brian Coca <brian.coca+git@gmail.com>
2 years ago
Brian Coca eb17ab8c27
ansible-doc consistent version info ignore (#78725) 2 years ago
Johanan Liebermann fbd828673d
Fix distro fact handling for Flatcar (#77635)
* Fix distro fact handling for Flatcar

The existence of the file /etc/flatcar/update.conf depends on
bootstrap configuration typically provided by the user. For that
reason this file is unsuitable for determining distro facts for
Flatcar Container Linux.

The distribution_release fact is meaningless in the case of Flatcar
since Flatcar doesn't have named releases. The distribution_version
fact, however, IS meaningful and should contain a number such as
"3139.2.0".

- Use /etc/os-release instead of /etc/flatcar/update.conf.
- Drop the distribution_release fact.
- Set the distribution_version fact.
- Update distro test fixture for Flatcar
- Generate the fixture using gen_distribution_version_testcase.py.
- Override result.distribution and result.os_family manually as the
  generator script gives wrong values.
- Use a recent Flatcar version.

Signed-off-by: Johanan Liebermann <jliebermann@microsoft.com>
2 years ago
Brian Coca 77ba025a13
document tests (#78685)
Document the builtin test plugins

Co-authored-by: Felix Fontein <felix@fontein.de>
2 years ago
Martin Krizek fcfdca8e7d
Overriding AnsibleContext.resolve is not needed/allowed (#78714)
https://github.com/pallets/jinja/pull/1393
https://github.com/pallets/jinja/pull/1544

ci_complete
2 years ago
Sloane Hertel 41b62f7db4
Limit Galaxy API calls during ansible-galaxy dependency resolution (#77468)
* Limit Galaxy API calls during ansible-galaxy collection dependency resolution when possible

Installing a tarfile with a dependency from a Galaxy server (e.g. dependencies: {'ns.coll': '>=1.0.0'}) does not get the available versions of the dependency from the galaxy server if a sufficient version is already installed.

Co-authored-by: Sviatoslav Sydorenko <wk.cvs.github@sydorenko.org.ua>
2 years ago
Brian Coca dc2a79f1c3
ansilbe-doc fixes for filters/test listing (#78696)
* split filters
* listing fixes
* return to no docs being exception
2 years ago
Sam Doran 8ebca4a6a3
fetch_file - properly split files with multi-part file extensions (#75257) 2 years ago
Martin Krizek fd19ff2310
Propagate ansible_failed_task to an outer rescue (#78676)
Fixes #43191
Fixes #72638
Fixes #78042

Co-authored-by: Sandra McCann <samccann@redhat.com>
2 years ago
Brian Coca 72783837c5
fix issue with legacy pugins and no docs (#78686)
* fix issue with legacy pugins and no docs
2 years ago
Sloane Hertel 5f2bb2ba93
Add the rest of the runtime keys to the example in the default collection skeleton (#78573) 2 years ago
Brian Coca 4260b71cc7
refactor and fixes for doc parsing (#77719)
* refactor and remove redundant code in documentation

  allow location and building api to be more accessible
  fix issues with displaying ansible.legacy and ansible.builtin
  ensure we don't x2 process tokens (some modules reference them also) fixes #77764
  move to constants vs hardcoded
  more informative errors and comments
  now have actual filter/test plugins, which expose the filter/test functions
  moved filter/test loading/finding logic into jinja2pluginloader, removed dupe implementations
  added tests for case in which we unique by basename when listing

Update lib/ansible/utils/plugin_docs.py
Co-authored-by: Sloane Hertel <19572925+s-hertel@users.noreply.github.com>
2 years ago
Sloane Hertel 2464e1e91c
Fix vars plugin code and documentation mismatch (#78562)
* Add a warning for collections that are attempting to be autoloaded to no effect
* Deprecate REQUIRES_WHITELIST and add support for REQUIRES_ENABLED so the docs are accurate
* Fix documentation
* add more vars plugin tests
* Simplify code and add a FIXME for another bug
* fix precedence
* Make setting the class attr at all a warning, even if it's True
* Add fun parsing for _load_name
* include _load_name in messages
2 years ago
Matt Martz f8e24e4a65
Guard urllib3 imports against all exceptions. Fixes #78648 (#78667) 2 years ago
Martin Krizek 19e7c5b0c1
_get_next_task_from_state should not mutate anyting outside of state (#78657)
Fixes #78612
2 years ago
NitrogenPointBlue 38c3b5e8f1
Fix typos in stat module examples (#78651) 2 years ago
Brian Coca 0c57734819
until is also implicit (#78632)
The until keyword templating is also implicit, this will now reflect in the docs
2 years ago
rawtaz 87ba1e29d3
doc: Correct mixed up commentary and task name (#78610)
Co-authored-by: Sloane Hertel <19572925+s-hertel@users.noreply.github.com>
2 years ago
gmdmi 81813b7f23
Fixes parameter name in expect module examples (#78635) 2 years ago
Arnold Kamanzi 3b9f1871e5
Docs: fix issue-76133-apt-repository (#78586) 2 years ago
Martin Krizek 42d8a9daa8
Prevent double failing hosts for includes in loops (#76928)
Fixes #23161
2 years ago
Andrew Latham 3d6a60b481
Address inactive but legacy print calls found with code checking. (#78581)
* Address inactive but legacy print calls found with code checking.

* Per bcoca remove the inactive legacy print statements
2 years ago
Matt Martz 4c8b8a06be
Fix exit codes for role search and delete. Fixes #78516 (#78578) 2 years ago
Matt Martz deb54e4c5b
Relax minimal config to enable manifest functionality (#78574)
* Revert "Fix incorrect docs about how to enable manifest functionality (#78572)"

This reverts commit ac1ca40fb3.
2 years ago
Matt Martz d2f8099118
Use MANIFEST.in style directives to build collections (#78422) 2 years ago
Elijah DeLee f9a450551d
add required file to collection skeleton (#77418)
* add required file to collection skeleton

This file is required to be able to upload a collection.

It is present in
https://github.com/ansible-collections/collection_template/blob/main/meta/runtime.yml
but that does not get used by default.

Without this, if you use the "ansible-galaxy collection init" command
and you try and publish that collection without adding this file, you
get the error:

"ERROR! Galaxy import process failed: 'requires_ansible' in
meta/runtime.yml is mandatory, but no meta/runtime.yml found (Code:
UNKNOWN)"

Also updates relevant test and adds a changelog fragment
2 years ago
Sandra McCann 8dc097989b
add note to use package_facts module (#78484) 2 years ago
Benoît Knecht 2e8082ebb0
yum_repository: Do not set default value for async (#76750)
* yum_repository: Do not set default value for async

The `async` repository option is deprecated in RHEL 8, but Ansible sets

```ini
async = 1
```

even when it's omitted from the module options, which causes `dnf` to complain
about an unknown configuration option.

This commit removes the default value from the `async` parameter, which means
it won't be added to the repository file if omitted from the module parameters.

Signed-off-by: Benoît Knecht <bknecht@protonmail.ch>

* Document the specific versions with the default True and the option deprecation for RHEL 8

Co-authored-by: s-hertel <19572925+s-hertel@users.noreply.github.com>
2 years ago
Kate Case bf1ef5a1f3
Replace get_persistent_connection_options in task_executor with get_options (#74446)
Replace get_persistent_connection_options with get_options
Remove special case for network sub_plugin in _set_plugin_options
Try to avoid mock connection pretending to be persistent
Rename variables->options to reflect what they actually are
Gather options for ssh_type_conn on network_cli
Drop reliance on sub_plugin["type"]
2 years ago
Martin Krizek 811093f022
Move handler processing into new PlayIterator state (#77955)
Fixes #46447
Fixes #52561
Fixes #54991
Fixes #64611
Fixes #64999
Fixes #65067
Fixes #72725
Fixes #72781
Fixes #77616
2 years ago
Martin Krizek 254de2a434
Templar: deprecate shared_loader_obj option (#78540) 2 years ago
Ian Wienand b6f42547f4
Targeting a small typo correction (#78531) 2 years ago
Andrew Latham 4604ea38dd
Supply some descriptions for settings used in ansible.cfg (#78536) 2 years ago
Matt Clay 69ceb31600
ansible-test - Update sanity test requirements. (#78528) 2 years ago
Matt Clay 09d0df1d87
Fix variable use before definition. (#78500)
* Fix variable use before definition.

* Include mkstemp in exception handler.

Also remove two pointless variable assignments.
2 years ago
Brian Coca 0de4480467
allow multiple types for null representation (#78451)
* allow multiple types for null representation

  '' is not Nonetype
  fixes #76493
2 years ago
Brian Coca 3a59cb25f4
add info about plugin name when ignoring abstract errors (#78465)
* add info about plugin name when ignoring abstract

  related to #78464

* added error to narrow down method
2 years ago
Matt Martz 86298b7a47
Fix --role-file arg detection (#78475)
* Fix --role-file arg detection. Fixes #78204

* Do not traceback, give better error

* Add coverage for compound shortopts to match -r. Fixes #78491
2 years ago
Brian Coca 740864869e
ansible-config init fixes (#78453)
* ansible-config init fixes

  now handles --disabled correctly for 'vars' format
  also does not display internal config entries anymore

  fixes #78438

note plugins have _prefixed settings that are public, this should change
2 years ago
Martin Krizek 2729088f2a
PlayIterator: deprecate cache_block_tasks and get_original_task (#78514) 2 years ago
Sloane Hertel 3add5e9321
Fix apt making changes in check mode (#78496)
* Don't actually update the cache in check mode

Add tests for updating the cache in check mode

* Don't mark packages as manually installed in check mode and add a test for it

* changelog

* Update test/integration/targets/apt/tasks/apt.yml

* fix test
2 years ago
Matt Clay c35a36083d
ansible-console - Fix arg name to match base class. (#78502) 2 years ago
Matt Clay 9eb3d6811b
find - Use `getattr` instead of `__getattribute__` (#78503) 2 years ago
Matt Clay 3a666a131f
Remove unused code. (#78499) 2 years ago
Matt Clay 2d2839b234
module_utils - Fix changing value while iterating. (#78501) 2 years ago
Matthew Donoughe 3f1838bf91
Update attributes of files that are links without specifying link target (#76167)
* update attributes of files that are symlinks

* update attributes of files that are hard links

* fix default state in documentation

* remove unnecessary suppression

* add to changelog
2 years ago
Matt Clay 650befed37
Add missing space after keywords. (#78480)
Also remove unnecessary parenthesis.
2 years ago
Patrick Hemmer 04e8927579
apt: include apt preferences (e.g. pinning) when selecting packages (#78327)
Fixes #77969
2 years ago
Felix Fontein 7e634f54c3
Module/plugin docs: (#78380) 2 years ago
Felix Fontein 51f94570a6
Fix default value documentation for pipelining. (#78441) 2 years ago
Sebastian Gumprich eb462edb16
add example to import a playbook from collection (#78443) 2 years ago
Matt Davis 0591efd5e6
remove Templar caching (#78419)
* source of templating bugs (and at least one CVE), only applies to single-var values anyway
2 years ago
Jordan Borean ad79c1e0d0
Add support for json in adhoc -a (#78114)
Co-authored-by: Sandra McCann <samccann@redhat.com>
2 years ago
Sloane Hertel 05608b20e8
Fix listing collections that are missing the metadata required by build (#76596)
* Rethread pr/70185 through the dependency resolver

Hang optional metadata toggle on the ConcreteArtifactsManager instead of threading it through whole list codepath

Don't error while listing collections if a collection's metadata is missing keys required for building a collection.

Give an informative warning if metadata has been badly formatted.

Co-authored-by: Sam Doran <sdoran@redhat.com>
2 years ago
Brian Coca 9b79d6ba35
config error origin (#78407) 2 years ago
Sloane Hertel a2174fc6d9
Fix removing existing dir/files with `ansible-galaxy collection init --force` (#78403)
* Remove collection contents when re-initializing with --force


Co-authored-by: Sviatoslav Sydorenko <wk.cvs.github@sydorenko.org.ua>
2 years ago
Martin Krizek ce6c9befb8
Do not allow handlers from dynamic includes to be notified (#78399)
* Do not allow handlers from dynamic includes to be notified
2 years ago
Matt Martz f6d2b18322
Correctly get the filename from a url in fetch_file. Fixes #29680 (#78383) 2 years ago
Brian Coca e4890afc4e
Pause module, return actual echo value (#78378) 2 years ago
Sandra McCann b6ec06ab25
add note about permission change (#78128) 2 years ago
Matt Davis 1368bfa348
PluginLoader now installs module-to-be-imported in sys.modules before exec (as Python import does). (#78364) 2 years ago
Ruediger Pluem 0ef1376966
Make distro.id() report newer versions of OpenSuSE (at least >=15) also report as opensuse (#76121)
* Report OpenSuSE >= 15 as opensuse

Make distro.id() report newer versions of OpenSuSE (at least >=15) also report
as opensuse. They report themselves as opensuse-leap.

* Add a test
2 years ago
Brian Coca c135a47f44
chmod aix errors with 255 is not unreachable (#78249)
* chmod aix errors with 255 is not unreachable

  fixes #78210

* added another 'aix chmod msg'
check stderr also
2 years ago
Sloane Hertel 5728d72cda
Fix KeyError for ansible-galaxy when caching paginated responses from v3 (#78325)
* Fix KeyError for ansible-galaxy when caching paginated responses from v3

* changelog

* generate responses in loop for test

Co-authored-by: Matt Martz <matt@sivel.net>
2 years ago
Matt Martz 1429672213
Add pep440 version_type for version test (#78308) 2 years ago
Matt Martz 9d4ced1237
wait_for - Read file and perform comparisons using bytes to avoid decode errors (#78317)
* wait_for - Read file and perform comparisons using bytes to avoid decode errors. Fixes #78214

* Write non-ascii via script instead of static file

* Use contexlib.closing to support py27 context manager

* Use executable from task, instead of shebang

* Update encoded bytes to utf16
2 years ago
Martin Krizek b0a84cc9ca
dnf: clarify comparison operators in docs (#78316)
Fixes #78295
2 years ago
Martin Krizek b56b38b3ba
Use classproperty to access field attributes of a class (#78180)
* Use classproperty to access field attributes of a class, consolidate into one class
2 years ago
Matt Martz 884244f1b2
Python 3.9 min for controller (#77566) 2 years ago
Martin Krizek d070b03ad8
Fix templating nested vars with convert_data=False (#78273)
Regression introduced in #78259.
2 years ago
Martin Krizek 9afdb7fec1
template module/lookup: fix convert_data for macros (#78259)
Fixes #78141
2 years ago
Matt Martz de810d5799
Deprecate use of Python crypt (#78257) 2 years ago
Brian Coca 0590ce065c
example showing how to deal with keys w/o apt_key (#78206) 2 years ago
Evgeni Golov 221af7640d
stat only returns pw_name/gr_name if those can be looked up (#78183) 2 years ago
James Livulpi d635b871d1
Cleanup write_file method in uri (#76412) 2 years ago
Mahesh b2cde3a896
Add default value for lvm_facts when lvm or lvm2 is not installed or … (#75989)
* Add default value for lvm_facts when lvm or lvm2 is not installed or there are no lvm facts
2 years ago
Matt Martz d58e69c82d
Add support for gzip decoding responses (#41925) 2 years ago
zorun a6e671db25
Fix AIX processor facts and add unit test (#78223)
- `processor_count` was erroneously set to the number of cores
- `processor_cores` was erroneously set to the number of threads per core
- `processor_vcpus` and `processor_threads_per_core` were not set
- `processor` was a string, while it's supposed to be a list

Before:

```
"ansible_processor": "PowerPC_POWER7",
"ansible_processor_cores": 4,
"ansible_processor_count": 12,
```

After:

```
"ansible_processor": [
    "PowerPC_POWER7"
],
"ansible_processor_cores": 12,
"ansible_processor_count": 1,
"ansible_processor_threads_per_core": 4,
"ansible_processor_vcpus": 48,
```

Also add a unit test.

Co-authored-by: Baptiste Jonglez <git@bitsofnetworks.org>
2 years ago
Brian Coca 1f59bbf4f3
listify_lookup_plugin_terms deprecate dataloader (#78244)
* listify_lookup_plugin_terms deprecate dataloader

  deprecated useless dataloader pass to function
  also removed from callers in core


Co-authored-by: Sloane Hertel <19572925+s-hertel@users.noreply.github.com>
2 years ago
Kate Case fff14d7c1d
Decode vaulted args before sending over ansible-connection. (#78236)
I'm not aware of a way to easily get vault secrets decoded on the
ansible-connection side without sending the vault secrets over the
connection in the same way, so just decode them for transport.
2 years ago
Kay Yan 2e4b0fefbf
Added Kylin Linux Advanced Server Support (#78232) 2 years ago
Martin Krizek 2bc2153c01
yum: fix releasever for latest (#78066)
Fixes #78058
2 years ago
Martin Krizek 630616103e
dnf: fix output parsing on non-English LANGUAGE systems (#78233)
Fixes #78193
2 years ago
Matt Martz b1dd2af4ca
Preflight utf8 encodings check (#78175) 2 years ago
Martin Krizek 9950a86f73
Remove unnecessary special case in Role.load_data (#78181)
ci_complete
2 years ago
Brian Coca d26801e994
Fix wording for :ref|term: substitution (#78216)
* Fix workding for :ref|term: subsitution

 now matches 'seealso' and makes more sense:

  ```
  delay:
  applies_to:
  - Task
  description: Number of seconds to delay between retries. This setting is only used
    in combination with `until`.
  ```
 vs
  ```
  delay:
  applies_to:
  - Task
  description: Number of seconds to delay between retries. This setting is only used
    in combination with website for `until`.
  ```

* updated unit tests

* match see also

* more sanity
2 years ago
Brian Coca f6419a53f6
Ensure atomic writes for cache file (#78208)
* Ensure atomic writes for cache file

 helps avoid errors in highly concurrent environments
2 years ago
Alex Willmer e10851d495
documentation: become plugins: correct pluralization in description (#78196)
fixes #78195
2 years ago
Micah Beasley 489b7f1859
Update dpkg_selections.py (#78177)
* Update dpkg_selections.py to include an syntax example showing how to remove package holds

* Fix pep8 issue: dpkg_selections.py

Missed some trailing spaces when adding example text.
2 years ago
Jan Christian Grünhage b56d73796e
Clarify that sbin directories are always looked at in get_bin_path (#78171) 2 years ago
Martin Krizek 17d52c8d64
Move undefined check from concat to finalize (#78165)
* Move undefined check from concat to finalize

In the classic Jinja2's Environment str() is called on the return value of the
finalize method to potentially trigger the undefined error. That is not
the case in NativeEnvironment where string conversion of the return value is
not desired. We workaround that by checking for Undefined in all of our concat
functions. It seems simpler to do it earlier in the finalize method(s) instead.
As a side-effect it fixes an undefined variable detection in imported templates.

Fixes #78156

ci_complete

* Fix sanity

* ...

* sigh
2 years ago
René Moser 953a86f5a6
doc: filter: unvault: fix example (#78161)
no filter named to_string
2 years ago
LRitzdorf 6bcb494f83
[dnf] Fix skip_broken, add test coverage (v2) (#78158)
* [dnf] Fix skip_broken, add test coverage

Change:
- skip_broken was set in config but not actually used in calls to
  base.install()
- added a lot of test cases with specialized repo
- got rid of external (docker repo) nobest test cases since the
  specialized repo works well for those too
- Slight cleanup and adding comments in dnf module

Test Plan:
- ci_complete

Tickets:
- Fixes #73072

Original-author: Rick Elrod <rick@elrod.me>

* Use a better test for checking results list

ci_complete

Signed-off-by: Rick Elrod <rick@elrod.me>

Co-authored-by: Rick Elrod <rick@elrod.me>
2 years ago
Matt Martz bcdc2e167a
Support for Python 3.11+ tomllib for inventory (#77435) 2 years ago
Matt Martz 5797d06aec
Use customized setraw to prevent output issues (#78060) 2 years ago
Martin Krizek 43153c5831
`FieldAttribute`s as descriptors (#73908) 2 years ago
mlevens-hw 4c9385dab7
Fix documentation with misleading data type (#78157)
##### SUMMARY
The sample value given for the 'mode' parameter is shown without quotes, but the data type is string. If you actually try to use an unquoted numeric string for this value you're in for a nasty surprise! I added quotation marks to the sample value.
##### ISSUE TYPE
- Docs Pull Request

+label: docsite_pr
2 years ago
Brian Coca fa35aa4865
Galaxy server config updates (#77106)
* ansible-galaxy configurable timeouts

  - also fixed issues with precedence,
    so --ignore-certs now overrides config
  - made galaxy_timeout generic setting,
    if set, it becomes default for server configs,
    but now specific servers can override
  - updated tests or added notes (some tests ignore/override precedence)

Co-authored-by: Sloane Hertel <19572925+s-hertel@users.noreply.github.com>
2 years ago
Sandra McCann 3e3f8cb004
Update list for gather_subset (#78133) 2 years ago
Tabah Baridule 08b438c4ba
Updated the document 'src' in URI (#78105) 2 years ago
Brian Coca 34f8168afc
ansible-console fixes (#78064)
* list collection task actions too
* dynamically add execute/help functions when module is found
* handle redirection and short names
2 years ago
Brian Coca cea18bf60a
password lookup argument parsing fix (#78080)
fixes #78079
2 years ago
Chris James ea351f0ae2
user - Use -n instead of -N for luseradd on all distros (#75042)
* Use -n instead of -N for luseradd on all distros

Co-authored-by: Chris James <git@etcet.net>
2 years ago
Jef Vantongerloo 44b5314174
fix missing single quotes in sample code (#78056) 2 years ago
optica-phoffmann c321e3baad
update documentation of 'unarchive' (#77643) 2 years ago
David Greaves 5b90601ca4
Document debconf interaction with dpkg-reconfigure (#74196)
Signed-off-by: David Greaves <david@dgreaves.com>
2 years ago
Brian Coca 3a5a61b783
hide distro map since it is not configurable (#78068)
make it a private setting for internal use and avoid
 user confusion by not displaying it with normal configuration options
2 years ago
Matt Martz 18992b7947
Add new `loop_control.extended_allitems` option (#75760)
* Add new `loop_control.extended_allitems` option. Fixes #75216

* Add test for extended_allitems

* docs code block fix
2 years ago
Matt Martz a90f666ab3
Use ctypes to access shadow, instead of spwd which is deprecated (#78050)
* Use ctypes to access shadow, instead of spwd which is deprecated

* Remove sanity ignore

* cast to str to satisfy mypy

* Add typing.cast polyfill

* Appease mypy redefine

* Add clog frag
2 years ago
David Moreau Simard d81a519f25
Remove .travis.yml files from galaxy init skeletons (#75740)
* Remove .travis.yml files from galaxy init skeletons

These files have existed for many years but in light of the recent
circumstances around Travis, we should not include them by default in
the galaxy init skeletons.

* Add breaking_changes changelog fragment with recommendation to use a custom skeleton if the .travis.yml file is still needed.

Co-authored-by: s-hertel <19572925+s-hertel@users.noreply.github.com>
2 years ago
Sergey 30a923fb5c
Fix 'Permission denied' in user module while generating SSH keys (#78040)
* Fix 'Permission denied' in user module while generating SSH keys

Fix #78017
Use try/except for spwd usage to prevent "Permission denied".

Signed-off-by: Sagi Shnaidman <sshnaidm@redhat.com>
Co-authored-by: Abhijeet Kasurde <akasurde@redhat.com>
2 years ago
Matt Clay 95df5cb740 Fix invalid-ansiblemodule-schema sanity errors.
The validate-modules sanity test expects a list not a dict_keys iterable.
2 years ago
Brian Coca 3fa377387e
shell plugins give out user friendly type error (#77983)
shell plugins give out user friendly type error
# TODO: this should really have been taken care of via config or fieldattribute validation
2 years ago
Brian Coca 04c7abcbfe
corrected version_added for new config option (#78013)
new option, not subs should have version, also it's 2.14
2 years ago
zorun 05fc96c927
facts: Add uptime fact for NetBSD (#75431)
* facts: Add uptime fact for NetBSD

This is copied from the current OpenBSD facts code.

Tested on the GCC compile farm: https://cfarm.tetaneutral.net/

* Added changelog fragment

Co-authored-by: Baptiste Jonglez <git@bitsofnetworks.org>
Co-authored-by: Jordan Borean <jborean93@gmail.com>
2 years ago
Ganesh Nalawade 1b1c2c79cf
Add configurable option for paramiko banner_ssh timeout (#68184)
* Add configurable option for paramiko banner_ssh timeout

This PR adds a configurable option for paramiko connection
to control the value of banner timeout in paramiko library.
The banner timeout value can be set in ansible.cfg file as
The default value of banner timeout is set to 30 seconds in
paramiko connection plugin.
```
[paramiko_connection]
banner_timeout = 30
```
or using enviornment variable
```
export ANSIBLE_PARAMIKO_BANNER_TIMEOUT=30
```

* Fix CI failure

* Fix review comments

* Fix review comment
2 years ago
Felix Fontein 570379ef98
Do not crash callbacks if exception is not a string. (#77781) 2 years ago
Matt Davis 6e78425f8d
fix pip module resolution (#78000)
* `importlib.util` appears to be lazily imported and is sometimes unavailable as an attribute of `importlib` without an explicit import
2 years ago
Sloane Hertel db335498d0
ansible-galaxy - ensure variable is defined for any error when getting the ansible-core distribution (#77993) 2 years ago
Matt Clay 5a0b230e24 Make fuzzy plugin matching deterministic. 2 years ago
Sloane Hertel 9d6cc7b576
unarchive - fall back to unzip -Z if zipinfo is not available (#76971)
Add a new handler class ZipZArchive to use unzip -Z as an alternative to zipinfo

Run 'unzip -Z' in can_handle_archive so we fall back to the next handler if it's not available (failing in is_unarchived is too late)

* Add a test for unzip -Z when zipinfo is not available

* Update test for missing binary altogether by removing /usr/bin from the PATH
2 years ago
Matt Martz 5e369604e1
Forked display via queue (#77056)
* Forked Display via queue

* Docs and simple code cleanup

* Only proxy Display.display

* Remove unused import

* comment

* Update deadlock comment, remove py3 check

* Don't flush display, and don't lock from forks

* clog frag

* ci_complete ci_coverage

* Add units for queue proxying

* Cleanup flush

* ci_complete

* Only lock the write, switch to RLock

* Remove unused import
2 years ago
Sloane Hertel 143e7fb45e
ansible-galaxy - support resolvelib versions >= 0.5.3, < 0.9.0 (#77649)
* ansible-galaxy - support resolvelib versions >= 0.5.3, <= 0.8.1

Test incompatibilities are removed for resolvelib >= 0.6.0

Test against the latest 0.8.x version and fix requirements

* Fix tests - use a venv for testing the range of resolvelib versions

* Update temporary hardcoded fallback for ansible-test

* Update hardcoded upperbound for sanity tests

* Make error check more flexible
2 years ago
Brian Coca 89c6547892
preserve add_host/group_by on refresh (#77944)
* preserve add_host/group_by on meta: refresh_inventory

Co-authored-by: Jordan Borean <jborean93@gmail.com>
2 years ago
Martin Krizek 39b3581316
Deprecate non lists lookups (#77875) 2 years ago
Sloane Hertel c908d782fb
get_url - permit to have a checksum only file (#77948)
checksum can also accept a checksum only file (no filename beside the checksum).
fixes #54390

Co-authored-by: Baptiste Mille-Mathias <baptiste.millemathias@gmail.com>
2 years ago
Don Naro 15750aec52
ssh retry docs addition (#77930) 2 years ago
Sloane Hertel f270b4e224
Fix items2dict errors for incorrect list item type and missing keys (#77946)
* Fix items2dict errors for incorrect list item type and missing keys

* keep dict comprehension
2 years ago
Martin Krizek 058a69e6b0
Properly send a skipped message for empty templated loop (#77945)
Fixes #77934
2 years ago
Kristian Heljas 9767cda507
Make `ignore_unreachable` to count `ignored` counter
Fixes #77690
2 years ago
Julien Lecomte 33beeace10
Fix lusermod using a group name and not id (#61965) (#77914)
* Fix lusermod using a group name and not id (#61965)
2 years ago
Sloane Hertel 1214b63f4f
Fix 'ansible-config dump --only-changed -t all' verbosity (#77898)
* Fix 'ansible-config dump --only-changed -t all' to only display headers if plugin options are changed

* changelog

* add a test
2 years ago
Brian Coca dbbeea0686
more context on multiple facts modules (#77896) 2 years ago
Wouter Schoot 711b51fad6
Remove double spaces in errormessage (#77839) 2 years ago
OscarBell 74eb8b779d
Blockinfile multiline search (#75090) 2 years ago
Matt Davis 813afcbbb4
swallow all exceptions in type annotation support shim imports (#77860)
* swallow all exceptions in type annotation support shim imports

* add changelog
2 years ago
Brian Coca f7d7604454
Add uri, urn and url test plugins (#77423)
and docs!

Co-authored-by: Tabah Baridule <dulemartins07@gmail.com>
Co-authored-by: Felix Fontein <felix@fontein.de>
2 years ago
Ian Wienand e4c0bbf885
apt: fix virtual package install version detection (#76781)
* apt: fix virtual package install version detection

Change 4a62c4e3e4 introduced version
matching in installation.

The problem stems from

 if version_installable or version:
     pkg_list.append("'%s=%s'" % (name, version_installable or version))

When the package is a virtual-package, package_status() is returning
the "version_installable" of the package *satisfying* the
virtual-package; but then this is trying to install the
virtual-package with this version pin.

For example, "yaml-mode" is a virtual package satisifed by
"elpa-yaml-mode" (currently 0.0.14-1) and trying to install it fails
with

 $ usr/bin/apt-get -y ... install 'yaml-mode=0.0.14-1'
 ... failed: E: Version '0.0.14-1' for 'yaml-mode' was not found ...

In the case of a virtual-package with nothing installed to satisfy it,
we should just return blank values to allow apt-get to do it's thing.

The tests are updated to install and remove this package.

Fixes: #76779
2 years ago
Felix Fontein 6fbc8bd2bc
Fix boolean condition so that ansible-galaxy collection install works when a valid resolvelib is installed. (#77906) 2 years ago
Sloane Hertel 82f3a57bee
Fix ansible-galaxy traceback when unexpected version of resolvelib is installed (#77630)
* Fix traceback when a supported version of resolvelib is not installed

Try to read the supported version range from the package distribution info and fall back to a hardcoded lowerbound/upperbound (>=0.5.3,<0.6.0).

* Add tests for unsupported resolvelib versions

* Resolve remaining import sanity test issues.

Co-authored-by: Matt Clay <matt@mystile.com>
Co-authored-by: Matt Martz <matt@sivel.net>
2 years ago
Sloane Hertel 621e782ed0
Add toggle to fix module_defaults with module-as-redirected-action on a per-module basis (#77265)
* If there is a platform specific handler, prefer the resolved module over the resolved action when loading module_defaults

Add a toggle for action plugins to prefer the resolved module when loading module_defaults

Allow moving away from modules intercepted as actions pattern

Fixes #77059
2 years ago
Brian Coca eecbaee7f4
Fix windows connection options (#77844)
* winrm, psrps added missing var entry

 this handles issue with the default being set to inventory_hostname
 but defaults not being templated implicitly

 fixes #77841
2 years ago
Robert Muir 0f882d010f
Supply 'dev' keyword for linux network facts discovery (#77793)
This avoids incorrect results when the device name conflicts with
another 'ip' keyword. For example, if the device name is 'primary'.

Closes #77792
2 years ago
Sloane Hertel 400475acc0
validate meta/main.yml dependencies and meta/requirements.yml are both lists before concatenating them together (#77821) 2 years ago
Brian Coca e85e8ee00a
set theory filter docs (#77801)
Co-authored-by: flowerysong <junk+github@flowerysong.com>
2 years ago
Brian Coca c83419627a
apt_repository add falalback to deprecated apt-key usage (#77340)
New path uses gpg directly and the stated directories and keystores to use by debian docs

Co-authored-by: Matt Clay <matt@mystile.com>
2 years ago
Matt Clay dfde4be444 Add Python 3.11 support.
ci_complete
ci_coverage
2 years ago
Brian Coca 4706091a38
rename systemd module to services only (#77644)
* rename systemd module to services only

 disambiguates what it handles since systemd is now much more
 that a service manager, but the module is specific to services
2 years ago
Joseph Torcasso c9ce7d08a2
template/__init__.py - fix KeyError when wantlist=False with non-list 2 years ago
Brian Coca 5e50284693
Restrict role loading .. to role ... (#77683)
* Ansible will now error out if you try to use the `*_from` to load files from outside the role being loaded by `{import,include}_role`
2 years ago
Martin Krizek e9af6efee6
Raise a proper error when include/import_role is used as a handler (#77807) 2 years ago
Mark Chappell cb448097e4
Minor typo fix (#77804) 2 years ago
Brian Coca 0d6aa2e87e
More information on doc parsing errors (#77685)
* More information on doc parsing errors

  fixes #77675
2 years ago
Abhijeet Kasurde 524d30b8b0
distribution: add distribution_minor_version for Debian Distro (#74721)
* Added a fact about minor version details for Debian Distro

Fixes: #74481

Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
2 years ago
Brian Coca 46d2c9a988
document some 'dir' based filters (#77687)
Co-authored-by: flowerysong <junk+github@flowerysong.com>
Co-authored-by: Emmanuel Ugwu <32464178+ugwutotheeshoes@users.noreply.github.com>
2 years ago
Tabah Baridule 18fe5a8835
Updated text in ini.py (#77746) 2 years ago
Matt Clay cc5ac88c4c Update mypy test. Fix type hints for Python 3.9.
This also bumps the minimum controller version (for mypy only) to Python 3.9.
2 years ago
Martin Krizek dbdbfe845a
Remove deprecated subclassing DefaultCallback without doc_fragment (#77677) 2 years ago
Brian Coca a12e0a0e87
ansible-config added json/yaml output to list/dump (#77447)
fixes #733644
2 years ago