Commit Graph

32187 Commits (45df14a2e05573e6213ce789aa3278f4f30fa54f)

Author SHA1 Message Date
Don Naro 8d94a95ccf
Docs: file parameter import_tasks and include_tasks (#79077)
* issue #79022 file parameter import_tasks and include_tasks

* adding details back

* Update lib/ansible/modules/import_tasks.py

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

* Update lib/ansible/modules/include_tasks.py

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

* use pipe as in original version

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

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

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

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

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

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

* fix ansible-config std display

* split baby

* killed offending whitespace

* moved to func instead

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

  add VAULT_ENCRYPT_SALT config
  add salt testing


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

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

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

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

* Update how become_user is specified

* Add test to ensure keyword inheritance is working for become

* Add clog frag

* Cache fattributes to prevent re-calculation

* ci_complete

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

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

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

* Add clog frag

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

* Add comment with issue description and improve string joining

* Add changelog fragment

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

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

* Fixed some typos in changelog fragment

* Improve comment regarding newline character at the end of file

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

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

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

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

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

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

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

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

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

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

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

* Add changelog fragment

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

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

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

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


##### ISSUE TYPE
- Docs Pull Request

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

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

	fixes #18319

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

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

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

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

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

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

* tweak changelog

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

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

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

* Add tests for REJECT_EXTS and doc extensions

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

```ini
async = 1
```

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

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

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

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

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