Commit graph

4613 commits

Author SHA1 Message Date
Matt Clay
d922398c4d
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
2025-06-17 13:21:27 -07:00
Matt Clay
83fcaeaa8b
Spelling fixes (#85345)
A few grammar fixes too.
2025-06-17 05:26:36 +00:00
Matt Davis
eec57ec396
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>
2025-06-16 20:03:06 -07:00
Matt Clay
093ac8df2d
ansible-test - Fix relative import resolution (#85328) 2025-06-14 16:11:03 +00:00
Abhijeet Kasurde
cace19f365
apt: Consider timeout while invoking apt-get command (#85219)
* apt: Consider timeout while invoking apt-get command

* Apply timeout specified by user to apt-get command
  using '-o DPkg::Lock::Timeout=' syntax

Fixes: #78658

Signed-off-by: Abhijeet Kasurde <Akasurde@redhat.com>
2025-06-12 17:37:21 -05:00
Matt Clay
7ef13cb29e
ansible-test - Add remote debugging support (#85317) 2025-06-12 18:57:36 +00:00
Brian Coca
02c21742a3
Assemble add check mode (#85094)
Co-authored-by: Abhijeet Kasurde <akasurde@redhat.com>
2025-06-12 16:13:15 +00:00
Brian Coca
7e495f4b20
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>
2025-06-11 14:20:05 -07:00
Sloane Hertel
d3977ebc88
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>
2025-06-11 11:27:00 -04:00
Matt Davis
1d1bbe3424
Fix post-fork deadlock from early Python writers like pydevd (#85296) 2025-06-11 01:08:48 +00:00
Matt Clay
45dd2c0647
AnsiballZ refactoring and remote debug support (#85289) 2025-06-10 14:11:19 -07:00
David Shrewsbury
aa8d58a174
get_url - check for incomplete data read (#85164) 2025-06-10 15:17:22 -05:00
Martin Krizek
532edf4c35
Fix templating tags on plays and roles (#82314)
Fixes #69903

ci_complete
2025-06-10 20:49:05 +02:00
Matt Davis
2bed98bd20
fix Marker handling on Jinja macro invocations (#85280)
* always allow Marker args to pass through
* always disable pre-emptive trip-on-retrieval for Macro JinjaCallContext
* add macro-callable template expression result test cases

Co-authored-by: Matt Clay <matt@mystile.com>
2025-06-06 13:26:45 -07:00
Matt Davis
9f0a8075e3
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
2025-06-05 17:21:48 -07:00
Matt Davis
2b7204527b
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>
2025-06-05 19:21:46 +00:00
Martin Krizek
d7c4d0119f
Deprecate ShellModule.checksum() (#85216)
The methods have not been used, updated or tested since
b9d0662faf.
2025-06-03 11:14:55 -04:00
Jordan Borean
8f2622c39f
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>
2025-06-02 13:23:30 -07:00
Martin Krizek
3505572470
Deprecate ansible.compat.importlib_resources (#85226)
Co-authored-by: Matt Clay <matt@mystile.com>
2025-06-02 09:51:03 +02:00
Martin Krizek
487d699226
Deprecate module_utils.common.collections.count (#85233)
Co-authored-by: 🇺🇦 Sviatoslav Sydorenko (Святослав Сидоренко) <wk.cvs.github@sydorenko.org.ua>
Co-authored-by: Matt Clay <matt@mystile.com>
2025-06-02 09:49:42 +02:00
Jordan Borean
b4741fc495
Exclude ansible._protomatter from ansible-doc output by default (#85115)
* Exclude ansible._protomatter from ansible-doc output by default

* Added changelog
2025-05-30 15:12:45 -07:00
Matt Davis
0ee1c36779
local connection always passes str to Popen (#85239) 2025-05-30 14:39:45 -07:00
Matt Davis
2a24633964
Misc ssh agent fixes (#85238)
* Misc ssh-agent fixes

* Replace manual SIGALRM handling with new alarm_timeout context manager
* Misc error handling fixes to ssh-agent startup
* Add SSH_AGENT_EXECUTABLE config to ease failure mode testing
* 100% test coverage on agent startup failure code

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

* make SSH Agent support internal

---------

Co-authored-by: Matt Clay <matt@mystile.com>
2025-05-30 13:38:59 -07:00
Matt Clay
eafe5fc739
Add missing warning methods and args (#85225) 2025-05-30 11:36:21 -07:00
Matt Davis
cbcefc53a3
Clean up TE error handling, wrap sigalrm handler (#85232)
* Clean up TE error handling, wrap sigalrm handler

* Preserve error detail on AnsibleAction and Connection exceptions.
* Remove multiple layers of unreachable or redundant error handling.
* Wrap manual alarm signal/timeout handling into a context manager, add tests.

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

* update error message check in test

* update test timeout message assertions

---------

Co-authored-by: Matt Clay <matt@mystile.com>
2025-05-30 10:45:10 -07:00
Brian Coca
d41a3430b7
async handling changed to use 'true' booleans(#85074)
async_status and async_wrrapper now use booleans instead of 0/1 for 'thruthyness'
gather_facts also updated

Co-authored-by: 🇺🇦 Sviatoslav Sydorenko (Святослав Сидоренко) <wk.cvs.github@sydorenko.org.ua>
Co-authored-by: Matt Clay <matt@mystile.com>
2025-05-30 08:32:49 -07:00
Martin Krizek
0e2f770a24
jinja2.__version__ is deprecated (#85221)
Prepare for its removal in Jinja 3.3.

See https://github.com/pallets/jinja/pull/2098
2025-05-30 11:40:10 +02:00
Matt Davis
91453e30af
Added _TEMPLAR_SANDBOX_MODE config (#85222)
* Added _TEMPLAR_SANDBOX_MODE config

* allows unsafe attribute checks to be disabled in Jinja sandbox

* Update lib/ansible/_internal/_templating/_jinja_bits.py

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

---------

Co-authored-by: Matt Clay <matt@mystile.com>
2025-05-30 01:37:58 +00:00
Matt Davis
b71d9aa4a5
Decouple SSH client verbosity from Ansible display (#85224)
* decouple SSH client verbosity from Ansible display

* remove failing false-coverage unit test
2025-05-29 09:58:16 -07:00
Matt Davis
356bf336bd
fix from_yaml_all filter inconsistent None handling (#85223)
* fix from_yaml_all filter inconsistent None handling

* always returns empty list for None or empty string input

* deprecate non-string inputs for from_yaml and from_yaml_all
2025-05-29 09:50:01 -07:00
Harshvardhan Sharma
f05b1d1ccf
Improve SUSE distribution detection using VARIANT_ID with fallback (#85152)
Co-authored-by: Abhijeet Kasurde <akasurde@redhat.com>
2025-05-29 09:20:15 -07:00
Martin Krizek
99a3346de6
dnf5 - handle all specific libdnf5 exceptions (#85175)
Fixes #84634
2025-05-29 11:51:12 +02:00
Kimmo Suominen
3b66150cc3
Recognize virtualization type correctly on Linode (#85184) 2025-05-27 17:27:01 +02:00
Martin Krizek
f635a22d81
apt_repository: remove Python 2 support (#85212) 2025-05-27 16:24:23 +02:00
Matt Clay
e226294855
display - Replace CRNL with NL (#85194) 2025-05-21 17:42:22 +00:00
Matt Clay
53b0f1645b
ansible-test - Add RHEL 10.0 remote (#85189)
* ansible-test - Add RHEL 10.0 remote

* Update tests for RHEL 10
* Fix iptables test
* Rework rpm_key integration test
2025-05-21 10:21:27 -07:00
Martin Krizek
c6a2e5ea75
csvfile lookup: remove Python 2 compat (#85186) 2025-05-21 09:54:24 -07:00
Jordan Borean
75f7b2267d
Add support for Windows App Control/WDAC (#84898)
* Add support for Windows App Control/WDAC

Adds preview support for Windows App Control, formerly known as WDAC.
This is a tech preview feature and is designed to test out improvements
needed in future versions of Ansible.

* Use psd1 and parse it through the Ast to avoid any unexpected execution results

* Add tests for various manifest permutations

* Ignore test shebang failure

* Apply suggestions from code review

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

* Use more flexible test expectations

* Add type annotations for shell functions

---------

Co-authored-by: Matt Davis <6775756+nitzmahone@users.noreply.github.com>
2025-05-21 12:28:58 +10:00
Matt Clay
e82be177cd
ansible-test - Improve deprecated checking type inference (#85159)
* ansible-test - Improve deprecated checking type inference

Also disabled the ``bad-super-call`` pylint rule due to false positives.

* Add type comment support

* Try without using register_transform
2025-05-20 11:23:06 -07:00
Matt Clay
feda0a5c6e
ansible-test - Fix option filtering (#85182) 2025-05-20 11:11:45 -07:00
Matt Clay
1e64707592
Remove unnecessary module shebang (#85183) 2025-05-20 05:41:33 +00:00
Matt Clay
242bb9ebab
DTFIX recategorization and error/warning refactor (#85181)
Co-authored-by: Matt Davis <nitzmahone@redhat.com>
2025-05-20 00:48:00 +00:00
Jordan Borean
fe2d9e316a
Fix constructable inventory default keyed group (#85002)
Fix the logic for a constructable inventory `keyed_groups` entry to use
the `default_value` if the ``key` expression result is `None` or `omit`
and not just an empty string. This bug was introduced with the changes
in data tagging and goes back to the original behaviour.

Co-authored-by: Sloane Hertel <19572925+s-hertel@users.noreply.github.com>
2025-05-15 09:52:47 -04:00
Matt Davis
e5476972da
ensure builtin tests always return bool (#85149)
* added unit test validation and coverage enforcement

Co-authored-by: Matt Clay <matt@mystile.com>
2025-05-13 02:53:23 +00:00
Matt Davis
7be1359841
misc changelog and docstring cleanup (#85148)
* deferred listify_lookup_plugin_terms deprecation

Co-authored-by: Matt Clay <matt@mystile.com>
2025-05-13 00:11:04 +00:00
Matt Davis
fc8a227647
ensure that all config return values are Origin-tagged (#85127)
Co-authored-by: Matt Clay <matt@mystile.com>
2025-05-09 22:10:55 +00:00
Matt Davis
9efba4f972
apply trust to declarative plugin config (#85126)
* trust strings in loaded doc fragments
* added tests
* added hard_fail_context test mechanism

Co-authored-by: Matt Clay <matt@mystile.com>
2025-05-09 19:33:33 +00:00
Lorenzo Tanganelli
8a4fb78988
facts: CloudStack KVM Hypervisor to Linux virtual fact (#85117)
Co-authored-by: Abhijeet Kasurde <akasurde@redhat.com>
2025-05-09 11:52:27 -07:00
Matt Clay
7b69cf3266
ansible-test - Relax some deprecation checks (#85122) 2025-05-08 17:08:18 -07:00
Matt Clay
4fe9606530
template module - render None as empty string (#85121)
* template module - render `None` as empty string

* Update changelogs/fragments/template-none.yml

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

---------

Co-authored-by: Matt Davis <6775756+nitzmahone@users.noreply.github.com>
2025-05-08 22:45:53 +00:00
Matt Davis
d33bedc48f
Misc config type coercion fixes (#85119)
* remove dead config comment noise

* update `list` typed config defaults to be lists

* fix tag preservation/propagation in config
* numerous other ensure_type bugfixes
* 100% unit test coverage of ensure_type
* emit warnings on template_default failures
* fix unhandled exception in convert_bool on unhashable inputs

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

---------

Co-authored-by: Matt Clay <matt@mystile.com>
2025-05-08 13:06:18 -07:00
omahs
471c5229a7
Fix typos (#85107) 2025-05-08 12:05:12 -07:00
Martin Krizek
8b9ddf5544
Passing warnings to exit/fail_json is deprecated. (#85109) 2025-05-07 11:02:04 -07:00
Martin Krizek
107842fd7d
dnf5: skip pkgs that don't satisfy bugfix/security when specified (#85111) 2025-05-07 10:52:23 -07:00
Matt Davis
ff6998f2b9
Switch to stackwalk caller ID (#85095)
* See changelog fragment for most changes.
* Defer early config warnings until display is functioning, eliminating related fallback display logic.
* Added more type annotations and docstrings.
* ansible-test - pylint sanity for deprecations improved.
* Refactored inline legacy resolutions in PluginLoader.

Co-authored-by: Matt Clay <matt@mystile.com>
2025-05-05 18:00:02 -07:00
Brian Coca
9f894b81c2
ensure predictable permissions on module artifacts (#84948)
and test it!
2025-04-30 10:09:06 -04:00
Martin Krizek
cff49a62ec
dnf5: avoid generating excessive history entries (#85065)
Fixes #85046
2025-04-29 16:51:22 +02:00
Matt Clay
0aa8afbaf4
ansible-test - Use -t for container stop timeout (#85019) 2025-04-28 21:06:12 -07:00
Brian Coca
aab732cb82
show internal but not hidden config options, while still hiding test options (#84997) 2025-04-24 12:48:12 -04:00
Matt Davis
03181ac87b
Implement TaskResult backward compatibility for callbacks (#85039)
* Implement TaskResult backward compatibility for callbacks
* general API cleanup
* misc deprecations

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

* fix v2_on_any deprecation exclusion for base

---------

Co-authored-by: Matt Clay <matt@mystile.com>
2025-04-24 00:59:46 +00:00
Abhijeet Kasurde
1daa8412d5
comment: raise an exception when an invalid option is provided (#84984)
Co-authored-by: Matt Clay <matt@mystile.com>
Signed-off-by: Abhijeet Kasurde <Akasurde@redhat.com>
2025-04-18 20:40:28 -07:00
Martin Krizek
4868effc71
get_bin_path('ssh-agent'): required is deprecated (#84995) 2025-04-15 16:30:29 +02:00
Felix Fontein
352d8ec33a
ansible-doc: fix indent and line wrapping for first line of (sub-)option and (sub-)return value descriptions (#84690)
* Fix initial indent for descriptions of suboptions.
* Fix line width for initial line of option descriptions.
2025-04-14 16:38:21 -04:00
Matt Davis
35750ed321
Templating overhaul, implement Data Tagging (#84621)
Co-authored-by: Matt Davis <mrd@redhat.com>
Co-authored-by: Matt Clay <matt@mystile.com>
2025-04-14 08:54:36 -07:00
Matt Clay
3d30e05bb4
ansible-test - Improve runme.sh error handling (#84972) 2025-04-11 20:56:34 +00:00
Abhijeet Kasurde
c54ff7de41
Filter: add support for URL-safe encoding/decoding in b64* (#84949)
* Added support for URL-safe decoding into b64decode
* Added support for URL-safe encoding into b64encode

Fixes: #84147

Signed-off-by: Abhijeet Kasurde <Akasurde@redhat.com>
2025-04-11 09:08:02 -07:00
Martin Krizek
244c2f06ed
Add ssh-agent launching, and ssh-agent python client (#84754)
* Add ssh-agent launching, and ssh-agent python client

* Move things around, is this better??

* docs

* postpone creating dir after bin lookup

* fix method name

* changelog ssh agent

* address reviews

* fix typing

* do not redefine public_key

* typing

* more typing

* Catch OSError when starting ssh agent

* likely copy pasted old code

* var type fix

* why is this needed?

ci_complete

* ignoring the change for now

* write out pub key file atomically

* defensive timeout for the socket

* _populate_agent docstring

* do not allow setting these in config

* check expected length before slicing blobs

* test all key types

* remove lock/unlock functionality

* docstring

* private _ssh_agent

* .

* launch agent in cli and ansible_ssh_*

* additional info for ssh-agent comment

* Add tests for remove and remove_all

* comment on os.rename

* hopefully mitigate agent startup/delays problems

* exceptions

* unused import

* fix sanity

* perf

---------

Co-authored-by: Matt Martz <matt@sivel.net>
2025-04-10 15:30:34 -07:00
Abhijeet Kasurde
82e4b469f6
respawn: Update ENV dict copy with PYTHONPATH value (#84962)
* Use shallow copy of os.environ to update PYTHONPATH value
  instead of using '|' operator

Fixes: #84954

Signed-off-by: Abhijeet Kasurde <Akasurde@redhat.com>
2025-04-10 15:14:24 -04:00
Brian Coca
4bc4030988
ansible-pull fix adhoc output inconsistencies on changed (#84869)
Two fixes for single bug:
  - ignore callback changes for adhoc
  - allow 'yaml' change matching
---------

Co-authored-by: Abhijeet Kasurde <akasurde@redhat.com>
2025-04-10 14:56:52 -04:00
Matt Martz
fd76cc2821
Revert "basic: remember the user sensitive information to use later (#84699)" (#84959)
This reverts commit 19e9f3dae2.
2025-04-10 11:19:11 -05:00
Abhijeet Kasurde
5347d4d4fc
distro: detect debian for OS_FAMILY for LMDE 6 (#84941)
Fixes: #84934

Signed-off-by: Abhijeet Kasurde <Akasurde@redhat.com>
2025-04-09 16:22:20 -04:00
Matt Clay
8b0c4825ae
Pin wheel to resolve build issues (#84943) 2025-04-08 22:31:23 -07:00
Brian Coca
72909599f6
pipelining fxies (#78111)
Moved check to connection as it should be the final decider
Added property to become plugins to indicate support
Also removed hardcoded su exception
Added tty detection logic for ssh (pipelining won't work if tty is needed or forced)

Co-authored-by: Sloane Hertel <19572925+s-hertel@users.noreply.github.com>
2025-04-08 15:53:38 -04:00
Abhijeet Kasurde
19e9f3dae2
basic: remember the user sensitive information to use later (#84699)
* Git allows embedding username and password in repo URL for
  https authentication. This may lead to exposing the user sensitive
  information to logs and unautheticated users.
  Adding no_log will partially solve this.
* Added documentation warning user about URL embedded with username
  and password.
* Added logic to remember user sensitive information for later sanitization

Fixes: #84557

Signed-off-by: Abhijeet Kasurde <Akasurde@redhat.com>
2025-04-08 09:53:36 -05:00
Matt Martz
6a274d8456
Handle forwarded exceptions from dnf5-5.2.13 (#84933) 2025-04-08 09:35:32 -05:00
Matt Clay
462affa7c4
Clean up interpreter discovery (#84394)
* Clean up interpreter discovery

- Deprecated `auto_legacy` and `auto_legacy_silent`
- Removed obsolete platform fallback config and logic
- Replaced unit tests with integration tests
- Increased test coverage
2025-04-03 18:07:36 +00:00
Matt Martz
390e112822
Support download_url without a scheme:host (#84767)
* Support download_url without a scheme:host. Fixes #84213

* Support properly rebuilding pagination links. #84765

* Don't permit non absolute pagination links

Co-authored-by: Sloane Hertel <19572925+s-hertel@users.noreply.github.com>
2025-04-02 20:21:41 +00:00
Abhijeet Kasurde
2a4b1c8248
ansible-config: Dump galaxy server config in proper JSON format (#84912)
Fixes: #84840

Signed-off-by: Abhijeet Kasurde <Akasurde@redhat.com>
2025-04-01 11:36:15 -04:00
Jordan Borean
7d0886457a
Windows Exec Runner Update (#84868)
Updates the Windows exec runner in preparation for the WDAC changes.
This new process is designed to improve the way modules are run by
Windows and expose common functionality to run PowerShell code in a
common environment. It also includes futher changes to improve the error
handling to make it easier to see where an error occurred in the running
code.
2025-04-01 11:24:35 +10:00
Ruchi Pakhle
3607f01521
Improve vault filter documentation with clearer examples (#84896)
Fixes: #83583

Signed-off-by: Abhijeet Kasurde <Akasurde@redhat.com>
2025-03-26 02:14:48 +00:00
Martin Krizek
e66aaa66a5
Improve performance of including tasks into the play (#84445)
* Improve performance of including tasks into the play

PlayIterator.add_tasks is used to insert tasks from an include into the
play for particular host. It makes a copy of the current block including
the tasks within the block and inserts the new tasks from the include
into the copied block. But there is no need to make copies of tasks
within the block, what we want is a "shallow" copy of the block. This
PR changes that to copy the block excluding the tasks within.

On a contrived playbook with 50 include_role tasks, each role has 1 task,
running on 10 hosts the running time is reduced from ~55s to ~44s in my
environment.

ci_complete

* Add changelog
2025-03-24 09:39:17 -05:00
Abhijeet Kasurde
5280850130
find: skip ENOENT while enumerating files (#84877)
* skip 'no such file or directory' error code while files and
  directories and report them.

Fixes: #84873

Signed-off-by: Abhijeet Kasurde <Akasurde@redhat.com>
2025-03-24 07:37:01 -07:00
Anvit Pusalkar
1e5aac7b4f
Set IPv4 and IPv6 simultaneously (#84829) 2025-03-21 16:19:58 -04:00
Matt Clay
b7a5411d8b
ansible-test - Improve pep8 compat with black (#84867) 2025-03-20 01:17:01 +00:00
Matt Clay
7e7946b60d
Require Jinja2 3.1.0 or later (#84864) 2025-03-20 00:21:26 +00:00
Brian Coca
0d4f00f5c8
needed intesect, not difference (#84839)
fixes #84750

Added tests to verify output when using smart + others
2025-03-19 10:41:30 -04:00
Robert Muir
61a6222e0e
uri: form location correctly from relative redirect (#84541)
* uri: form location correctly from relative redirect

Previously, the original URL would be combined with the relative location incorrectly, especially for URL of any complexity.

Add simple tests demonstrating the problem that fail without the fix

* fix pylint error, import the method similar to other uri methods

* add changelog fragment

Signed-off-by: Abhijeet Kasurde <Akasurde@redhat.com>
2025-03-18 15:54:48 -04:00
Jordan Borean
101e2eb19a
windows async - refactor async wrapper code (#84712)
Refactor the async wrapper and watchdog scripts for Windows. This
attempts to avoid WMI on connection plugins that allow breaking away
from a job like winrm and ssh as an optimisation and changes how WMI is
used so that we can get the error details on a failed process more
easily.

These changes are being made also in preparation for the WDAC
implementation that requires this new execution model where input needs
to be provided through stdin.
2025-03-19 04:47:32 +10:00
Matt Martz
8127abbc29
Don't inherit stdio (#82770) 2025-03-17 10:08:11 -05:00
Matt Martz
3684b4824d
Remove reliance on sshpass and utilize SSH_ASKPASS (#83936)
* Add SSH_ASKPASS as an alternative means to provide ssh with passwords
2025-03-17 10:07:44 -05:00
Matt Clay
4efb01c2f3
ansible-test - Replace FreeBSD 13.4 with 13.5 (#84812) 2025-03-11 15:21:38 -07:00
Martin Krizek
f11dfa7cce
dnf5: use new pkg_gpgcheck option, fallback to deprecated one (#84791) 2025-03-11 18:11:57 +01:00
🇺🇦 Sviatoslav Sydorenko (Святослав Сидоренко)
df08ed3ef3
🔥 Remove Python 2 datetime compat fallbacks
This patch marks the `ansible.module_utils.compat.datetime` module as deprecated, including `UTC`, `utcfromtimestamp()`  and `utcnow` shims that it provides, scheduling its removal for v2.21.

It also replaces any uses of the compatibility helpers with non-deprecated calls to CPython stdlib.

PR #81874

Co-authored-by: Matt Clay <matt@mystile.com>
2025-03-11 17:19:40 +01:00
Abhijeet Kasurde
50b4e0d279
facts: use pagesize for darwin (#84779)
Fixes: #84773

Signed-off-by: Abhijeet Kasurde <Akasurde@redhat.com>
2025-03-11 15:40:46 +00:00
Martin Krizek
7fbaf6cfcf
dnf5: fix is_installed check for provided packages (#84802)
Fixes #84578
2025-03-11 16:27:13 +01:00
🇺🇦 Sviatoslav Sydorenko (Святослав Сидоренко)
7e0d8398ff
Implement an informative reporter for resolvelib
Prior to this change, when the dependency resolver started looping over multiple versions of the same collection due to backtracking, it might take a lot of time to consider and disregard tens or hundreds of versions. But to the end-user, it looks like “nothing is happening, the program is *stuck*”. Even worse if such a time-consuming backtracking hits multiple collections and it “hangs” for longer cumulative period of time.

This patch improves the perceived responsiveness by printing out informational messages with the current status whenever the backtracking for a collection happens for the first, the eighth and the thirteenth times. The last message also reminds them that they can interrupt the process and attempt to adjust the constraints.

In debug mode, it also shows what caused conflicts leading up to candidate rejections. But this is only available with `resolvelib >= 0.9.0`.

The improvement is heavily inspired by https://github.com/pypa/pip/commit/9731131.

PR #81709

Co-Authored-By: Jordan Borean <jborean93@gmail.com>
2025-03-10 12:57:09 +01:00
Matt Martz
9bed0413ec
Deprecate the paramiko connection plugin. Fixes #83757 (#84727) 2025-03-04 09:05:28 -06:00
Matt Martz
00067f1d2e
Limit respawn to supported python versions (#83662)
* Limit respawn to supported python versions
2025-03-04 08:43:39 -06:00
🇺🇦 Sviatoslav Sydorenko (Святослав Сидоренко)
4a710587dd
🧪 Add macOS 15.3 to CI and ansible-test (#84665) 2025-02-25 18:55:03 +01:00
Jordan Borean
e9e6001263
winrm - Remove pexpect kinit code (#84735)
Removes the use of pexpect in the winrm connection plugin and rely on
just subprocess. In the past pexpect was used for macOS compatibility so
that it could handle the TTY prompt but after testing it seems like
subprocess with `start_new_session=True` is enough to get it reading
from stdin on all platforms. This simplifies the code as there's no
longer an optional library changing how things are called and will work
out of the box.
2025-02-25 04:59:04 +10:00
Matt Martz
2a3c93f593
Deprecate strategy plugins (#84728)
* Deprecate strategy plugins. Fixes #84725
2025-02-19 14:28:55 -06:00
Jordan Borean
e5ec1ee76c
Windows - Support WDAC Audit Mode (#84730)
Fix up bug when attempting to run any module on a Windows host that has
been configured with WDAC and Dynamic Code Security in audit mode. This
does not enable WDAC support with signed scripts so Ansible will still
not pass the audit events but it no longer fails to run.
2025-02-20 05:13:29 +10:00
Jordan Borean
a742e20fca
ansible-test validate-modules - fix ps util checks (#84610)
* ansible-test validate-modules - fix ps util checks

Fix the module util import checks done by `ansible-test sanity --test
validate-modules` to support the newer `#AnsibleRequires` import
statement and `-Optional` flag.

* Fix sanity issues
2025-02-19 07:42:22 +10:00
Martin Krizek
7a091bf486
Ensure implicit flush_handlers have a parent block (#84709)
* Ensure implicit flush_handlers have a parent block

To avoid getting tracebacks when calling methods like ``get_play()`` on
them.

* task needs to be copied

* copy only when necessary
2025-02-18 08:42:36 -06:00
simonLeary42
55e9e21ded
better error message for malformed documentation (#84705)
No the file name that caused the error will be apparent
---------

Signed-off-by: Abhijeet Kasurde <Akasurde@redhat.com>
Co-authored-by: Abhijeet Kasurde <Akasurde@redhat.com>
2025-02-17 16:12:14 -05:00
Martin Krizek
cc30f25c42
Make timeout on become an unreachable error (#84589)
* Make timeout on become an unreachable error

Fixes #84468
2025-02-17 08:49:50 -06:00
Matt Davis
5d7b8288f8
Fix local connection and become issues (#84700)
* Fixed various become-related issues in `local` connection plugin.
* Fixed various issues in `sudo` and `su` become plugins.
* Added unit and integration test coverage.

Co-authored-by: Matt Clay <matt@mystile.com>
Co-authored-by: Matt Davis <nitzmahone@redhat.com>
2025-02-13 09:17:57 -08:00
Martin Wilck
21492e27fa
Add openSUSE MicroOS to SUSE family list (#84685)
* Add openSUSE MicroOS to SUSE family list

Co-authored-by: Abhijeet Kasurde <akasurde@redhat.com>
2025-02-11 10:27:10 -05:00
Sloane Hertel
a086c34a91
linear - don't treat end_role as a run_once task (#84673) 2025-02-11 08:54:39 -06:00
🇺🇦 Sviatoslav Sydorenko (Святослав Сидоренко)
cdb1ce000a
Fix is_pinned property of Requirement (#81812)
Previously, requirement version specs starting with `!=` were
incorrectly considered as pinned release requests because the
comparison was being made against a one-char string while the
operator is two-char. This patch changes the check to test against `!`
which is enough to detect this case.
2025-02-08 00:01:23 +01:00
Matt Clay
7594243fc0
ansible-test - Update sanity test requirements (#84667) 2025-02-04 15:03:34 -08:00
Abhijeet Kasurde
8290912eb1
service_facts: skip unwanted lines in openrc output (#84622)
* rc-status commands returns unwanted lines with service names
  and their status. Skip such lines while parsing service names

Fixes: #84512

Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
2025-01-28 16:19:46 +01:00
Abhijeet Kasurde
6db6d1967e
connection: raise exception return by SSH (#84592)
Fixes: #58133

Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
2025-01-28 16:05:37 +01:00
Matt Clay
ce392dd86e
Revert "generator: add support for extra vars usage (#84544)" (#84619)
This reverts commit 186c716af1.
2025-01-27 17:59:29 -08:00
Abhijeet Kasurde
e6adddcaf8
debug: hide loop variables while using var (#84597)
Fixes: #65856

Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
2025-01-23 15:00:32 -08:00
Abhijeet Kasurde
c9097f73a2
uri: Handle HTTP exception raised (#84015)
* Handle HTTP exceptions raised when reading the content
  such as IncompleteRead

Fixes: #83794

Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
2025-01-21 21:39:28 +00:00
Abhijeet Kasurde
186c716af1
generator: add support for extra vars usage (#84544)
* generator: add support for extra vars usage

Fixes: #83270

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

* CI green

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

* Review requests

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

* Review requests II

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

---------

Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
2025-01-21 15:20:51 -05:00
Brian Coca
4953fc7b26
Apt key bye (#84555)
* apt-key module updates due to debian removal

Still kept for now for backwards compat, but removing from testing when not present
And adding more explicit mesasges to errors to point to new module

* added docs and error msg

* clog

* aslkdfj

* no docs to document doc changes

* also add warning to apt_repository

* clog on apt_repo too

* fix string concat

* Apply suggestions from code review

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

---------

Co-authored-by: Abhijeet Kasurde <akasurde@redhat.com>
2025-01-21 14:45:38 -05:00
Abhijeet Kasurde
b51ec9412e
cache: deprecated API first_order_merge (#84568)
* deprecated legacy method first_order_merge

Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
2025-01-21 09:33:22 -08:00
Jordan Borean
8c5e33cd3a
Ansible.Basic - Fix required_if check (#84562)
Fixes the Ansible.Basic `required_if` check when the option to check is
either unset or explicitly set to null.
2025-01-21 05:00:03 +10:00
Jordan Borean
f86c58e2d2
ssh - Improve CLIXML stderr parsing (#84569)
Improves the logic for parsing CLIXML values in the stderr returned by
SSH. This fixes encoding problems by having a fallback in case the
output is not valid UTF-8. It also can now extract embedded CLIXML
sequences in all of stderr rather than just at the start.
2025-01-21 04:42:12 +10:00
Lee Garrett
3030c79331
user: Fix homedir permissions when UMASK is unset in /etc/login.defs
When a user doesn't exist and user module is used to create the user and the
homedir, adduser is called which parses HOME_MODE from /etc/login.defs, and when
not set calculates the mode from UMASK from the same file.

When a user already exists without homedir, and the user module is used to add a
home dir, it incorrectly ignores HOME_MODE, resulting in a world-readable home
dir when UMASK is not set. This is for example the case in Debian trixie and
later, and likely Ubuntu 25.04 and later.


Signed-off-by: Lee Garrett <lgarrett@rocketjump.eu>
Co-authored-by: Brian Coca <bcoca@users.noreply.github.com>
Co-authored-by: Abhijeet Kasurde <akasurde@redhat.com>
2025-01-14 11:44:16 -08:00
Matt Clay
7677bf1c9b
ansible-test - Use urllib intead of curl (#84551)
Also added automatic retries on HTTP request exceptions, since all currently implemented methods (GET/PUT/DELETE) are idempotent.
2025-01-14 08:59:42 -08:00
Brian Coca
a046ef5a95
fix incongruent ansible-vault cli options (#84494)
prompt now only errors if stdin is specifically triggered and not due to lack of other args

fixes #84489
---------

Co-authored-by: Sloane Hertel <19572925+s-hertel@users.noreply.github.com>
2025-01-14 10:46:52 -05:00
Abhijeet Kasurde
5b0d170496
get_url: add support for BSD-style digest (#84485)
* Added support for BSD-style digest file to test
  checksum of downloaded file.

Fixes: #84476

Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
2025-01-14 15:44:29 +00:00
Kristopher Newsome
f727d74fc2
Allows iptables chain creation with wait parameter (#84491)
* Allows iptables chain creation with wait parameter

Fixes #84490

* Add the changelog fragment for 84490
2025-01-14 10:43:08 -05:00
Abhijeet Kasurde
8588401387
User: Update prompt for SSH key passphrase prompt (#84521)
* update prompt for SSH key passphrase prompt
* introduce timeout in SSH key passphrase interaction

Fixes: #84484

Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
2025-01-14 10:35:31 -05:00
Harilou
d79b706c06
fix[doc.py]: path will be undefined (#84464)
* fix[doc.py]: path will be undefined and a direct reference will throw an UnboundLocalError.

If none of the files in files exists, path will be undefined and a direct reference will throw an UnboundLocalError.
Repair function file parameter type annotation is inaccurate

* Update changelogs/fragments/fix-cli-doc-path_undefined.yaml

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

---------

Co-authored-by: Brian Coca <bcoca@users.noreply.github.com>
Co-authored-by: Sloane Hertel <19572925+s-hertel@users.noreply.github.com>
2025-01-14 15:33:43 +00:00
simonLeary42
e151cd765d
with_dict type error include value in error message (#84473)
* with_dict better error message

* include type in error message

* changelog fragment

* Update lib/ansible/plugins/lookup/dict.py

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

* specific wording

---------

Co-authored-by: Abhijeet Kasurde <akasurde@redhat.com>
2025-01-14 10:21:56 -05:00
Felix Fontein
ae55f874a0
Enforce FQCNs in seealso plugin/module entries. (#84325) 2025-01-13 17:24:09 -05:00
Felix Fontein
60e2135c2b
Bump acme test container to 2.3.0 (#84547) 2025-01-13 11:24:56 -08:00
xzeck
40d364985d
host_group_vars - fix Python API traceback caused by undefined 'key' variable (#84488)
Fixes:

Traceback (most recent call last):
  File "/home/shertel/ansible/lib/ansible/plugins/vars/host_group_vars.py", line 139, in get_vars
    FOUND[key] = found_files = loader.find_vars_files(opath, entity_name)
          ^^^
UnboundLocalError: cannot access local variable 'key' where it is not associated with a value

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/shertel/ansible/lib/ansible/plugins/vars/host_group_vars.py", line 151, in get_vars
    raise AnsibleParserError(to_native(e))
ansible.errors.AnsibleParserError: cannot access local variable 'key' where it is not associated with a value
2025-01-13 11:51:49 -05:00
Matt Clay
eb475e23f7
ansible-test - Update utility containers (#84545) 2025-01-11 01:09:48 +00:00
Brian Coca
20baf29a2a
fix warnings about reserved variable names to cover all sources (#84432)
Also remove redundant check from tqm
Now covers module output (set_fact/include_vars)
Includes play objects at any stage (tasks that error were not covered)
Added tests, moved them to role structure
2025-01-10 18:03:18 +00:00
simonLeary42
64cbb71e6e
FIX get_options function for CallbackBase (#84496) 2025-01-08 11:26:42 -05:00
Matt Clay
3b77277428
ansible-test - Fix FreeBSD instance CA certs (#84529)
Some versions and architectures come with `ca_root_nss` pre-installed.
However, at least FreeBSD 13.4 on aarch64 does not.
This change ensures the certificates will always be installed.
2025-01-07 19:17:35 -08:00
Matt Clay
1b3face065
ansible-test - Replace FreeBSD 14.1 with 14.2 (#84527)
* ansible-test - Replace FreeBSD 14.1 with 14.2

* Remove cron faketime testing from FreeBSD
2025-01-07 17:15:27 -08:00
Matt Clay
f552fe2c15
ansible-test - Replace RHEL 9.4 with 9.5 (#84526) 2025-01-07 15:11:33 -08:00
Matt Clay
35c4b58c11
ansible-test - Replace Alpine 3.20 with 3.21 (#84525) 2025-01-07 14:37:35 -08:00
Matt Clay
648dcd3a6a
ansible-test - Replace Fedora 40 with 41 (#84281)
* ansible-test - Replace Fedora 40 with 41

Also update other distro containers to remove unnecessary packages:

* apache2
* subversion
* ruby

* Fix subversion test on Ubuntu

Also remove obsolete vars files from subversion test.

* Skip dnf test on Fedora 41+

The dnf5 test is all that is needed.

* Support dnf5 for the package test

* Extend unix-chkpwd work-around for Fedora
2025-01-07 13:46:48 -08:00
Matt Martz
3a33d8a4c1
Add Keycloak service account auth capability to ansible-galaxy (#83145) 2025-01-07 12:02:22 -06:00
Matt Clay
eb6d581286
ansible-test - Update nios-test-container to 7.0.0 (#84517) 2025-01-06 15:59:58 -08:00
Brian Coca
c64c389007
gather_facts, fix 'smart' handling with network os and 'setup' (#84425)
gather_facts, fix network_os and smart logic and defaults

setup will be default for smart only if network_os is not set, now you get warnings and errors when missing a valid facts module for a network os

Co-authored-by: Abhijeet Kasurde <akasurde@redhat.com>
2024-12-17 10:19:43 -05:00
Abhijeet Kasurde
01ca9b1d0e
uri: move follow_redirects to module_utils (#84442)
* url lookup and uri module shares follow_redirects parameter,
  moving it module_utils code.

Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
2024-12-10 08:08:24 -08:00
David Lassig
106909db8b
adding option for form-multipart data to switch multipart encoding (#80566)
* adding option for form-multipart data to switch multipart encoding from default base64 to 7or8bit encoding

Co-authored-by: davlas <david.lassig@bwi.de>
Co-authored-by: Abhijeet Kasurde <akasurde@redhat.com>
Co-authored-by: Sloane Hertel <19572925+s-hertel@users.noreply.github.com>
2024-12-10 07:54:23 -08:00
Matt Martz
73d8f4ad46
Make sure we are always using Lock from our multiprocessing context (#84453)
* Make sure we are always using Lock from our multiprocessing context

* add clog frag
2024-12-10 10:38:57 -05:00
spyinx
563906687b
Fix a debug message error (#84426) 2024-12-10 10:13:22 -05:00
Brian Coca
3c91eab0d8
copy, prevent internal options in task (#84422)
* copy, prevent internal options in task

fixes #84367
2024-12-10 10:07:12 -05:00
Sloane Hertel
f0f5d7f88b
simplify copy module (#84313)
* simplify redundancy with AnsibleModule set_*_if_different methods

* simplify copying a source directory to a dest directory without modifying behavior
2024-12-10 09:09:15 -05:00
Herman van Rink
363c57b311
csvfile - let the config system do the typecasting (#82263)
Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
2024-12-06 16:15:17 +00:00
Abhijeet Kasurde
ac110eb012
lookup_template: added trim_blocks option (#84254)
* Allow user to control the trimming of blocks while templating
* Added tests
* Updated documentation and example

Fixes: #75962

Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
2024-12-06 15:44:08 +00:00
Stefano Rivera
d500354798
unarchive: Clamp zip timestamps on 32-bit time_t (#84409)
Clamp zip timestamps to representible values when unpacking zip files on
platforms that use 32-bit time_t (e.g.  Debian i386). This is a
non-issue in practice (in 2024), but should allow the test suite to pass
on Debian i386.

We use a round value of 2038-01-01 00:00:00 for simplicity, and to avoid
running into timezone offsets closer to the actual limit.

MR #81520 introduced sanity-checking tests that used dates not
representable with a 32-bit time_t.
2024-12-05 17:26:58 -05:00
Alex Willmer
59d9737788
fix reset_connection with templated connection variables (#84240)
* ssh: Test reset_connection with templated ansible_ssh_executable

Add failing test to confirm subsequent fixes are necessary & sufficient.

* ssh: Fix reset_connection with templated ansible_ssh_executable

Signed-off-by: Alex Willmer <alex@moreati.org.uk>
2024-12-05 15:54:46 -05:00
Alex Willmer
e2b454f4e3
wait_for_connection: fix errant warning for local connection(s) (#84421)
This prevents "[WARNING]: Reset is not implemented for this connection" when
using wait_for_connection with localhost or other local hosts.

It's arguable (from a consistency/correctness perspective) that
`ansible.plugins.connection.local.Connection.reset()` should call
`Connection.close()`. I went for a no-op on the basis of "if it aint broke
don't fix it", and erred on the side of keeping existing semantics. However
either option would be fine with me.
2024-12-05 14:56:14 -05:00
Abhijeet Kasurde
b154e38e54
config lookup, fixes and tests (#84398)
* Integration tests for lookup_config

Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
2024-12-05 11:19:34 -08:00
Abhijeet Kasurde
1ad0c404ef
Coverage for virtual/sunos.py (#84357)
Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
2024-12-03 09:11:49 -08:00
Tobi
803cf7df41
Add ansible_uptime_seconds support for AIX (#84321)
Added ansible_uptime_seconds fact for AIX

Co-authored-by: Abhijeet Kasurde <akasurde@redhat.com>
2024-12-03 10:12:39 -05:00
Abhijeet Kasurde
9588215601
Removed deprecated include_delegate_to param (#84306)
* Removed deprecated include_delegate_to param

* Remove deprecated include_delegate_to param from
  get_vars API in manager.py

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

* Make ignore.txt

Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
2024-12-03 10:04:32 -05:00
Jordan Borean
f9b58fa13f
ansible-test - fix coverage for test modules (#84366)
Fixes the coverage path translation for modules located in integration
test paths. Instead of trying to match by the unique temporary path name
that the module is executed as, the reporting tool will translate it to
the static path that the module is actually located under.
2024-11-27 13:43:06 +10:00
Martin Krizek
2a53b851fe
dnf5,apt: add auto_install_module_deps option (#84292)
* dnf5,apt: add auto_install_module_deps option

Fixes #84206
2024-11-21 10:06:18 -06:00
Matt Clay
95e3af3e0f
ansible-test - Improve container network detection (#84323)
When detection of the current container network fails, a warning is now issued and execution continues.
This simplifies usage in cases where the current container cannot be inspected, such as when running in GitHub Codespaces.
2024-11-19 10:49:24 -08:00
Martin Krizek
c99493eb3f
dnf5 - consolidate package resolving settings (#84335)
Fixes #84334
2024-11-19 18:00:35 +01:00
Martin Krizek
a27a7a27d1
dnf5: fix is_installed check (#84275)
Fixes #84259
2024-11-19 09:32:04 +01:00
Sloane Hertel
3e82ed307b
include_vars - fix including new hash variables when hash_behaviour is set to merge (#84303) 2024-11-14 13:50:14 -05:00
James Ramsaran
e14f9fe725
Sequence query fix (#83758)
Co-authored-by: flowerysong <junk+github@flowerysong.com>
2024-11-13 19:46:57 -08:00
Abhijeet Kasurde
32eacecca9
Deprecated libvirt_lxc_noseclabel config (#84287)
* Deprecated libvirt_lxc_noseclabel config

* deprecate moved libvirt_lxc_noseclabel config

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

* Make CI green I

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

---------

Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
2024-11-12 16:13:45 +01:00
Brian Coca
e404bc17f7
package_facts fix empty packages on foreign mgr (#83855)
* package_facts fix empty packages on foreign mgr

return the first package manager that provides output

add tests with fake rpm on apt machines
2024-11-12 08:36:26 -05:00
Jordan Borean
3befdd3d15
Fix runas become SYSTEM logic (#84280)
Fixes the logic when attempting to become the SYSTEM user using the
runas plugin. It was incorrectly assumed that calling LogonUser with the
SYSTEM username would produce a new token with all the privileges but
instead it creates a copy of the existing token. This reverts the logic
back to the original process and adds in new logic to avoid any tokens
that are restricted from creating new processes.
2024-11-12 09:16:22 +10:00
Jordan Borean
7501bbec20
Add support for Windows Server 2025 (#84285)
Adds Windows Server 2025 to the testing matrix.
2024-11-08 12:28:20 +10:00
Matt Clay
a98801903d
ansible-test - Replace FreeBSD 13.3 with 13.4 (#84236)
* ansible-test - Replace FreeBSD 13.3 with 13.4
* ansible-test - Fix typos in bootstrap.sh
* Skip libfaketime on FreeBSD except FreeBSD 14
2024-11-07 13:19:26 -08:00
Alexei Znamensky
1d61f2a4fd
remove ignore clauses for module uri (#83642)
Co-authored-by: flowerysong <junk+github@flowerysong.com>
2024-11-07 14:56:51 +00:00
Brandon Bennett
31cde0ebd1
user: create Buildroot subclass as alias to Busybox (#83666)
Fixes: #83665
2024-11-07 14:45:32 +00:00
Sloane Hertel
157ef04b1e
Add --flush-cache option to ansible-pull (#84211) 2024-11-06 11:40:15 -05:00
Sloane Hertel
771f7ad29c
update ansible-galaxy resolvelib requirement to >= 0.5.3, < 2.0.0 (#84218)
* Update resolvelib upperbound to 2.0.0

Minor SemVer releases should not contain breaking changes

* Test the latest minor release and reduce number of resolvelib versions tested for efficiency
2024-11-06 10:20:26 -05:00
Matt Clay
68bfa37838
ansible-test - Fix interactive cmd traceback (#84264) 2024-11-05 23:50:34 +00:00
spyinx
9cdd6e58b3
Fixed ipv6 pattern in parse_address (#84237) 2024-11-05 08:05:21 -08:00
Abhijeet Kasurde
a99d66e6c7
Removed deprecated STRING_CONVERSION_ACTION (#84245)
Fixes: #84220

Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
2024-11-05 16:27:12 +01:00
Abhijeet Kasurde
8784469b4c
encrypt: raise error on passing unsupported passlib hashtype (#84186)
* Raise an AnsibleFilterError when unsupported passlib hashtype is
  provided in do_encrypt.

Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
2024-10-31 15:27:37 +00:00
anvitpusalkar
2c6b78f516
Add --flush-cache option for ansible and ansible-console (#84149)
* Allow CLIs that accept inventory options to flush the inventory cache(s) and fact cache

Fixes #83749
2024-10-30 14:59:01 -04:00
Sloane Hertel
03acb22f99
Fix returning unreachable for looped tasks (#84049)
* Fix returning unreachable for looped tasks

Add tests for ignore_unreachable and loop
2024-10-30 10:35:23 -04:00
Abhijeet Kasurde
3a40ba3b2c
Remove deprecated pycompat24 and importlib (#84161)
* Removed deprecated pycompat24 and importlib

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

* Make CI green

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

* Ignore basic.py

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

* Make CI green III

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

* Make CI green IV

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

---------

Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
2024-10-29 16:14:01 +01:00
Abhijeet Kasurde
1b46b5923e
Change changelog type from bugfixes to removed_features (#84158)
Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
2024-10-29 16:09:20 +01:00
Abhijeet Kasurde
f29b46e438
Remove deprecated plural form of collection path (#84156)
Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
2024-10-29 16:07:20 +01:00
Conner Crosby
d662a8d088
Enable file module to disable diff_mode (#83700)
Several tasks within the modification_time.yml and state_link.yml task
lists have explicitly enabled diff_mode because these tests previously
assumed a diff attribute would always be returned from the file module.
2024-10-25 18:32:11 +00:00
Abhijeet Kasurde
ab1a8cb3b3
docs: print deprecation collection name (#84126)
While showing the deprecation message, mention the collection name
from which the module is removed.

Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
2024-10-25 11:20:11 -07:00
Matt Davis
c9ac477e53
Preserve _ansible_no_log from action result; fix include_vars to set properly (#84143)
* fixes for CVE-2024-8775

* propagate truthy `_ansible_no_log` in action result (previously superseded by task-calculated value)
* always mask entire `include_vars` action result if any file loaded had a false `show_content` flag (previously used only the flag value from the last file loaded)

* update no_log tests for CVE-2024-8775
* include validation of _ansible_no_log preservation when set by actions
* replace static values with dynamic for increased robustness to logging/display/callback changes (but still using grep counts :( )

* changelog

* use ternary, coerce to bool explicitly
2024-10-24 22:56:54 +00:00
Brian Coca
11e4a6a722
user module avoid conflicts ssh pub key (#84165)
Remove pub key if we are going to generate private
fix tests for os X
2024-10-24 14:39:51 -04:00
Abhijeet Kasurde
b1816880cb
Remove deprecated compat.selector (#84155)
* Removed files related to selector compat

Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
2024-10-23 14:54:40 +00:00
ShIRann Chen
58cb8ca4fa
feat: checksum_algo param for find module (#83014)
Co-authored-by: shirann <shirannx@gmail.com>
Co-authored-by: Sviatoslav Sydorenko (Святослав Сидоренко) <webknjaz@redhat.com>
2024-10-11 11:02:39 -07:00
Matt Clay
48be6f8b6f
ansible-test - Improve container probe error handling (#84109) 2024-10-10 22:58:38 +00:00
Brian Coca
6aaac6cab3
service_facts: add FreeBSD support (#82556)
new freebsd scanner using 'their version' of service cli tool
also avoid loading the linuxy service scanner when freebsd
2024-10-10 14:22:21 -04:00
Matt Clay
b3950bc864
Add NoReturn annotations in module_utils (#84106) 2024-10-10 16:58:27 +00:00
Matt Clay
62ce21b6e4
ansible-test - Work around pylint issue on 3.11 (#84094) 2024-10-09 17:19:55 +00:00
Matt Clay
0b661438a0
ansible-test - Update base/default containers (#84089) 2024-10-08 18:33:04 -07:00
Brian Coca
0959472bc6
user module, avoid chmoding symlink'd home file (#83956)
also added tests

---------
Co-authored-by: Sviatoslav Sydorenko (Святослав Сидоренко) <wk.cvs.github@sydorenko.org.ua>
Co-authored-by: Sloane Hertel <19572925+s-hertel@users.noreply.github.com>
2024-10-08 13:15:34 -04:00
Martin Krizek
f1f0d9bd53
PlayIterator: skip tasks from already ran roles (#83793)
... so strategies do not have to filter them.
2024-10-08 07:28:02 +02:00
Sloane Hertel
d0df3a174a
ansible-galaxy - fix ignoring certs when installing from git repos (#83332)
* Fix installing collections|roles from git repos with GALAXY_IGNORE_CERTS

* Fix installing collections from git repos with --ignore-certs

* Update unit test

* Add test case
2024-10-07 18:42:49 -04:00
Matt Clay
3cf308f672
ansible-test - Disable pylint deprecated-* rules (#84050) 2024-10-04 08:31:46 -07:00
Martin Krizek
0f4f05ebe4
Implicit flush_handlers inherit play tags (#83968) 2024-10-04 09:47:28 +02:00
Sloane Hertel
ee9e6130a7
Fix error message given by ansible.module_utils.facts.timeout.timeout (#83945)
* Update unit test

Co-authored-by: Sviatoslav Sydorenko (Святослав Сидоренко) <wk.cvs.github@sydorenko.org.ua>
2024-10-03 21:54:54 +00:00
Matt Clay
9406ed3109
ansible-test - Update sanity tests and default Python (#83998)
* ansible-test - Update sanity test requirements
* ansible-test - Default to Python 3.13 in base/default containers
* ansible-test - Fix incorrect AnyStr type hints
2024-10-03 09:59:56 -07:00
Martin Krizek
d6d2251929
Reduce number of implicit meta tasks (#84007)
This greatly reduces run time on large inventories since meta tasks are
executed in the main process sequentially and just executing them is expensive.

This change avoids running the following implicit meta tasks:
  * ``flush_handlers`` on hosts where no handlers are notified
  * ``noop`` for the linear strategy's lockstep, instead hosts that are
    not executing the current task are just not part of the current host loop

A playbook consiting of two simple plays both running on ~6000 hosts
runs in:
devel: 37s
this PR: 1.3s

Co-authored-by: Sloane Hertel <19572925+s-hertel@users.noreply.github.com>
Co-authored-by: Sviatoslav Sydorenko (Святослав Сидоренко) <wk.cvs.github@sydorenko.org.ua>
2024-10-03 16:02:02 +02:00
Abhijeet Kasurde
02e00aba3f
file: simplify the code (#84043)
* Remove unnecessary code
* Make code simple to read

Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
2024-10-03 06:53:09 -07:00
Martin Krizek
f593eb42a3
get_url: properly parse filename in content-disposition (#83748)
Since we don't really care about the type we don't have to
query for it and just retrieve the filename value.
Unfortunately we cannot use module_utils.urls.get_response_filename
as we don't have the response object, so just utilize
email.message.Message to parse the filename
instead of manually doing the work ourselves.

Fixes: #83690
2024-10-03 15:36:42 +02:00
Matt Clay
9abc651cd6
ansible-test - Update nios-test-container to 6.0.0 (#84042) 2024-10-02 16:37:37 +00:00
Alexei Znamensky
bebc192c3e
remove one ignore clause for module copy (#83643)
---------
Co-authored-by: flowerysong <junk+github@flowerysong.com>
2024-10-02 13:53:58 +00:00
Jack Farzan
4c8fb12fc2
cron: return stdout and rc for cron command (#83290)
Co-authored-by: Jack Farzan <jfarzan@adobe.com>
2024-10-01 14:45:27 -07:00
Abhijeet Kasurde
79e8c4c26c
debconf: set empty password value (#83217)
Fixes: #83214

---------
Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
2024-10-01 11:48:57 -04:00
uber-dendy
f97adb4c5d
Add additional logging for SSH runtime output timeouts and escalation messages (#84008)
Signed-off-by: Yuri Savinkin <stkwar@gmail.com>
Co-authored-by: Abhijeet Kasurde <akasurde@redhat.com>
2024-09-30 11:26:21 -04:00
Brian Coca
3d40db1ac0
INVENTORY_IGNORE_EXTS stop ignoring ini (#84001)
* INVENTORY_IGNORE_EXTS stop ignoring ini

Originally added to avoid configuration files for inventory scripts
now clashes with the much more common ini inventory files.

* add a note to script plugin

* Update lib/ansible/plugins/inventory/script.py

Co-authored-by: Abhijeet Kasurde <akasurde@redhat.com>
2024-09-26 12:15:34 -07:00
Abhijeet Kasurde
34f8f55d9e
facts: Skip path if the distribution path is directory (#84012)
* facts: Skip path if the distribution path is directory

Skip path if the distribution path is directory instead of file.
Handle exception raised while handling distribution path.

Fixes: #84006

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

* Review requests

---------

Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
2024-09-26 15:05:57 -04:00
Martin Krizek
21fee95af7
package/dnf action plugins: better facts failure msg (#83995) 2024-09-26 09:19:00 +02:00
Brian Coca
0c8efa29b2
Ansible Errors, Don't hide stacked messages when yaml (#83933)
Also remove redundant msg now that we fixed yaml case
So no more need to %s % e.

Co-authored-by: Abhijeet Kasurde <akasurde@redhat.com>
2024-09-24 13:58:41 -04:00
Felix Fontein
f4e2e206b3
Add basic validation for action_groups (#83965)
Co-authored-by: Sloane Hertel <19572925+s-hertel@users.noreply.github.com>
2024-09-24 17:15:43 +02:00
Martin Krizek
0a100c7f06
dnf5: fix tb when plugins API is not available (#83969)
Follow up on https://github.com/ansible/ansible/pull/83105
2024-09-24 10:52:20 +02:00
Matt Davis
491a87215a
zap changelogs (#83988) 2024-09-23 16:20:13 -07:00
Abhijeet Kasurde
b5263c2c10
isidentifier: Remove Python 2 specific code (#83688)
Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
2024-09-23 20:41:08 +00:00
Matt Clay
7693c892fa
ansible-test - Use Python version in pylint contexts (#83984) 2024-09-23 13:40:10 -07:00
Martin Krizek
aa24e97435
dnf5: re-introduce `state: installed` alias (#83961)
Fixes #83960
2024-09-23 09:33:38 +02:00
Brian Coca
6efb30b43e
Do not convert floats to ints when there is truncation (#83864)
Adjusted error messages
fixed tests
removed py2 compat tests, since no more py2

Co-authored-by: Matt Clay <matt@mystile.com>
2024-09-20 10:06:15 -04:00
Sloane Hertel
40ade1f84b
Add mount_facts module (#83508)
* Add a mount_facts module capable of gathering mounts skipped by default
fact gathering

* By default, collect mount facts from standard locations including
/etc/mtab, /proc/mounts, /etc/fstab, /etc/mnttab, /etc/vfstab, and on AIX,
/etc/filesystems.

When no file-based source for the current mounts can be found
(like /proc/mounts), the module falls back to using mount as a source.
This allows BSD and AIX to collect the existing mounts by default, without
causing Linux hosts to use both /proc/mounts and mount output.

* Non-standard locations and "mount" can be configured as a sources.

* Support returning an aggregate list of mount points in addition to first
found.

When there are multiple mounts for the same mount point in an
individual source, a warning is given if the include_aggregate_mounts
option is not configured.

* Add options to filter on fstypes and devices (supporting UNIX shell
wildcards).

* Support configuring a timeout and timeout behavior to make it easier
to use the module as a default facts module without risking a hang.

* Include the source and line(s) corresponding to a mount for easier
debugging.

Co-authored-by: Brian Coca <bcoca@users.noreply.github.com>
Co-authored-by: Matt Clay <matt@mystile.com>
Co-authored-by: Matt Davis <6775756+nitzmahone@users.noreply.github.com>
2024-09-19 15:05:05 -04:00
Sloane Hertel
85d9a40aac
Clarify galaxy CLI --help about install locations (#83919)
* add descriptions for `ansible-galaxy install` and `ansible-galaxy role|collection install`

* fix the usage for installing roles and collections together and include collections in the description for -r

Closes #81159

Co-authored-by: Alan Rominger <arominge@redhat.com>
Co-authored-by: Sandra McCann <samccann@redhat.com>
2024-09-18 15:07:21 -04:00
Brian Coca
bcee35385b
timedout extended (#83953)
* timedout extended

* add timedout test
2024-09-18 09:58:30 -05:00
Jordan Borean
b5ae8a382b
runas - create new SYTEM token for become (#83827)
Instead of re-using the token used in impersonation, this change will
create a new token for the SYSTEM account as returned by LogonUser. The
benefits of this is that the token will contain the full privileges for
the SYSTEM account rather than potentially one that has restricted
privileges we used during impersonation. It should also help avoid
problems on Windows that fails on status 0x0000016F when the
impersonated token during become was from a process that is restricted
from creating sub processes.
2024-09-13 14:25:58 +10:00
Brian Coca
47e64dc371
service_facts, fix systemd/ubuntu failed reporting (#83424)
Avoid check description, better comments
2024-09-10 13:32:52 -04:00
Brian Coca
9c49fdd86d
delay keyword changed from int to float (#83901)
* delay keyword changed from int to float

* draft test

* fixed test

* expanded test, fixed 'name' tests also

* cleanup

* fix
2024-09-06 14:50:35 +10:00
Brian Coca
4fa512406b
loop_control "early exit" feature (#62151)
* add a loop_control break_when directive to break out of a loop after any item

* remove loop var as normal exit would

* example usage:

- name: generate a random password up to 10 times, until it matches the policy
  set_fact:
    password: "{{ lookup('password', '/dev/null', chars=character_set, length=length) }}"
  loop: "{{ range(0, 10) }}"
  loop_control:
    break_when:
      - password is match(password_policy)

Co-authored-by: s-hertel <19572925+s-hertel@users.noreply.github.com>
2024-09-05 10:16:23 -04:00
Jordan Borean
1a4644ff15
psrp - Remove extras lookups (#83760)
* psrp - Remove extras lookups

Removed the extras variable lookups for the psrp connection plugin. All
valid options are already documented and the extras functionality is
slated to be deprecated at a future point in time. This should have
affect on existing user's playbooks.

* Fix up sanity tests and add explicit boolean conversion test
2024-09-02 11:58:46 +10:00
Jordan Borean
1503805b70
Add location on include_tasks fail inside include (#83876)
Adds the datastore details to the parser error when attempting to
include tasks that contain include_tasks without a filename set. This
change will now display the exact location of the include_tasks that
failed like any normal syntax error.
2024-09-02 06:21:30 +10:00
Matt Clay
4346430003
ansible-test - Reduce scope of empty-init test (#83878) 2024-08-30 16:46:45 -07:00
Jordan Borean
9a5a9e48fc
Improve testing for Windows SSH and other connection plugins (#83834)
Expands the test matrix used for testing on Windows to cover the three
connection plugins we support for all the tasks. This change also
changes how raw commands are run over SSH to avoid starting a
`powershell.exe` process that was uneeded in the majority of cases used
in Ansible. This simplifies our code a bit more by removing extra
Windows specific actions in the ssh plugin and improves the efficiency
when running tasks.
2024-08-29 06:27:16 +10:00
Matt Clay
db04499f58 ansible-test - Update nios-test-container to 5.0.0 2024-08-28 10:58:40 -07:00
Brian Coca
2a676ff897
copy, fix permissions and atime on diff partitions (#83824)
we just set time also, when on diff partitions
2024-08-26 14:22:15 -04:00
Felix Fontein
faf446a895
runtime-metadata sanity test: do not fail deprecation version checks if galaxy.yml has empty version (#83831)
* Do not create invalid SemanticVersion objects.
* Fix SemanticVersion.parse().
* Add basic runtime-metadata tests.
2024-08-26 13:59:34 -04:00
jctanner
bed9a9597a
galaxy-cli tasking polling interval from environment variable (#83803)
Added configuration options, including environment variables to control the polling 
No-Issue

---------
Signed-off-by: James Tanner <tanner.jc@gmail.com>
Co-authored-by: s-hertel <19572925+s-hertel@users.noreply.github.com>
Co-authored-by: Jordan Borean <jborean93@gmail.com>
2024-08-26 10:14:50 -04:00
Jordan Borean
b5e0293645
powershell - Improve CLIXML parsing (#83847)
Improves the logic used when parsing CLIXML to support all escaped
character sequences and not just newlines.
2024-08-23 11:10:12 +10:00
Matt Martz
9b0d2decb2
Handle authentication errors and token expiration (#83695)
Fixes #70019
2024-08-22 13:57:02 -05:00
Martin Krizek
5ab5f23487
dnf: stop filtering exceptions by matching on text (#83297)
* Rely on dnf.base.remove, no special handling isn't needed,
  let the dnf internals figure out what is needed to be done.
  This is more in line with what dnf cli does.

* "already installed" in Exception (if it is even a thing) should be
  caught by special exceptions like MarkingError or CompsError. This
  appears to be a historic check that is no longer needed.

Supersedes: #83295
2024-08-21 15:45:28 +02:00
Brian Coca
718ce13673
connection plugins: extras fix (#83353)
Currently we match the load name, which can be an fqcn, but most users expect the 'naked' name
Now plugins can declare that name by setting _extras_prefix property or fallback to 'non fqcn' if no extras prefix
2024-08-19 11:20:34 -04:00
Brian Coca
90de03be50
Gather mount facts, fallback for when multiproc is not feasable (#83750)
* fallback to 'single threaded gathering' for when multiproc fails

Co-authored-by: Sviatoslav Sydorenko (Святослав Сидоренко) <wk.cvs.github@sydorenko.org.ua>
2024-08-19 10:25:29 -04:00
Jordan Borean
520fa688ba
ssh and psrp - Support more complex characters in fetch_file (#83753)
* ssh and psrp - Support more complex chars in fetch_file

Fixes the psrp and ssh (with piped) fetch function to work with paths
that contains glob like characters in the path. For Windows this was
needed when using paths that contain `[]` in the path. For ssh this was
a problem with FreeBSD when using the piped transfer method with similar
characters.

Also tidies up the psrp logic to not inject the paths and buffer size
in the script but pass it as an object through an argument/parameter.

* Fix sanity check
2024-08-19 04:21:24 +10:00
Matt Clay
81e025b414 ansible-test - Add Windows remote connection option 2024-08-15 13:40:42 -07:00
Matt Clay
ab624ad031
ansible-test - Remove generation of egg-info (#83786)
Also remove egg-info generation from hacking/env-setup scripts.
2024-08-14 09:03:51 -07:00
dkuji
26375e7f12
fix copy module update atime/mtime (#83235)
Ensure we force mtime/atime update when using copystat

Co-authored-by: Sloane Hertel <19572925+s-hertel@users.noreply.github.com>
Co-authored-by: Brian Coca <bcoca@users.noreply.github.com>
2024-08-14 14:43:12 +00:00
Martin Krizek
89137cb5a0
Add end_role meta task (#83263)
ci_complete
2024-08-13 16:48:59 -05:00
Martin Krizek
9a54ba5a39
Ensure skipped loop iteration register var is available (#83756)
Fixes #83619
2024-08-13 12:48:49 -05:00
Martin Krizek
5c84220dbb
Fix meta tasks breaking host/fork affinity with host_pinned (#83438)
Fixes #83294
2024-08-13 10:39:00 -05:00
Martin Krizek
a0f9bbf3f3
ini lookup: add new interpolation option (#83773)
Fixes #83755
2024-08-13 11:04:42 -04:00
Matt Clay
b25afbb4e9
Suppress cryptography warnings for paramiko (#83772) 2024-08-12 17:28:27 -07:00
Sloane Hertel
2b91c57c85
atomic_move - fix creating file in directory with setgid bit (#83718)
* fix creating file in directory with setgid bit

* add a test using the copy module's content option to create a file in a directory with setgid bit

Co-authored-by: Martin Krizek <martin.krizek@gmail.com>
2024-08-12 10:34:20 -04:00