7119 Commits
Author SHA1 Message Date
Martin KrizekandGitHub 764070de69 [stable-2.19] Expose ansible_failed_task in rescue for explicit flush_handlers (#85687) (#85707)
Fixes #85682

(cherry picked from commit c5ddc93767)
2025-09-02 16:20:30 -07:00
Martin KrizekandGitHub 9aea625f63 [stable-2.19] ternary: evaluate values lazily (#85752) (#85753)
Fixes #85743
(cherry picked from commit 6976e13075)
2025-09-02 16:06:43 -07:00
Sloane HertelandGitHub 6404fdce45 Fix nested import_tasks when the parent import contains a template (#85599) (#85636)
* Test nested import_tasks when the parent import contains a template

* Fix templating the parent_include.args

(cherry picked from commit 9a6420e1d5)
2025-08-18 10:00:15 -07:00
Matt DavisandGitHub 2dcd35b692 [stable-2.19] Backward-compatible None handling in template concat and argspec str (#85652) (#85663)
* Backward-compatible None handling in template concat and argspec str (#85652)

* templating coerces None to empty string on multi-node result

* avoid simple cases of embedded `None` in multi-node string concatenated template results ala <=2.18
* single-node template results preserve NoneType

* add None->empty str equivalency to argspec validation

* fix integration tests
* remove conversion error message check from apt_repository test
* remove error message check on `None` value for required str argspec in roles_arg_spec test (now logically-equivalent to empty string)

* explanatory comment for None->empty str coalesce

(cherry picked from commit e3c9908679)

* eliminate None template nodes in _flatten_nodes (#85676)

* defers value or concat choice until Nones are gone
* fixes None -> empty string for TemplateModule cases
* add tests

(cherry picked from commit 5345ac9911)
2025-08-18 09:58:32 -07:00
Abhijeet KasurdeandGitHub e24bc689a3 [stable-2.19] test: Remove redundant Python 3 condition (#85664) (#85675)
(cherry picked from commit 603dd2d)

Signed-off-by: Abhijeet Kasurde <Akasurde@redhat.com>
2025-08-15 15:14:29 -07:00
5a20b991d4 Rewrite exception key on failed_when: false (#85516) (#85517)
* Prevents callback handle_exception from displaying the captured exception when the task is not failed.
* Added tests.


(cherry picked from commit 2fbd7c114e)

Co-authored-by: Matt Clay <matt@mystile.com>
2025-08-04 10:13:42 -05:00
Brian CocaandGitHub 68378c85cb plugin config options are now correctly fetched with origin (#85488) (#85525)
* also update callbcacks, since they override these functions
due to backwards compat _options being taken for CLI

(cherry picked from commit 19f9c66004)
2025-08-04 10:13:32 -05:00
Abhijeet KasurdeandGitHub e8272f1038 [stable-2.19] filter: update integration tests (#84990) (#85540)
(cherry picked from commit 181dbdb)

Signed-off-by: Abhijeet Kasurde <Akasurde@redhat.com>
2025-08-04 10:13:12 -05:00
d58c99ddd4 [stable-2.19] Add AnsiballZ debugging support with debugpy (#85476) (#85528)
* Add AnsiballZ debugging support with debugpy

Adds support for debugging AnsiballZ modules with debugpy which is used
by VSCode as its Python debugger DAP. Debugging can either be done
through a manual Debugpy listening server through a launch.json
configuration or through the new ansible-test --dev-debug-on-deman
argument.

* Fix up integration test

* Simplify config option and move mypy ignore

* Use new API if available and fix typo

* Guard the import of debugpy

* Fix sanity import issue

* Minor cosmetic adjustments

* Simplify debugger setup

* ansible-test - Refactor debugging interface

* Add ansible-test debug integration tests

* Fix ansible-test shell when in unsupported dir

---------
(cherry picked from commit 3882366585)

Co-authored-by: Jordan Borean <jborean93@gmail.com>
2025-08-04 10:12:41 -05:00
Martin KrizekandGitHub 28ca9c09fb [stable-2.19] dnf/dnf5: address issues discovered in 2.16 yum tests (#83659) (#85607)
Fixes #85554
(cherry picked from commit c0256d6)
2025-08-04 10:12:20 -05:00
Matt ClayandGitHub 483b23ce6d [stable-2.19] Ensure config env/ini values are tagged (#85404) (#85414)
* Ensure config env/ini values are tagged

Config env and ini values now have origin and trust tags applied.

* Remove unused import
(cherry picked from commit 6ff6339191)
2025-07-08 14:43:02 -07:00
Martin KrizekandMatt Clay 16999ea4d9 Limit askpass prompts to single attempt (#85364)
* Limit askpass prompts to single attempt

OpenSSH client option NumberOfPasswordPrompts defaults to 3 so in case
an incorrect connection password is provided it is excessively tried 3
times. Not only that but running the `_ssh_askpass` entry point multiple
times (via ssh) results in `json.decoder.JSONDecodeError` as after the
first run the shared memory is zero'd and the subsequent runs end up
calling `json.loads` on empty data.

`json.decoder.JSONDecodeError` does not happen prior to Python 3.13 as
the share memory is unlinked automatically on `.close()` and the
`_ssh_askpass` entry point exits with return code 1 before attempting to
load zero'd memory.

Fixes #85359

* changelog and tests

* Update changelogs/fragments/85359-askpass-incorrect-password-retries.yml

Co-authored-by: Matt Davis <6775756+nitzmahone@users.noreply.github.com>

* Update lib/ansible/cli/_ssh_askpass.py

Co-authored-by: Martin Krizek <martin.krizek@gmail.com>

* Avoid race condition in second unlink

---------

Co-authored-by: Matt Davis <6775756+nitzmahone@users.noreply.github.com>
Co-authored-by: Matt Clay <matt@mystile.com>
(cherry picked from commit 54ccad9e46)
2025-06-30 12:21:09 -07:00
Matt DavisandMatt Clay a37df1a94a Remove redundant vars FA on PlaybookInclude (#85395)
* The redundant FA declaration was not static, which broke a number of automatic validation behaviors.
* Added tests to assert deferred validation and lack of templating on `import_playbook.vars`.

Co-authored-by: Matt Clay <matt@mystile.com>
(cherry picked from commit 73369f53af)
2025-06-30 12:21:09 -07:00
Matt DavisandMatt Clay 9a3288f8c4 unified Marker propagation for all Jinja plugin/call ops (#85391)
* Errors raised in most Jinja operations and plugin invocations are now propagated as Markers, allowing template pipeline to continue execution when a Marker-aware consumer is present.
* Added ability to inspect ExceptionMarkers to Protomatter `dump_object` filter.
* Added tests.

Co-authored-by: Matt Clay <matt@mystile.com>
(cherry picked from commit 29cdba1fee)
2025-06-30 12:21:09 -07:00
Matt DavisandMatt Clay ebae950db2 Encryptedstring redact fixes (#85390)
* misc DTFIX/docstring cleanup

* fix EncryptedString redaction, add tests

Co-authored-by: Matt Clay <matt@mystile.com>

* Fix test failures

---------

Co-authored-by: Matt Clay <matt@mystile.com>
(cherry picked from commit 649c9ec443)
2025-06-30 12:21:09 -07:00
Matt DavisandMatt Clay b23aa84a49 Jinja sandbox refinement (#85385)
* DTFIX recategorize

* fix ansible-console generated task dict

* use non-deprecated task shape

* switch Jinja from ImmutableSandboxedEnvironment to SandboxedEnvironment

* Restore ability to call collection mutation methods.
* Restore ability to directly call integer bitwise operator methods.
* Adjust tests.

Co-authored-by: Matt Clay <matt@mystile.com>

---------

Co-authored-by: Matt Clay <matt@mystile.com>
(cherry picked from commit 11f5563895)
2025-06-30 12:21:09 -07:00
Matt DavisandMatt Clay b3dde82ab1 deprecate esoteric/undocumented playbook syntaxes (#85378)
Co-authored-by: Matt Clay <matt@mystile.com>
(cherry picked from commit 547c64f326)
2025-06-24 15:18:17 -07:00
Matt DavisandMatt Clay d68954de83 restore playbook import DS rewrite (#85379)
* add tests for FQ "action" aliases
* add validation for multiple directives

Co-authored-by: Matt Clay <matt@mystile.com>
(cherry picked from commit 1f8937b57e)
2025-06-24 15:18:17 -07:00
Matt DavisandMatt Clay 0ce6b45db2 deprecate invalid variable names in inventory (#85377)
* deprecate invalid variable names in inventory

* was previously a hard error for `Host`
* added missing check to `Group`
* swapped blanket Python keyword prohibition with Jinja singleton and `not` check

Co-authored-by: Matt Clay <matt@mystile.com>

* fix invalid variable name test

---------

Co-authored-by: Matt Clay <matt@mystile.com>
(cherry picked from commit 3c52b14c9e)
2025-06-24 15:18:17 -07:00
Martin KrizekandMatt Clay 3de2b9082c Test both original and latest dnf versions (#85342)
Co-authored-by: Matt Clay <matt@mystile.com>
(cherry picked from commit ef9d92b31d)
2025-06-24 15:18:17 -07:00
Matt DavisandMatt Clay 9c0dc6c88a import_playbook validation cleanup (#85358)
* use declarative FA validation
* deleted redundant/broken imperative validation
* added test case to ensure templating

Co-authored-by: Matt Clay <matt@mystile.com>
(cherry picked from commit dde10a9afb)
2025-06-24 15:18:17 -07:00
Matt DavisandMatt Clay 9f7432c5ff display wrap/format arg cleanup (#85352)
Co-authored-by: Matt Clay <matt@mystile.com>
(cherry picked from commit fa9f286096)
2025-06-24 15:18:16 -07:00
Matt DavisandMatt Clay 03dc8c4260 feature-flag experimental module metadata (#85351)
* added ansible-test integration env/set directive for aliases
* applied to module-serialization-profiles test to enable feature flag

Co-authored-by: Matt Clay <matt@mystile.com>
(cherry picked from commit 46abcfcc82)
2025-06-24 15:18:16 -07:00
Matt Clay b6ac61b487 Show context for reserved variable warnings (#85324)
* Show context for reserved variable warnings

* Update integration test

* Use var origin not value origin

* Use a list

* Ensure tagged varname is used

(cherry picked from commit d922398c4d)
2025-06-24 15:18:16 -07:00
leopardracerandMatt Clay 11ad0ae758 Update test-pause (#85347)
(cherry picked from commit 678c6abc98)
2025-06-24 15:18:16 -07:00
Matt DavisandMatt Clay 59cdb65926 Misc callback fixes/cleanup (#85344)
* Misc callback fixes/cleanup

* Fix v1 callback method dispatch, fully deprecate v1 methods, add missing tests.
* Clean up callback plugin init/setup code, remove redundancies, improve error messaging.
* Remove unused callback method definitions from base class.

Co-authored-by: Matt Clay <matt@mystile.com>

* switch callback bypass to instance-level from class-level

* preserves any instance-level method magic that implementations were using

* add missing handler dispatch entry

* add tests to ensure all methods are covered

---------

Co-authored-by: Matt Clay <matt@mystile.com>
(cherry picked from commit eec57ec396)
2025-06-24 15:18:16 -07:00
Maxim EvtushandMatt Clay 19f3890275 Fix Typo in Variable Name and Update Test Data for Identifier Validation (#85338)
(cherry picked from commit 778fdcbef1)
2025-06-24 15:18:16 -07:00
FTandMatt Clay 7d05c6e8e0 Fix Typos in Comments and Task Names (#85330)
* Update windows.yml

* Update test_manifest.yml

(cherry picked from commit f6be5ab224)
2025-06-24 15:18:16 -07:00
Matt DavisandMatt Clay b708e53d08 fix script failed_when bypass (#85326)
* fix script failed_when bypass

* misuse of AnsibleActionFail for a retryable/alterable error case
* add tests

Co-authored-by: Matt Clay <matt@mystile.com>

* type annotation fixes

---------

Co-authored-by: Matt Clay <matt@mystile.com>
(cherry picked from commit ed90a424a9)
2025-06-24 15:18:16 -07:00
fuder.ethandMatt Clay b7158e7829 Fix Typos in Integration Test Comments and Documentation (#85322)
* Update specific-revision.yml

* Update main.yml

(cherry picked from commit f7e0612a85)
2025-06-24 15:18:16 -07:00
Brian CocaandMatt Clay f29662138e Assemble add check mode (#85094)
Co-authored-by: Abhijeet Kasurde <akasurde@redhat.com>
(cherry picked from commit 02c21742a3)
2025-06-24 15:18:16 -07:00
kilavvyandMatt Clay 80a00f60d6 Minor Documentation and Comment Corrections (#85313)
* Update New-AnsiblePowerShellSignature.ps1

* Update ultimatequestion.yml

(cherry picked from commit a09b25a356)
2025-06-24 15:18:16 -07:00
Brian CocaandMatt Clay 05b3eafeae ansible-doc don't show empty paths (#85294)
If no path is given, it can only mean that it is a Jinja plugin, display Jinja as 'provider' then.

(cherry picked from commit 8ec403a3b9)
2025-06-24 15:18:16 -07:00
Brian CocaandMatt Davis d3f2c6d8f0 ansible-doc display docs for modules w/o ext (#85299)
Fixed case in which listing modules for docs failed to get sidecar

Co-authored-by: Abhijeet Kasurde <akasurde@redhat.com>
(cherry picked from commit 7e495f4b20)
2025-06-11 14:53:10 -07:00
leopardracerandMatt Davis 529776f0a1 Fix typos in documentation and test ignore list (#85303)
* Update ignore.txt

* Update invalid_choice_value.py

(cherry picked from commit 56de597fc7)
2025-06-11 14:53:10 -07:00
Matt ClayandMatt Davis f2a0eef867 Fix bool filter for non-hashable types (#85300)
(cherry picked from commit c8324aa01a)
2025-06-11 14:53:10 -07:00
Sloane HertelandMatt Davis 58496bed29 fix handler include_tasks templating (#85015)
* Add test for a handler including tasks from a variable filename

* Add FieldAttributeBase attribute to indicate if the object should be post validated

Co-authored-by: Matt Davis <6775756+nitzmahone@users.noreply.github.com>
(cherry picked from commit d3977ebc88)
2025-06-11 14:53:10 -07:00
Matt ClayandMatt Davis b5a4fe62ed Fix nested include with templating (#85295)
(cherry picked from commit 714f796384)
2025-06-11 14:53:10 -07:00
Matt ClayandMatt Davis 0cecfd9877 AnsiballZ refactoring and remote debug support (#85289)
(cherry picked from commit 45dd2c0647)
2025-06-11 14:53:10 -07:00
David ShrewsburyandMatt Davis e2b831ce26 get_url - check for incomplete data read (#85164)
(cherry picked from commit aa8d58a174)
2025-06-11 14:53:10 -07:00
Martin KrizekandMatt Davis 33c55b9c25 Fix templating tags on plays and roles (#82314)
Fixes #69903

ci_complete

(cherry picked from commit 532edf4c35)
2025-06-11 14:53:10 -07:00
Martin KrizekandMatt Davis eb29a662f6 Exceptions clean up (#85176)
* replace usage of `IOError` as it is an alias to `OSError`
* replace usage of `socket.error` as it is an alias to `OSError`
* use subclasses of `OSError` rather than inspecting `errno`s
* utilize `exist_ok` parameter of `os.makedirs` rather than ignoring
  `FileExistsError`

Make the following changes to the exception handling this patch already
updates to be consistent with the new code:
* use `ex` as a name for exception being handled
* use `from ex` when re-raising exception for additional context
* use f-strings and `!r` for quoting
* pass exceptions to the `exception` parameter of `fail_json`
* use `display.error_as_warning` rather than passing stringified
  exception into `display.warning`

Co-authored-by: Matt Clay <matt@mystile.com>
(cherry picked from commit 600c1e67b4)
2025-06-11 14:53:10 -07:00
Matt DavisandMatt Davis 0f2bc31753 adjust PluginInfo to use PluginType enum (#85277)
* normalization fixups

Co-authored-by: Matt Clay <matt@mystile.com>
(cherry picked from commit 43c0132caa)
2025-06-11 14:53:10 -07:00
Matt DavisandMatt Davis 7b823720ca Prevent template lookup and action from masking ansible_managed value (#85075)
* deprecate DEFAULT_MANAGED_STR and prevent masking of ansible_managed var

* adjust public API behavior

* restore backward-compatible behavior on existing public API

(cherry picked from commit 9f0a8075e3)
2025-06-11 14:53:10 -07:00
Matt DavisandMatt Davis a943626ce6 Restore 2.18 vault tag YAML dump behavior (#85275)
* Doing conditional redaction/formatting needs other bits that aren't ready for 2.19.

Co-authored-by: Matt Clay <matt@mystile.com>
(cherry picked from commit 2b7204527b)
2025-06-11 14:53:10 -07:00
Martin KrizekandMatt Davis 9f703f7633 Fix calls to deprecated() to include help_text arg (#85262)
Co-authored-by: Matt Clay <matt@mystile.com>
(cherry picked from commit ea7ad90c31)
2025-06-11 14:53:10 -07:00
Matt ClayandMatt Davis a57229aa8a Fix YAML loading/dumping and filters (#85266)
- from_yaml/from_yaml_all filters now preserve trust
- YAML dumping can once again handle undecryptable vaulted values
- increased test coverage

Co-authored-by: Matt Davis <nitzmahone@redhat.com>
(cherry picked from commit 1c06c46cc1)
2025-06-11 14:53:10 -07:00
Matt DavisandMatt Davis e1a7508f6d Resolve misc DTFIX0/1 (#85247)
* complete DTFIX0 after eval

* sunder-prefix Marker.concrete_subclasses

* re-home Jinja plugin decorators public API

* low-hanging/already fixed DTFIX cases

Co-authored-by: Matt Clay <matt@mystile.com>

---------

Co-authored-by: Matt Clay <matt@mystile.com>
(cherry picked from commit df0b417f2d)
2025-06-03 15:49:23 -07:00
Jordan BoreanandMatt Davis 4ae5800849 doc - Dynamically document jinja builtins (#85215)
* doc - Dynamically document jinja builtins

This change has `ansible-doc` dynamically generate the documentation for
any Jinja builtin filter and test plugins. These dynamic stubs will
point to the official Jinja documentation pages for more information.

* Fix sanity issues

* Add tests

* Update Jinja builtin doc gen

Co-authored-by: Matt Clay <matt@mystile.com>

---------

Co-authored-by: Matt Davis <nitzmahone@redhat.com>
Co-authored-by: Matt Clay <matt@mystile.com>
(cherry picked from commit 8f2622c39f)
2025-06-03 15:49:23 -07:00
Martin KrizekandMatt Davis 603e65d204 Merge dnf and dnf5 integration tests (#85199)
(cherry picked from commit 01bb9393d7)
2025-06-03 15:49:23 -07:00