Commit Graph

31854 Commits (55f90ba31fd3626fb5be9fcb91ff05d6a42740b2)

Author SHA1 Message Date
Matt Martz 3779c1f278
restore inadvertently deleted default for convert_data. Fixes #77004 (#77016) 3 years ago
Brian Coca c9d3518d2f
Fix final fact delegation (#77008)
* fix facts delegation loop overwrite

 partial revert of change to allow facts to be present in each loop iteration
 was not needed in final results as result processing alreayd had the disctiontion
 and ended up breaking the assumptions in the calling code.

 fixes #76676
3 years ago
Brian Coca 56edbd2bbb
Handle connection dissonance (#77005)
* play_context, compensate for existing plugins

 some connection plugins are not fully using the correct configuration,
 but this was previously hidden from them as play_context was providing
 the info instead, now play_context provides the 'correct' info, but hitting
 these bad configurations.
3 years ago
Sloane Hertel 43e55db208
ansible-galaxy - add signature verification of the MANIFEST.json (#76681)
* ansible-galaxy collection install|verify:

  - Support verifying the origin of the MANIFEST.json when the Galaxy server has provided signatures.
  - Allow supplemental signatures to use during verification on the CLI/requirements file.

* ansible-galaxy collection install:

  - Support disabling signature verification. This silences the warning provided by ansible-galaxy if the Galaxy server provided signatures it cannot use because no keyring is configured.
  - Store Galaxy server metadata alongside installed collections for provenance. This is used by 'ansible-galaxy collection verify --offline'.

* Add unit tests for method that gets signatures from a Galaxy server

* Add integration tests for user-provided signature sources

- Test CLI option combinations
- Test installing collections with valid/invalid signature sources
- Test disabling GPG verification when installing collections
- Test verifying collections with valid/invalid signature sources

* Make signature verification advisory-by-default if signatures are provided by the Galaxy server

- Make the default keyring None
- Warn if the keyring is None but the Galaxy server provided signatures
- Error if the keyring is None but the user supplied signatures
- Error if the keyring is not None but is invalid

* changelog

* add ansible-galaxy user documentation for new options

Co-authored-by: Matt Martz <matt@sivel.net>
Co-authored-by: Sviatoslav Sydorenko <wk.cvs.github@sydorenko.org.ua>
Co-authored-by: Martin Krizek <martin.krizek@gmail.com>
Co-authored-by: Sandra McCann <samccann@redhat.com>
Co-authored-by: Andy Mott <amott@redhat.com>
Co-authored-by: John R Barker <john@johnrbarker.com>
3 years ago
Jack Scheible d35bef68f5
replace - always return rc (#71963)
* Return rc=0 on success.

Error handling in playbooks generally expects `rc` to be set to 0 when a module has not failed.  Playbook authors should not have to check for the existence of `rc` first.

* Use single definition and added changelog

* Fix up tests with new return value

Co-authored-by: Jordan Borean <jborean93@gmail.com>
3 years ago
Thomas Sjögren b145732973
Resubmit: Use SystemdStrategy for Debian in the hostname module (#76929)
* add DebianStrategy tests
* ensure hostname can be changed by using become
* use Systemd strat for debian and Base for generic.
* add test to ensure all strategies are available

Signed-off-by: Thomas Sjögren <konstruktoid@users.noreply.github.com>
3 years ago
Stephen Ryan 522f9d1050
Make builtin.file modification times support check_mode (#76973)
* Make builtin.file modification times support check_mode
* Add integration test
3 years ago
Brian Coca 699ecb8308
improve warnings from service_facts (#76921)
be more permissive, allow query more statuses
might create a slew of warnings though, but can depend on
how individual services are permissioned
3 years ago
Brian Coca 47faa6e206
clean_facts only show variable name (#76974) 3 years ago
James T Snell eb093ae7c3
Added a powershell example for ansible.builtin.script (#76980)
* Added a powershell example

None of the examples are of a form that actually works with powershell/windows hosts. The added last example actually works with Windows hosts and Ansible. Inspired by: https://devops.stackexchange.com/questions/15409/ansible-how-to-run-local-powershell-script-on-remote-hosts

* Trivial PEP fix
3 years ago
Matt Martz 8582df36c5
Remove misleading note in template doc fragment. Fixes #61233 (#76955) 3 years ago
Brian Coca d4c9c103e2
ansible-pull handlle empty node/hostname return (#76965) 3 years ago
Brian Coca 6d2d476113
avoid polluting vars with incorrect settings (#76590)
avoid polluting vars with incorrect settings

 simplify variables and templars
  - variables, original, only updated with final results, reset are copies of this
  - tempvars used for preliminary templating
  - cvars used for connection/shell/become plugins, delegation aware
  - vars_copy ignore tempvars updates and use connection plugin to get 
    finalized version per loop item/delegation,  also used to store temp results
    till we are ready to update 'variables'
 - fine tune nolog just cause we are here
 - also fix inventory_hostname_short for IP addresses
3 years ago
Brian Coca b493c590bc
Bypass fragile git ssh wrapper (#73404)
git module now uses env vars exclusively

  - updated docs to clarify usage
  - now env vars append instead of overwrite to allow existing custom setups to keep working
    fixes #38104, #64673, #64674
  - added note for hostkeychecking more securely
    fixes #69846
  - keep script cause old versions still choke on env
  - env var cannot hold more than 'command' for older versions
  - all ssh_opts in one place
3 years ago
Brian Coca be19863e44
ssh connection: use 'correct' host in all cases (#76017)
ssh plugin, use 'correct' information source in all cases
  * still fallback to pc
  * added inventory to new test
  * undef var can still show as parser error on pc
    now task_exectuer has a  more accurate error handling
3 years ago
Brian Coca 5bddecb048
gather_facts sees collection networking connection (#76954)
needed to properly propagate some arguments by convention: subset, filter

Co-authored-by: Sloane Hertel <19572925+s-hertel@users.noreply.github.com>
3 years ago
Martin Krizek 394d216922
add_host/group_by: fix using changed_when in a loop (#71719)
Fixes #71627
Fixes #75971
3 years ago
Alexander 53e4760b8c
More accurate help message for verbosity setting (#76887) 3 years ago
Brian Scholer cbb994f174
make Ansible.Basic work on non-Windows (#76924) 3 years ago
Matt Clay 41db6d8d35 Fix task path unicode error in junit callback. 3 years ago
neikei 3c8861d1ba
Fixed handling of sleep arguments during service restarts on AIX (#76878)
Fixes #76877
3 years ago
Abhijeet Kasurde ea34fdbfe2
Misc typo fixes in plugins directory (#76566) 3 years ago
Matt Clay fbb5d56bd2
ansible-test - Use relative paths in junit output. (#76871)
* ansible-test - Use relative paths in junit output.

Also fix a traceback in the junit callback during automatic fact gathering.

* ansible-test - Handle out-of-tree JUnit paths.
3 years ago
Abhijeet Kasurde fee90b15a2
Misc typo fixes in module_utils (#76564) 3 years ago
Brian Coca b1d6750e8b
fix block var inheritance (#75287)
* updated tests to conform to new block inheritance

Co-authored-by: Brian Scholer <1260690+briantist@users.noreply.github.com>
Co-authored-by: Sloane Hertel <19572925+s-hertel@users.noreply.github.com>
3 years ago
Brian Coca 29b5eb6ba9
updated metadata dump to do full docs dump (#76170)
* minor refactor in other options by pushing common code into functions
 * consolidate coll_filter
 * more normalizing loader
 * dont pass plugin_loader, its global import
 * Also dump roles and collections
 * adjusted tests to new err msg
 * disable namespace filter (unused)
3 years ago
Martin Krizek 3816815db0
Track failures in the includes results to avoid special handling of include errors (#53688)
* Make include_role/include_tasks work with any_errors_fatal v2

Fixes #50897

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

* Add failed to results in free strategy too

* Fix

* Avoid duplicating results

* ci_complete

Co-authored-by: Matt Martz <matt@sivel.net>
3 years ago
Martin Krizek f501b579e5
ansible-vault encrypt_string: fix --output to write into file (#76856)
Fixes #75101
Fixes #59590
3 years ago
Mads Jensen 07bcd13e6f
Replace file handling with context managers in files-modules and parsing vault. (#65371) 3 years ago
Felix Fontein ee80e856c2
Remove more whitelist and blacklist occurances (docs only). (#76845) 3 years ago
Syed Ali Haider 6bca0a5dc2
docs: add fqcn to module examples (#73546)
Co-authored-by: Felix Fontein <felix@fontein.de>
3 years ago
Martin Krizek 29de2cccba
Fix task debugger to work with run_once using linear strategy (#76814)
* Fix task debugger to work with run_once using linear strategy

Fixes #76049

* Fix clog

* Add integration test
3 years ago
neikei 73dd2c3607
Added restart to the argument condition for AIX (#76841)
* Added restart to the argument condition for AIX

This should fix the issue https://github.com/ansible/ansible/issues/76840
3 years ago
Daniel Goldman dbde2c2ae3
user module password expiration fixes (#75390)
* allow inputting 0 for password_expire_{min|max}
   0 is meaningful for min days (any time)   
   0 is technically valid for max_days
* add test for setting both min and max expiry
* [0] return result of execute_command from set_password_expire*
* [1] better return for set_password_expire
* [2] handle returns from set_password_expire*
* only set password expiry if user exists
* collect return-handling code
* combine password min and max into one execution
* handle case where spwd is not present like on macOS and FreeBSD

Co-authored-by: Sam Doran <sdoran@redhat.com>
3 years ago
Éloi Rivard 3889ddeb4b
iptables - added a ``chain_management`` parameter to control chain (#76378)
creation and deletion

fixes #25099
closes #32158
3 years ago
Kenyon Ralph d5a740ddca
doc_fragments/files.py: fix "objecs" typo (#76822) 3 years ago
Brian Coca 04d4900518
config, moved 'choices info to keys (#76569)
* config, moved 'choices' from wall of text, to keys
* updated to ensure all pythons handle the 2 modes correctly
* Update lib/ansible/config/base.yml

Co-authored-by: Sandra McCann <samccann@redhat.com>
3 years ago
Brian Coca 864c2591b6
Use explicit keyword for plugin config (#75158)
* go back to keyword being explicit for plugin configs instead of using option name as implicit match
* switch spec to singular, no changes needed since no one used
3 years ago
Matt Martz 96ce4804ee
Resolve perf issue with async callback events (#76783)
* Don't send full task with async callback events. Fixes #76729

* Use args for async_status task, instead of k=v

* Make sure we send back the async task attrs for polling

* Add clog frag

* load is a staticmethod
3 years ago
Matt Martz d7d1bd6269
Fallback to os family for interpreter discovery distro map. Fixes #75560 (#76815) 3 years ago
Abhinav Tripathy 8c06aada10
Module Logging with WSL2 (#76375)
* adding systemd daemon import

* adding coments and AttributeError exception

* adding minor fix to repeated syntax

* adding changelog
3 years ago
Martin Krizek 8febd37f32
Attach concat func to an environment class (#76282)
* Attach concat func to an environment class

ci_complete

* clog and docstrings
3 years ago
Matt Martz 9f46f6eb30
Attempt 2: Catch errors getting filters and tests (#76806) 3 years ago
Matt Martz 374720fc97
Do not require SystemdStrategy subclasses for every distro (#76800) 3 years ago
Mark Mercado 36519ff95e
Parameterize disable_lookups (#76770)
Allow inventory plugins to enable/disable lookups in the compose templating
3 years ago
Matt Martz 29bdb8bf1e
Compare FQCN also in lockstep logic. Fixes #76782 (#76787) 3 years ago
Julian 6de06377d0
Fix documentation around the password parameter of builtin.user (#76702) 3 years ago
Sebastian Wiesinger 2e0fb34937
Change "fatal" to "error" in config docs to match actual behaviour (#76760) 3 years ago
Brian Coca 89c884e2a2
include_vars initialize failed (#76754)
* include_vars initialize failed

  if source dir is given, but not present and traversal is empty you
  can end up trying to access failed w/o it ever being defined.

  also future proof for more corner cases in decision tree
3 years ago
Brian Coca 4676c08f18
prevent fact gathering from breaking on bad caps (#76691)
* prevent fact gathering from breaking on bad caps

 fxies #75832
3 years ago
Brian Coca 2246ed9678
ansible-config avoid _terms and _input in --only-changed (#76597)
dont display _terms or _intput on only changed
 those always change and it expected for the plugins that support them


Co-authored-by: Abhijeet Kasurde <akasurde@redhat.com>
3 years ago
Brian Coca 0ff80a15ba
ssh connection avoid parsiing own debug (#76732)
- Avoids false positives on become strings being echoed back 
   by ssh cli itself
  - added test for debug lines
  - also simplified some of existing test code
3 years ago
Brian Coca 9142be2f6c
Allow specifying specific python via shebang (#76677)
modules with python were always normalized to /usr/bin/python,
  while other interpreters could have specific versions.

* now shebang is always constructed by get_shebang and args are preserved
* only update shebang if interpreter changed
* updated test expectation
* added python shebang test
3 years ago
jkahrs c8dd96b076
fact gathering, prevent "UnboundLocalError: local variable 'datafile' referenced before assignment" when open(path) fails. (#76751)
Co-authored-by: jean kahrs <j.kahrs@hosting.de>
3 years ago
Adrian Likins 20cc87f059
Expect upper case message 'levels' for galaxy publish results (#63530) 3 years ago
Amir.M 71f3996778
Added AIX CA certs search paths (#69776) 3 years ago
Sloane Hertel 76220c4a7b
ansible-galaxy - fix the --ignore-certs flag for the implicit galaxy server (#76735)
* ansible-galaxy - fix the --ignore-certs flag for the implicit galaxy server

* changelog

* Add a test without the server config

* Fix respecting --ignore-certs for individual --server URLs also

* Update changelogs/fragments/76735-ansible-galaxy-fix-ignore-certs.yaml
3 years ago
StopMotionCuber f2c8b59eb1
Add Rocky to INTERPRETER_PYTHON_DISTRO_MAP (#76728) 3 years ago
Martin Krizek f78deccec2
end_play: end the current play only (#76674)
Fixes #76672
3 years ago
Patrick Hemmer 4a62c4e3e4
apt: add support for package version >= (#75002)
This adds the ability to specify a package version using >=. This will ensure the package is at the specified version or above.

* If the package is not installed, the latest version will be installed.
* If the package is installed and less than the specified version, it will be upgraded.
* If the package is installed and greater than or equal to the specified version, it will be left alone.

The version selection is handled by Apt itself, so things like the system policy, pinning, etc, are considered.
3 years ago
Brian Coca a5bea8b2f5
fix typo (#76699) 3 years ago
Brian Coca 0b6d3312dd
enable module defaults for implicit gather_facts (#76053)
* deprecated default fact path setting
* subset and timeout on same boat
* avoid pushing module args when none

Co-authored-by: Sloane Hertel <19572925+s-hertel@users.noreply.github.com>
3 years ago
Felix Fontein c24c479061 Fix markup. 3 years ago
Brian Coca aa022dba2d
ssh connection, handle 'fun' control paths (#76424)
* handle 'fun' control paths by quoting the option when passed to ssh cli

Co-authored-by: Matt Clay <matt@mystile.com>
3 years ago
Brian Coca ace04087e7
Make all pipelining agree on ini entries (#76573)
* Make all pipelining agree on ini entries, corrected descriptions
3 years ago
Sloane Hertel b17557ae8e
Add check_mode tests for shell/command/script and make skipped=True/changed=True mutually exclusive (#76429)
* Add additional tests for check_mode with shell/command/script
* update check_mode documentation: if a module/action is not skipped in check mode and accurately reflects whether a change is made to the remote support should be 'full'
* Make reporting skipped in check mode mutually exclusive with 'changed: True'
* Add missing documented attributes
* Fix tests to expect skipped=True and changed=True do not occur together
* Fix script check_mode support documentation
* Fix earlier changelog
* document platforms attribute
* Use tasks's check mode since the value from PlayContext does not reflect loop items

Co-authored-by: Brian Coca <bcoca@users.noreply.github.com>
3 years ago
Emyll Almonte a08bcca934
Update local_mods in git.py to show destination of conflict (#72405)
Git module, specify that the local modification is in the destination directory so that some of the users clearly understand this..
3 years ago
Martin Krizek 094a0746b3
ansible_concat: return strings only unless eval (#76634)
Fixes #76610
3 years ago
Romain Goncalves b984dd9c59
package_facts: Support pkg_info OpenBSD, FreeBSD and NetBSD (#76580) 3 years ago
gongnan 0502a03579
hostname: add support for openEuler distro (#76619) 3 years ago
Matt Clay aa67ff2cf2
Remove shebangs from core Python modules. (#76664)
* Remove module shebangs.
* Relax shebang check in validate-modules.
* Add changelog fragment.
3 years ago
James Livulpi ffd0343670
add systemd alias check (#76608)
* add systemd alias check

* add .yml

* Delete 75538-systemd-alias-check

* Update lib/ansible/modules/systemd.py

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

Co-authored-by: Abhijeet Kasurde <akasurde@redhat.com>
3 years ago
Brian Coca 4d380dcbaa
More auto info (#76598)
* make auto invenory plugin a bit more informative

* clog
3 years ago
Abhijeet Kasurde 66e392d4e2
user: Update logic to check if user exists in macOS (#76592)
'dscl -list' returns 0 even if the user does not exists. This
leads to errorenous condition in user module.
Using 'dscl -read UniqueID' can return if user exists or not.

Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
3 years ago
Brian Coca 8e0654504f
stat document 'version' return doc (#76589)
* stat document 'version' return doc

	fixes #76588

* str

* no output_dir for you!
3 years ago
Sloane Hertel 15ace5a854
ansible-galaxy - validate version for directories and collections in git repos (#76579)
* Ensure the version is valid for directories and collections in git repos before installing

Fix the error message for invalid semantic versions

* Make requested changes

* Add a test case for unhandled ValueError exception

* Add changelog

* Update lib/ansible/galaxy/collection/galaxy_api_proxy.py

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

* Reword error message

Include link to learn how to compose a semver version

* Move version validation into the caller, find_matches

* Add tests for more invalid version types

* Remove unused import

Fix raising unexpected error

* Update lib/ansible/galaxy/collection/__init__.py

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

* Update lib/ansible/galaxy/dependency_resolution/providers.py

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

* Update lib/ansible/galaxy/dependency_resolution/providers.py

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

Co-authored-by: Sviatoslav Sydorenko <wk.cvs.github@sydorenko.org.ua>
3 years ago
Matt Clay 6e57c8c084 Add missing typing import for _distro.py.
See: 116cdad222/distro.py (L42-L72)
3 years ago
Jaromaz 16def8050a
facts - Set correct OS family for EuroLinux (#76624)
Co-authored-by: Abhijeet Kasurde <akasurde@redhat.com>
3 years ago
Or Bin a1d0e60703
Fixed documentation: "[a] ini file" -> "an ini file" (#76627) 3 years ago
Or Bin aa4f23dc97
Fixed documentation: "do not needed -> do not need" (#76617) 3 years ago
Jean Raby 594b11dc0c
unarchive: Keep stderr when pick_handler fails (#76365)
* fixes #28977

* Include the original error message when pick_handler fails

* Add a test to unarchive a tar file with an invalid extra option

* add a changelog
3 years ago
James Livulpi eedf2e476c
check for indirect service in systemd (#76462)
* check if service is indirect status / add integration test

* Update changelogs/fragments/76453-indirect-systemd-status.yml

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

* simplify indirect check / remove integration test restriction on rhel9

* add dummy indirect service for integration tests
3 years ago
Brian Coca 66720460d0
more exact wording of system_tmpdirs (#76587) 3 years ago
bluikko f9c24c2899
Document get_url module check_mode support right (#76433) 3 years ago
Jonathan Neuhauser 29d57b5b97
Clarify include parameter in unarchive (#76543)
Co-authored-by: s-hertel <19572925+s-hertel@users.noreply.github.com>
3 years ago
Felix Fontein 9d1898b1ef
Use correct markup in documentation (#76545) 3 years ago
Jonathan Neuhauser 49e1cb9f42
unarchive: fix non-english locales (#76542)
* unarchive: fix non-english locales

For GNU Gettext, the LANGUAGE environment variable takes precedence over LANG or LC_ALL. On systems where LANGUAGE was set to a non-english locale, the output of the tar command therefore not understood and the module failed silently ("changed": false, but the archive was not extracted).

* add tests

* changelog
3 years ago
Martin Krizek ac2bdd6834
Fix AttributeError when providing file via --conn-password-file (#76534)
Fixes #76530
3 years ago
Martin Krizek 461f30c160
yum: avoid storing unnecessary cache data (#76345)
Fixes #76336
3 years ago
Philippe Kueck aaa10cd506
plugins/dnf, plugins/yum: implement sslverify option (#76356) 3 years ago
Martin Krizek 2058ea5991
Clarify unroll in _finalize (#76436)
Clarifies that unrolling in _finalize is actually necessary. Also using
decorator directly.
3 years ago
Sloane Hertel ed6581e4db
check finder type before passing path (#76448)
* check finder type before passing path

ci_complete

* Reduce nesting

* Test find_module does not cause a traceback with Python 3 FileFinder

* Update lib/ansible/utils/collection_loader/_collection_finder.py
3 years ago
Sorin Sbarnea c819c1725d
Remove withought typo (#76524)
Found on https://github.com/ansible/ansible-navigator/issues/689 as
we are using codespell, maybe Ansible core could benefit from it.
3 years ago
Slava 894fbd6990
pkg_mgr: prohibit pkg5 usage on Altlinux (#76457)
Filter out the /usr/bin/pkg because on Altlinux it is actually the
perl-Package (not Solaris package manager).
Since the pkg5 takes precedence over apt, this workaround is
required to select the suitable package manager on Altlinux.
3 years ago
Clement Martin bc753c0518
Add openrc support to service_facts (#76373)
* Add openrc support to service_facts

Co-authored-by: Clément Martin <clement.martin@onespan.com>
3 years ago
Martin Krizek 19a58859d6
AnsibleJ2Template should be based on NativeTemplate (#76471)
Fixes #76442

ci_complete
3 years ago
Martin Krizek 37c80ea893
template lookup: jinja2_native has no effect if global is off (#76385)
This is documented behavior that was unintentionally changed in #75587.
3 years ago
Matt Clay e56e47faa7 ansible-test - Fix import test for collections. 3 years ago
Matt Clay 97ef1d031c Revert "ansible-test - Fix import test when vendoring."
This reverts commit 33a8d06332.
3 years ago
Jordan Borean 8482ee4e9a
galaxy build - ignore existing MANIFEST and FILES (#76479) 3 years ago