Commit Graph

55393 Commits

Author SHA1 Message Date
sivel / Matt Martz bae4284820 ansible-test - generate dist_info. Fixes #86695 (#86768) 2026-04-07 12:28:25 -05:00
Patrick Kingston f1179b1f7d Sort galaxy FILES.json for build reproducibility (#86770)
* added the sorting of FILES.json based on name with ASCII2 ordering
* remove useless code
* Add comprehensive tests for FILES.json sorting to ensure reproducible builds

This commit adds tests to validate the FILES.json sorting feature implementation (issue #82792).

Unit Tests (test/units/galaxy/test_collection.py):
- test_build_files_manifest_sorted_by_name: Validates ASCII sorting
- test_build_files_manifest_walk_sorted_output: Tests walk function
- test_build_collection_reproducible_build: Ensures reproducibility
- test_build_files_manifest_special_characters_sorted: Edge cases
- test_files_json_has_sorted_keys: Validates JSON key ordering
- test_build_collection_large_number_of_files_sorted: Scale testing

Integration Tests (test/integration/.../build.yml):
- Multiple builds produce identical FILES.json
- Verify FILES.json reproducible across builds
- Verify all files in ASCII sorted order
- Validate FILES.json format and structure
- Verify each file entry has required fields

Per the comment that 'this should follow the same pattern as _build_collection_tar', add `sort_keys` to this invocation of `json.dumps`
Also removes a sort because files area already sorted in `_build_files_manifest`, which is the source of `file_manifest` in `_build_collection_dir`'s only invocation (line 1669)

Co-authored-by: Thomas Wang <yuanchen.wang@optus.com.au>
Co-authored-by: Thomas Wang <yctomwang123@gmail.com>
Co-authored-by: pvskp <pvincius14@gmail.com>
2026-04-07 12:34:12 -04:00
sivel / Matt Martz a496819b4d Bump devel to 2.22 (#86784) 2026-04-06 14:21:41 -05:00
sivel / Matt Martz 9ade959713 Skip podman rootful tests on RHEL10 (#86785) 2026-04-06 13:28:40 -05:00
Nick Marshall 260fcabb79 ansible-playbook - refactor task processing to remove duplicated loading logic (#86603) 2026-04-02 20:51:35 +00:00
sivel / Matt Martz 81c4615453 Add 2.21 release name. Fixes #86005 (#86766) 2026-04-02 20:13:56 +00:00
Sloane Hertel 0aef93bca0 Remove paramiko connection (#86757)
* Remove paramiko connection plugin deprecation warning (#86002)

Remove deprecated paramiko connection plugin

Remove integration tests for paramiko connection plugin

Fix connection fallback after paramiko removal

Revert connection fallback changes

* Remove internal use of the paramiko connection

Setting connection to 'smart' now always uses 'ssh', 'persistent' now always uses 'ansible.netcommon.persistent'

Remove unused test helper

Deprecate PluginLoader aliases

ci_complete

* Remove deprecated portion of lib/ansible/module_utils/compat/paramiko.py

add changelog

* Fully remove ansible.module_utils.compat.paramiko

---------

Co-authored-by: Simon <siimonchernyk@gmail.com>
2026-04-02 14:15:19 -05:00
Nick Marshall f6d0379191 ansible-vault - improved formatting of ansible-vault error messages (#86602) 2026-04-02 19:03:13 +00:00
Tim Düsterhus 7a4bd08663 ansible-vault - keep the original contents on EDITOR failure (#86731)
Currently when the editor returns a failure exit code in `ansible-vault edit`,
the original file is still being overwritten by whatever is in the temporary
file. This is undesirable when some process already made edits to the temporary
file and then later fails for some reason, since the file might only be
partially modified and thus corrupt.

Fix this by using `check_call()` instead of `call()` to throw an Exception when
the exit code is non-zero.

Co-authored-by: Matt Clay <matt@mystile.com>
2026-04-02 11:20:34 -07:00
Matt Davis 64d74c9754 Register projections and action plugin dynamic host/group/var API (#86241)
* Register projections and action plugin variable API

Co-authored-by: Matt Clay <matt@mystile.com>
Co-authored-by: Patrick Kingston <pkingsto@redhat.com>
2026-03-31 23:09:14 +00:00
Abhijeet Kasurde 8d24f0d32f Deprecate apt_* using runtime.yml (#86690)
Signed-off-by: Abhijeet Kasurde <Akasurde@redhat.com>
Co-authored-by: Matt Clay <matt@mystile.com>
2026-03-28 05:19:07 -07:00
Felix Fontein e4004d720d Upgrade ACME test image to 2.4.0. (#86740) 2026-03-27 17:20:11 -07:00
Matt Clay 36e9711c26 Fix deepcopy support for imported templates (#86727) 2026-03-27 15:23:27 -07:00
Abhijeet Kasurde 4da24b8128 apt: recreate apt cache if /var/lib/apt/lists is missing (#86612)
* While creating bare minimum container images, sometimes
  /var/lib/apt/lists is removed.
  Recreate this directory in order to update cache successfully.

Fixes: #61176

Signed-off-by: Abhijeet Kasurde <Akasurde@redhat.com>
Co-authored-by: Sloane Hertel <19572925+shertel@users.noreply.github.com>
2026-03-27 17:36:17 -04:00
Jordan Borean ca8444f238 Simplify pipelining logic for Windows ci_complete (#86734)
* Simplify pipelining logic for Windows ci_complete

Has the Windows connection plugins override is_pipelining_enabled to
return True rather than use the special connection plugin attributes.
These attributes should be removed in the future but when is still
dependent on when we can expect Ansible 2.19 is the minimum version
supported in collections.

* Make CI green

Signed-off-by: Abhijeet Kasurde <Akasurde@redhat.com>

---------

Signed-off-by: Abhijeet Kasurde <Akasurde@redhat.com>
Co-authored-by: Abhijeet Kasurde <Akasurde@redhat.com>
2026-03-28 03:50:59 +10:00
Jordan Borean 85f371fe5d Fix windows test with coverage (#86736) 2026-03-28 03:06:17 +10:00
Patrick Kingston 8d75344549 Pip editable now applies to all packages (#86732)
When editable is set to true, -e flag should be passed to all packages.
This change passes -e flag before each package name. However, if a
requirements file is used, then editable flag raises errors. Therefore,
editable and requirements are now mutually exclusive.

Fixes #77755

Signed-off-by: Nirmal Patel <nirmal@nirmal.dev>
2026-03-26 13:11:08 -07:00
Jordan Borean 1071baca60 Add support for PowerShell modules on POSIX (#86627)
* Add support for PowerShell modules on POSIX

Adds support for running modules written in PowerShell on non-Windows
hosts. This includes references to a PowerShell or C# module_util
located in Ansible or a collection. Not all module utils will work
outside of Windows but `Ansible.Basic` will do so.

Support for PowerShell modules on non-Windows is up to the module and
collection author. This PR just enables the ability to run them through
the existing PowerShell execution wrapper.

* Fix up sanity and unit tests, try and run in separate CI group

* Fix up powershell.sh group detection

* More sanity fixes

* More sanity fixes

* Ensure shebang is part of command to run

* Try and simplify exec module logic

* Attempt to get powershell group running in CI

* Fix up test integration aliases for powershell

* Remove ansible.windows collection for integration support

* Revert the win_powershell changes now they aren't needed

* Simplify test matrix and use default container
2026-03-27 05:56:38 +10:00
Abhijeet Kasurde a0257b2dc3 User: Raise an error when force is used to delete group (#85610)
On platforms like Alpine and BusyBox, group delete operation
with force is not applicable. Raise an error notifying the
user about the same.

Fixes: #85565

Signed-off-by: Abhijeet Kasurde <Akasurde@redhat.com>
2026-03-26 12:03:31 +00:00
Ariel Otilibili cef7aab8b5 tests/integration: find: use directly variables and str concat (#86710) 2026-03-25 17:18:39 -07:00
sivel / Matt Martz af6f1afeaf Support core packaging operations against older python versions (#86432)
* split the dnf module into a cli shim and a module
* Update package_facts to use rpm cli, add package_facts and rpm_key to rhel8 targeted testing
* Switch resource embedding to EmbedManager.embed API


Co-authored-by: Matt Davis <nitzmahone@redhat.com>
2026-03-25 12:02:11 -05:00
Sloane Hertel a51536f311 Fix using the server's validate_certs config when downloading (#86705)
* Fix using the server's validate_certs configuration when downloading collections

* Fix validate_certs for verify

There is no GalaxyAPI on the collection object for verify since it wasn't created via the resolver

Remove unit test - would need more convoluted monkeypatching

* Simplify ConcreteArtifactsManager.save_collection_source by passing 2 arguments instead of 6

* Consolidate ConcreteArtifactsManager instance attrs _galaxy_collection_cache/_galaxy_collection_origin_cache
2026-03-25 11:20:34 -05:00
sivel / Matt Martz 03c851d681 Switch to new galaxy-ng container setup (#86623) 2026-03-24 13:40:43 -05:00
Abhijeet Kasurde ef7b026f77 apt: Handle comma-separated packages from recommends (#86613)
* While installing local deb packages, consider comma-separated
  packages from recommends

Fixes: #86609

Signed-off-by: Abhijeet Kasurde <Akasurde@redhat.com>
Co-authored-by: Sloane Hertel <19572925+shertel@users.noreply.github.com>
2026-03-24 03:40:04 -07:00
Jordan Borean e6b6f34144 Add new psrp options and change service default (#86638)
* Add new psrp options and change service default

Add new options to the `psrp` connection plugin to specify the profile
loading behaviour and a password to use for decrypting the certificate
authentication private key.

This also changes the `negotiate_service` default from `WSMAN` to `host`
to improve compatibility with Windows targets that may not have the
`WSMAN` SPN registered like domain controllers and align with the
defaults the native PowerShell PSRemoting client uses.

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

Co-authored-by: Abhijeet Kasurde <akasurde@redhat.com>

---------

Co-authored-by: Abhijeet Kasurde <akasurde@redhat.com>
2026-03-24 15:11:00 +10:00
Matt Clay 02a65ab292 ansible-test - Update base/default containers (#86706) 2026-03-21 01:51:04 +00:00
Ariel Otilibili 7d2aa2a4c6 find: add locale encoding in err msg when none is given (#86641)
When the search fails, as expected, the following error is printed out:

    [...] Failed to read the file FILENAME due to an encoding error. current encoding: None (default determined by the Python built-in function "open")

Add locale encoding in error messages when none is given.

As well, this case is hit for decoding exceptions, not encoding ones.

Change the error message.

Add the corresponding tests, update documentation.

Link: https://docs.python.org/3/library/locale.html#locale.getpreferredencoding
Co-authored-by: Matt Clay <matt@mystile.com>
Signed-off-by: Ariel Otilibili <a.otilibili@instadeep.com>
2026-03-20 18:07:35 -07:00
Matt Clay e65e27c38a ansible-test - Update sanity test requirements (#86701) 2026-03-20 23:39:04 +00:00
Matt Clay 30940e2689 ansible-test - Update utility containers (#86700) 2026-03-20 21:42:39 +00:00
Matt Clay 67ef70756c ansible-test - Upgrade macOS remote to 26.3 (#86699) 2026-03-20 12:44:39 -07:00
Matt Clay b330f2a051 ansible-test - Upgrade FreeBSD 14.3 to 14.4 (#86698)
Also use packaged version of ``packaging`` for FreeBSD 15.0.
2026-03-20 11:23:14 -07:00
Brian Coca 4fdeac0a72 ssh connection, document quoting (#86684)
also move to fstrings
moved to case/match
2026-03-19 19:02:19 -04:00
Brian Coca 85918854b3 note on pickle (#86685) 2026-03-19 19:01:41 -04:00
Matt Davis 60a9be7f46 Consult deprecation metadata for non-collection builtins (#86689)
* Consult deprecation metadata for non-collection builtins

* Re-homed `ignore_deprecated` on PluginLoadContext
* Added tests

* remove superfluous shebang and ignore entry

* Apply suggestion from @mattclay

---------

Co-authored-by: Matt Clay <matt@mystile.com>
2026-03-18 21:59:47 -07:00
Jordan Borean e091045923 Bump PowerShell 7.6 to GM release (#86688)
* Bump PowerShell 7.6 to GM release

* Update test container references
2026-03-19 07:10:54 +10:00
olegnazarov23 1d16ef3334 user: warn when seuser is set on systems without SELinux (#86671)
When the seuser parameter is provided but SELinux is not enabled on the
target system, the parameter is silently ignored and the module reports
changed: true. This misleads users into thinking SELinux user mappings
were applied.

Emit a warning when seuser is set and SELinux is not enabled, so users
are aware the parameter has no effect. This uses module.selinux_enabled()
to check at runtime rather than checking the platform type, as recommended by the maintainers.

The warning alone is not enough — useradd still receives the -Z flag
and fails with "useradd: -Z requires SELinux enabled kernel". Skip
adding -Z to the command when SELinux is not enabled.


Fixes #85542


---------

Co-authored-by: olegnazarov23 <olegnazarov23@users.noreply.github.com>
2026-03-18 08:30:40 -07:00
Abhijeet Kasurde 80ee6b5d92 apt_repository: Deprecate module (#86090)
* Deprecate apt_repository in favor of deb822_repository

Signed-off-by: Abhijeet Kasurde <Akasurde@redhat.com>
2026-03-16 15:19:35 -07:00
zorun c93085eece service: Add compatibility with GNU Hurd (#86622)
Signed-off-by: Baptiste Jonglez <git@bitsofnetworks.org>
Co-authored-by: Abhijeet Kasurde <Akasurde@redhat.com>
2026-03-16 05:25:20 -07:00
Matt Clay 3f10c2c0a9 ansible-test - Switch macOS remote to aarch64 (#86653) 2026-03-13 21:20:08 -07:00
Matt Clay 3300932a74 ansible-test - Add managed test environment aliases (#86592) 2026-03-13 18:42:21 +00:00
Matt Clay dfdada96d7 ansible-test - Add support for GitHub Actions (#86643) 2026-03-13 10:17:46 -07:00
Jordan Borean 51d5a456ef Fix powershell method on non-pipelined conns (#86619)
Fixes the action plugin mkdtemp and expand_user calls to fallback to the
original non-pipelined variants when a connection plugin does not
support pipelining. For example a 3rd party Windows connection plugin
may not support pipelining and thus cannot use the user _mkdtemp2 and
_expand_user2 variants exposed by the `powershell` shell plugin as they
require data to be sent over stdin.
2026-03-13 06:25:25 +10:00
Sloane Hertel 895481957b Fix issue templates - replace relative links with absolute links (#86640) 2026-03-12 10:48:24 -04:00
Abhijeet Kasurde f201e921df user: Updating doc with gid in file module (#86635)
Signed-off-by: remz42 <remi.moncel@gmail.com>
Co-authored-by: Abhijeet Kasurde <Akasurde@redhat.com>
Co-authored-by: Sloane Hertel <19572925+shertel@users.noreply.github.com>
2026-03-11 19:19:11 +00:00
Patrick Kingston 36e318dfe9 file: Warn module lacks permissions (#86608)
* Raise warning on inaccessible path (#57573)

* Raise error on permission denied (#57573)

* Use `os.lstat` for all state operations in `file`

* Update warning messages

* Update changelog

* Make tests use remote_tmp_dir for easier cleanup

* Rename and update changelog fragment

* Tweak changelog fragment

---------

Co-authored-by: Jakub Pieńkowski <8525083+Jakski@users.noreply.github.com>
2026-03-11 12:16:25 +00:00
Sloane Hertel a8003fe732 Clarify ansible-galaxy changelog fragment (#86626)
Co-authored-by: Don Naro <dnaro@redhat.com>
2026-03-09 20:58:00 +00:00
Patrick Kingston 0183e386df Sanity test for trailing newlines (#86625) 2026-03-05 19:35:52 -08:00
Sloane Hertel b1323f3ab1 ansible-galaxy - only install/download collections which support ansible-core by default (#86183)
* ansible-galaxy - only install/download collections with compatible requires_ansible metadata

inject requires_ansible as a dependency of the collection

add a hack to preserve the collection origin in the error message in get_dependencies and find_matches

* yield requires_ansible requirement before dependencies

* Fix error handling and broken test

Fix getting requires_ansible dependency after the metadata is available

Allow 3rd party servers to provide this metadata lazily for individual versions

Rename the candidate attr name for the error handling hack

* fix diff

* clarify code comments

refactor a bit

* Don't duplicate error message. Before:

[ERROR]: Failed to resolve the requested dependencies map. Could not satisfy the following requirements:
* ns.col2:1.0.0 (dependency of ns.col3:1.0.0) requires ansible-core <2.19.1
Hint: To disregard whether the collection supports the current version of ansible-core, configure COLLECTIONS_ON_ANSIBLE_VERSION_MISMATCH as "ignore".
Hint: Pre-releases hosted on Galaxy or Automation Hub are not installed by default unless a specific version is requested. To enable pre-releases globally, use --pre: [RequirementInformation(requirement=<ansible-core:<2.19.1 of type 'requires_ansible' from Galaxy>, parent=<ns.col2:1.0.0 of type 'galaxy' from cmd_arg>)]

Failed to resolve the requested dependencies map. Could not satisfy the following requirements:
* ns.col2:1.0.0 (dependency of ns.col3:1.0.0) requires ansible-core <2.19.1
Hint: To disregard whether the collection supports the current version of ansible-core, configure COLLECTIONS_ON_ANSIBLE_VERSION_MISMATCH as "ignore".
Hint: Pre-releases hosted on Galaxy or Automation Hub are not installed by default unless a specific version is requested. To enable pre-releases globally, use --pre.

<<< caused by >>>

[RequirementInformation(requirement=<ansible-core:<2.19.1 of type 'requires_ansible' from Galaxy>, parent=<ns.col2:1.0.0 of type 'galaxy' from cmd_arg>)]

After:

[ERROR]: Failed to resolve the requested dependencies map. Could not satisfy the following requirements:
* ns.col2:1.0.0 (dependency of ns.col3:1.0.0) requires ansible-core <2.19.1
Hint: To disregard whether the collection supports the current version of ansible-core, configure COLLECTIONS_ON_ANSIBLE_VERSION_MISMATCH as "ignore".
Hint: Pre-releases hosted on Galaxy or Automation Hub are not installed by default unless a specific version is requested. To enable pre-releases globally, use --pre.

* appease CI

fix type hints

* Update changelogs/fragments/install-ansible-core-compatible-collections.yml

Co-authored-by: sivel / Matt Martz <matt@sivel.net>

* Hardcode unsupported requires_ansible version to make maintaining the tests easier

Add a test for failed backtracking

Co-authored-by: sivel / Matt Martz <matt@sivel.net>

---------

Co-authored-by: sivel / Matt Martz <matt@sivel.net>
2026-03-05 11:08:51 -06:00
Patrick Kingston 948f8f42d0 Configurable vaulted value rendering (#86561)
* Fix vaulted value rendering

- Fixes AnsibleDumper works on vaulted strings
- Adds config setting for opting in to future forced-strictness

* Add tests for new to_yaml functionality

* Add return on all paths

* Clarify configured value name

* Fix sanity (remove unused import)

* Catch more cases of encrypted strings

* WIP fix failing unit tests

* Update unit test to work with new to_yaml features

* Remove unit test

Running coverage with/without shows no new coverage.

* Write some basic error text

* Fix tests for error configuration

* Change names

- Change `vault_behavior` to just `vault`
- Change `preserve` to `keep_encrypt`

* Fix small issues in tests

* Fix fmt with black

* Fix unit tests

- Fix imports
- Fix the name of the param

* Update assorted docs - code review

Co-authored-by: Abhijeet Kasurde <akasurde@redhat.com>

* Remove deprecation

* Simplify vault parameter and handling

- Get rid of `default` enum
- Get rid of config option and associated test file
- Change `vault` to `vault_behavior`

* Document filter parameter

* Correctly Document filter parameter

* Add version_added and changelog fragment

* Tweak changelog

* Remove dead code, add docstring

* Add bugfixes section to changelog

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

---------

Co-authored-by: Abhijeet Kasurde <akasurde@redhat.com>
Co-authored-by: Matt Davis <6775756+nitzmahone@users.noreply.github.com>
2026-03-04 14:30:49 -08:00
David Shrewsbury 2341354ffa Replace gpg in rpm_key with librpm (#86237)
* Replace gpg in rpm_key with librpm

* Manually compute primary key ID and fingerprint for older librpm

* Code cleanup

* Add some v6 tests

* Add rhel 10.1 to CI matrix and changelog

* Remove RHEL 10.0

* consolidate common code and rename unused vars

* remove unnecessary exception raise

* Fix return type

* review comments: change import and use of Optional

* ci_complete ci_coverage

* address review comments

* When checking for existing keys, account for short from key ID and revert test change that hid this

* Support RPM version 6+. Allow 'key' to be fingerprint.

* Replace v6 test key with non-PQC algo version and enable Fedora v6 tests

* modify changelog, mod doc, and del 10.1 test req

* Code refactor and new tests

Refactor code to not need to use librpm API to get list of installed
keys. Also add new tests to verify deleting by fingerprint.

* Refactor drop_key() by rpm version, fully type hint code

* use hexdigest()
2026-03-03 16:57:17 +00:00