ansible-core 2.16.6__py3-none-any.whl → 2.17.0rc1__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of ansible-core might be problematic. Click here for more details.
- ansible/__init__.py +1 -3
- ansible/__main__.py +1 -0
- ansible/_vendor/__init__.py +1 -2
- ansible/cli/__init__.py +7 -8
- ansible/cli/adhoc.py +1 -2
- ansible/cli/arguments/__init__.py +1 -2
- ansible/cli/arguments/option_helpers.py +1 -2
- ansible/cli/config.py +1 -2
- ansible/cli/console.py +1 -2
- ansible/cli/doc.py +320 -198
- ansible/cli/galaxy.py +9 -3
- ansible/cli/inventory.py +4 -6
- ansible/cli/playbook.py +1 -2
- ansible/cli/pull.py +4 -5
- ansible/cli/scripts/ansible_connection_cli_stub.py +1 -4
- ansible/cli/vault.py +1 -2
- ansible/collections/list.py +1 -0
- ansible/compat/__init__.py +1 -4
- ansible/compat/importlib_resources.py +1 -2
- ansible/compat/{selectors/__init__.py → selectors.py} +12 -12
- ansible/config/ansible_builtin_runtime.yml +2 -0
- ansible/config/base.yml +154 -149
- ansible/config/manager.py +33 -25
- ansible/constants.py +1 -2
- ansible/context.py +1 -4
- ansible/errors/__init__.py +1 -3
- ansible/errors/yaml_strings.py +1 -3
- ansible/executor/__init__.py +1 -3
- ansible/executor/discovery/python_target.py +1 -2
- ansible/executor/interpreter_discovery.py +9 -8
- ansible/executor/module_common.py +1 -3
- ansible/executor/play_iterator.py +2 -4
- ansible/executor/playbook_executor.py +1 -3
- ansible/executor/powershell/module_manifest.py +2 -3
- ansible/executor/process/__init__.py +1 -3
- ansible/executor/process/worker.py +1 -3
- ansible/executor/stats.py +1 -3
- ansible/executor/task_executor.py +2 -3
- ansible/executor/task_queue_manager.py +1 -3
- ansible/executor/task_result.py +2 -3
- ansible/galaxy/__init__.py +1 -2
- ansible/galaxy/api.py +10 -2
- ansible/galaxy/collection/__init__.py +38 -24
- ansible/galaxy/collection/concrete_artifact_manager.py +1 -2
- ansible/galaxy/collection/galaxy_api_proxy.py +1 -2
- ansible/galaxy/collection/gpg.py +4 -2
- ansible/galaxy/data/apb/meta/main.yml.j2 +0 -15
- ansible/galaxy/data/container/meta/main.yml.j2 +0 -18
- ansible/galaxy/data/default/role/meta/main.yml.j2 +0 -18
- ansible/galaxy/data/network/cliconf_plugins/example.py.j2 +1 -2
- ansible/galaxy/data/network/library/example_command.py.j2 +1 -2
- ansible/galaxy/data/network/library/example_config.py.j2 +1 -2
- ansible/galaxy/data/network/library/example_facts.py.j2 +1 -2
- ansible/galaxy/data/network/meta/main.yml.j2 +0 -15
- ansible/galaxy/data/network/module_utils/example.py.j2 +1 -2
- ansible/galaxy/data/network/netconf_plugins/example.py.j2 +1 -2
- ansible/galaxy/data/network/terminal_plugins/example.py.j2 +1 -2
- ansible/galaxy/dependency_resolution/__init__.py +1 -2
- ansible/galaxy/dependency_resolution/dataclasses.py +5 -6
- ansible/galaxy/dependency_resolution/errors.py +1 -2
- ansible/galaxy/dependency_resolution/providers.py +3 -4
- ansible/galaxy/dependency_resolution/reporters.py +2 -3
- ansible/galaxy/dependency_resolution/resolvers.py +1 -2
- ansible/galaxy/dependency_resolution/versioning.py +1 -2
- ansible/galaxy/role.py +12 -15
- ansible/galaxy/token.py +1 -2
- ansible/galaxy/user_agent.py +1 -2
- ansible/inventory/data.py +1 -2
- ansible/inventory/group.py +1 -2
- ansible/inventory/helpers.py +1 -2
- ansible/inventory/host.py +1 -3
- ansible/inventory/manager.py +1 -2
- ansible/module_utils/_text.py +1 -2
- ansible/module_utils/ansible_release.py +3 -5
- ansible/module_utils/api.py +1 -2
- ansible/module_utils/basic.py +113 -158
- ansible/module_utils/common/_collections_compat.py +1 -2
- ansible/module_utils/common/_utils.py +1 -3
- ansible/module_utils/common/arg_spec.py +1 -2
- ansible/module_utils/common/collections.py +1 -2
- ansible/module_utils/common/dict_transformations.py +1 -2
- ansible/module_utils/common/file.py +10 -5
- ansible/module_utils/common/json.py +1 -3
- ansible/module_utils/common/locale.py +1 -2
- ansible/module_utils/common/network.py +2 -3
- ansible/module_utils/common/parameters.py +9 -9
- ansible/module_utils/common/process.py +12 -5
- ansible/module_utils/common/respawn.py +2 -3
- ansible/module_utils/common/sys_info.py +1 -2
- ansible/module_utils/common/text/converters.py +1 -2
- ansible/module_utils/common/text/formatters.py +1 -2
- ansible/module_utils/common/validation.py +5 -6
- ansible/module_utils/common/warnings.py +1 -2
- ansible/module_utils/common/yaml.py +1 -2
- ansible/module_utils/compat/datetime.py +1 -3
- ansible/module_utils/compat/importlib.py +21 -13
- ansible/module_utils/compat/paramiko.py +1 -2
- ansible/module_utils/compat/selectors.py +10 -34
- ansible/module_utils/compat/selinux.py +1 -2
- ansible/module_utils/compat/typing.py +1 -2
- ansible/module_utils/compat/version.py +1 -2
- ansible/module_utils/connection.py +1 -2
- ansible/module_utils/csharp/Ansible.Basic.cs +20 -3
- ansible/module_utils/distro/__init__.py +3 -4
- ansible/module_utils/distro/_distro.py +230 -234
- ansible/module_utils/errors.py +1 -2
- ansible/module_utils/facts/__init__.py +1 -2
- ansible/module_utils/facts/ansible_collector.py +1 -2
- ansible/module_utils/facts/collector.py +1 -2
- ansible/module_utils/facts/compat.py +1 -2
- ansible/module_utils/facts/default_collectors.py +1 -2
- ansible/module_utils/facts/hardware/aix.py +1 -2
- ansible/module_utils/facts/hardware/base.py +1 -2
- ansible/module_utils/facts/hardware/darwin.py +1 -2
- ansible/module_utils/facts/hardware/dragonfly.py +1 -2
- ansible/module_utils/facts/hardware/freebsd.py +1 -2
- ansible/module_utils/facts/hardware/hpux.py +1 -2
- ansible/module_utils/facts/hardware/hurd.py +1 -2
- ansible/module_utils/facts/hardware/linux.py +8 -6
- ansible/module_utils/facts/hardware/netbsd.py +1 -2
- ansible/module_utils/facts/hardware/openbsd.py +1 -2
- ansible/module_utils/facts/hardware/sunos.py +2 -3
- ansible/module_utils/facts/namespace.py +1 -2
- ansible/module_utils/facts/network/aix.py +1 -2
- ansible/module_utils/facts/network/base.py +1 -2
- ansible/module_utils/facts/network/darwin.py +1 -2
- ansible/module_utils/facts/network/dragonfly.py +1 -2
- ansible/module_utils/facts/network/fc_wwn.py +1 -2
- ansible/module_utils/facts/network/freebsd.py +1 -2
- ansible/module_utils/facts/network/generic_bsd.py +1 -2
- ansible/module_utils/facts/network/hpux.py +1 -2
- ansible/module_utils/facts/network/hurd.py +1 -2
- ansible/module_utils/facts/network/iscsi.py +1 -2
- ansible/module_utils/facts/network/linux.py +1 -2
- ansible/module_utils/facts/network/netbsd.py +1 -2
- ansible/module_utils/facts/network/nvme.py +1 -2
- ansible/module_utils/facts/network/openbsd.py +1 -2
- ansible/module_utils/facts/network/sunos.py +1 -2
- ansible/module_utils/facts/other/facter.py +1 -2
- ansible/module_utils/facts/other/ohai.py +1 -2
- ansible/module_utils/facts/packages.py +1 -2
- ansible/module_utils/facts/sysctl.py +1 -2
- ansible/module_utils/facts/system/apparmor.py +1 -2
- ansible/module_utils/facts/system/caps.py +1 -2
- ansible/module_utils/facts/system/chroot.py +1 -2
- ansible/module_utils/facts/system/cmdline.py +1 -2
- ansible/module_utils/facts/system/date_time.py +1 -2
- ansible/module_utils/facts/system/distribution.py +4 -5
- ansible/module_utils/facts/system/dns.py +1 -2
- ansible/module_utils/facts/system/env.py +1 -2
- ansible/module_utils/facts/system/fips.py +1 -2
- ansible/module_utils/facts/system/loadavg.py +1 -2
- ansible/module_utils/facts/system/local.py +1 -2
- ansible/module_utils/facts/system/lsb.py +1 -2
- ansible/module_utils/facts/system/pkg_mgr.py +7 -30
- ansible/module_utils/facts/system/platform.py +1 -2
- ansible/module_utils/facts/system/python.py +1 -2
- ansible/module_utils/facts/system/selinux.py +1 -2
- ansible/module_utils/facts/system/service_mgr.py +1 -2
- ansible/module_utils/facts/system/ssh_pub_keys.py +1 -2
- ansible/module_utils/facts/system/user.py +1 -2
- ansible/module_utils/facts/timeout.py +1 -2
- ansible/module_utils/facts/utils.py +1 -2
- ansible/module_utils/facts/virtual/base.py +1 -2
- ansible/module_utils/facts/virtual/dragonfly.py +1 -2
- ansible/module_utils/facts/virtual/freebsd.py +1 -2
- ansible/module_utils/facts/virtual/hpux.py +1 -2
- ansible/module_utils/facts/virtual/linux.py +1 -2
- ansible/module_utils/facts/virtual/netbsd.py +1 -2
- ansible/module_utils/facts/virtual/openbsd.py +1 -2
- ansible/module_utils/facts/virtual/sunos.py +1 -2
- ansible/module_utils/facts/virtual/sysctl.py +1 -2
- ansible/module_utils/json_utils.py +1 -2
- ansible/module_utils/parsing/convert_bool.py +1 -2
- ansible/module_utils/powershell/Ansible.ModuleUtils.Legacy.psm1 +5 -2
- ansible/module_utils/powershell/Ansible.ModuleUtils.WebRequest.psm1 +1 -1
- ansible/module_utils/pycompat24.py +24 -4
- ansible/module_utils/service.py +31 -5
- ansible/module_utils/six/__init__.py +1 -1
- ansible/module_utils/splitter.py +1 -2
- ansible/module_utils/urls.py +335 -1052
- ansible/module_utils/yumdnf.py +13 -35
- ansible/modules/add_host.py +1 -2
- ansible/modules/apt.py +38 -22
- ansible/modules/apt_key.py +1 -2
- ansible/modules/apt_repository.py +18 -10
- ansible/modules/assemble.py +1 -2
- ansible/modules/assert.py +8 -4
- ansible/modules/async_status.py +17 -14
- ansible/modules/async_wrapper.py +11 -9
- ansible/modules/blockinfile.py +2 -3
- ansible/modules/command.py +1 -2
- ansible/modules/copy.py +4 -76
- ansible/modules/cron.py +3 -3
- ansible/modules/deb822_repository.py +5 -5
- ansible/modules/debconf.py +19 -8
- ansible/modules/debug.py +1 -2
- ansible/modules/dnf.py +59 -186
- ansible/modules/dnf5.py +57 -43
- ansible/modules/dpkg_selections.py +1 -2
- ansible/modules/expect.py +23 -15
- ansible/modules/fail.py +1 -2
- ansible/modules/fetch.py +1 -2
- ansible/modules/file.py +4 -3
- ansible/modules/find.py +18 -5
- ansible/modules/gather_facts.py +1 -2
- ansible/modules/get_url.py +2 -3
- ansible/modules/getent.py +2 -3
- ansible/modules/git.py +28 -17
- ansible/modules/group.py +1 -2
- ansible/modules/group_by.py +1 -2
- ansible/modules/hostname.py +2 -19
- ansible/modules/import_playbook.py +1 -2
- ansible/modules/import_role.py +9 -2
- ansible/modules/import_tasks.py +1 -2
- ansible/modules/include_role.py +1 -2
- ansible/modules/include_tasks.py +1 -2
- ansible/modules/include_vars.py +1 -2
- ansible/modules/iptables.py +38 -21
- ansible/modules/known_hosts.py +15 -8
- ansible/modules/lineinfile.py +1 -6
- ansible/modules/meta.py +3 -2
- ansible/modules/package.py +6 -5
- ansible/modules/package_facts.py +1 -2
- ansible/modules/pause.py +2 -3
- ansible/modules/ping.py +1 -2
- ansible/modules/pip.py +40 -20
- ansible/modules/raw.py +1 -2
- ansible/modules/reboot.py +1 -2
- ansible/modules/replace.py +7 -5
- ansible/modules/rpm_key.py +1 -2
- ansible/modules/script.py +1 -2
- ansible/modules/service.py +3 -21
- ansible/modules/service_facts.py +3 -12
- ansible/modules/set_fact.py +1 -2
- ansible/modules/set_stats.py +1 -2
- ansible/modules/setup.py +1 -2
- ansible/modules/shell.py +1 -2
- ansible/modules/slurp.py +1 -2
- ansible/modules/stat.py +1 -2
- ansible/modules/subversion.py +2 -3
- ansible/modules/systemd.py +12 -9
- ansible/modules/systemd_service.py +12 -9
- ansible/modules/sysvinit.py +7 -2
- ansible/modules/tempfile.py +7 -2
- ansible/modules/template.py +2 -3
- ansible/modules/unarchive.py +13 -3
- ansible/modules/uri.py +5 -8
- ansible/modules/user.py +11 -10
- ansible/modules/validate_argument_spec.py +15 -16
- ansible/modules/wait_for.py +1 -2
- ansible/modules/wait_for_connection.py +1 -2
- ansible/modules/yum_repository.py +2 -3
- ansible/parsing/__init__.py +1 -3
- ansible/parsing/ajson.py +1 -3
- ansible/parsing/dataloader.py +23 -12
- ansible/parsing/mod_args.py +14 -8
- ansible/parsing/plugin_docs.py +1 -2
- ansible/parsing/quoting.py +1 -3
- ansible/parsing/splitter.py +1 -3
- ansible/parsing/utils/__init__.py +1 -3
- ansible/parsing/utils/addresses.py +1 -3
- ansible/parsing/utils/jsonify.py +1 -3
- ansible/parsing/utils/yaml.py +1 -3
- ansible/parsing/vault/__init__.py +6 -8
- ansible/parsing/yaml/__init__.py +1 -3
- ansible/parsing/yaml/constructor.py +1 -3
- ansible/parsing/yaml/dumper.py +1 -3
- ansible/parsing/yaml/loader.py +1 -3
- ansible/parsing/yaml/objects.py +1 -3
- ansible/playbook/__init__.py +1 -3
- ansible/playbook/attribute.py +1 -3
- ansible/playbook/base.py +2 -3
- ansible/playbook/block.py +1 -3
- ansible/playbook/collectionsearch.py +1 -2
- ansible/playbook/conditional.py +1 -3
- ansible/playbook/delegatable.py +1 -0
- ansible/playbook/handler.py +2 -4
- ansible/playbook/handler_task_include.py +1 -3
- ansible/playbook/helpers.py +1 -4
- ansible/playbook/included_file.py +4 -4
- ansible/playbook/loop_control.py +1 -3
- ansible/playbook/notifiable.py +1 -0
- ansible/playbook/play.py +1 -3
- ansible/playbook/play_context.py +1 -3
- ansible/playbook/playbook_include.py +1 -3
- ansible/playbook/role/__init__.py +1 -3
- ansible/playbook/role/definition.py +1 -3
- ansible/playbook/role/include.py +1 -3
- ansible/playbook/role/metadata.py +1 -3
- ansible/playbook/role/requirement.py +1 -3
- ansible/playbook/role_include.py +2 -10
- ansible/playbook/taggable.py +1 -3
- ansible/playbook/task.py +2 -4
- ansible/playbook/task_include.py +1 -3
- ansible/plugins/__init__.py +4 -5
- ansible/plugins/action/__init__.py +20 -14
- ansible/plugins/action/add_host.py +2 -4
- ansible/plugins/action/assemble.py +2 -3
- ansible/plugins/action/assert.py +1 -2
- ansible/plugins/action/async_status.py +1 -2
- ansible/plugins/action/command.py +1 -2
- ansible/plugins/action/copy.py +12 -9
- ansible/plugins/action/debug.py +1 -2
- ansible/plugins/action/dnf.py +4 -4
- ansible/plugins/action/fail.py +1 -2
- ansible/plugins/action/fetch.py +2 -3
- ansible/plugins/action/gather_facts.py +3 -4
- ansible/plugins/action/group_by.py +1 -2
- ansible/plugins/action/include_vars.py +1 -2
- ansible/plugins/action/normal.py +1 -2
- ansible/plugins/action/package.py +36 -21
- ansible/plugins/action/pause.py +1 -2
- ansible/plugins/action/raw.py +2 -3
- ansible/plugins/action/reboot.py +30 -15
- ansible/plugins/action/script.py +3 -4
- ansible/plugins/action/service.py +1 -2
- ansible/plugins/action/set_fact.py +1 -2
- ansible/plugins/action/set_stats.py +1 -2
- ansible/plugins/action/shell.py +1 -2
- ansible/plugins/action/template.py +1 -2
- ansible/plugins/action/unarchive.py +1 -2
- ansible/plugins/action/uri.py +2 -3
- ansible/plugins/action/validate_argument_spec.py +1 -2
- ansible/plugins/action/wait_for_connection.py +2 -3
- ansible/plugins/become/__init__.py +1 -2
- ansible/plugins/become/runas.py +1 -2
- ansible/plugins/become/su.py +1 -2
- ansible/plugins/become/sudo.py +1 -2
- ansible/plugins/cache/__init__.py +3 -3
- ansible/plugins/cache/base.py +1 -2
- ansible/plugins/cache/jsonfile.py +1 -3
- ansible/plugins/cache/memory.py +1 -2
- ansible/plugins/callback/__init__.py +2 -4
- ansible/plugins/callback/default.py +2 -3
- ansible/plugins/callback/junit.py +1 -2
- ansible/plugins/callback/minimal.py +1 -3
- ansible/plugins/callback/oneline.py +1 -3
- ansible/plugins/callback/tree.py +1 -2
- ansible/plugins/cliconf/__init__.py +1 -2
- ansible/plugins/connection/__init__.py +4 -5
- ansible/plugins/connection/local.py +3 -4
- ansible/plugins/connection/paramiko_ssh.py +1 -2
- ansible/plugins/connection/psrp.py +1 -2
- ansible/plugins/connection/ssh.py +18 -54
- ansible/plugins/connection/winrm.py +3 -4
- ansible/plugins/doc_fragments/action_common_attributes.py +2 -3
- ansible/plugins/doc_fragments/action_core.py +3 -4
- ansible/plugins/doc_fragments/backup.py +1 -2
- ansible/plugins/doc_fragments/connection_pipelining.py +1 -2
- ansible/plugins/doc_fragments/constructed.py +1 -2
- ansible/plugins/doc_fragments/decrypt.py +2 -3
- ansible/plugins/doc_fragments/default_callback.py +1 -2
- ansible/plugins/doc_fragments/files.py +1 -2
- ansible/plugins/doc_fragments/inventory_cache.py +1 -2
- ansible/plugins/doc_fragments/result_format_callback.py +1 -2
- ansible/plugins/doc_fragments/return_common.py +1 -2
- ansible/plugins/doc_fragments/shell_common.py +1 -2
- ansible/plugins/doc_fragments/shell_windows.py +1 -2
- ansible/plugins/doc_fragments/template_common.py +1 -2
- ansible/plugins/doc_fragments/url.py +1 -2
- ansible/plugins/doc_fragments/url_windows.py +1 -2
- ansible/plugins/doc_fragments/validate.py +1 -2
- ansible/plugins/doc_fragments/vars_plugin_staging.py +1 -2
- ansible/plugins/filter/__init__.py +1 -2
- ansible/plugins/filter/b64decode.yml +8 -8
- ansible/plugins/filter/b64encode.yml +4 -4
- ansible/plugins/filter/comment.yml +1 -1
- ansible/plugins/filter/core.py +11 -9
- ansible/plugins/filter/encryption.py +1 -3
- ansible/plugins/filter/extract.yml +1 -1
- ansible/plugins/filter/from_yaml_all.yml +1 -1
- ansible/plugins/filter/human_readable.yml +3 -3
- ansible/plugins/filter/human_to_bytes.yml +2 -2
- ansible/plugins/filter/mandatory.yml +1 -1
- ansible/plugins/filter/mathstuff.py +2 -2
- ansible/plugins/filter/password_hash.yml +3 -2
- ansible/plugins/filter/regex_replace.yml +15 -0
- ansible/plugins/filter/regex_search.yml +12 -0
- ansible/plugins/filter/strftime.yml +2 -9
- ansible/plugins/filter/to_datetime.yml +17 -2
- ansible/plugins/filter/to_nice_json.yml +4 -0
- ansible/plugins/filter/union.yml +1 -1
- ansible/plugins/filter/urls.py +1 -2
- ansible/plugins/filter/urlsplit.py +1 -2
- ansible/plugins/filter/zip.yml +2 -2
- ansible/plugins/filter/zip_longest.yml +1 -1
- ansible/plugins/httpapi/__init__.py +1 -2
- ansible/plugins/inventory/__init__.py +2 -4
- ansible/plugins/inventory/advanced_host_list.py +1 -2
- ansible/plugins/inventory/auto.py +2 -3
- ansible/plugins/inventory/constructed.py +3 -2
- ansible/plugins/inventory/generator.py +1 -2
- ansible/plugins/inventory/host_list.py +1 -2
- ansible/plugins/inventory/ini.py +1 -2
- ansible/plugins/inventory/script.py +122 -3
- ansible/plugins/inventory/toml.py +1 -2
- ansible/plugins/inventory/yaml.py +3 -4
- ansible/plugins/list.py +2 -3
- ansible/plugins/loader.py +10 -11
- ansible/plugins/lookup/__init__.py +1 -3
- ansible/plugins/lookup/config.py +19 -15
- ansible/plugins/lookup/csvfile.py +16 -7
- ansible/plugins/lookup/dict.py +2 -3
- ansible/plugins/lookup/env.py +4 -4
- ansible/plugins/lookup/file.py +1 -2
- ansible/plugins/lookup/fileglob.py +1 -2
- ansible/plugins/lookup/first_found.py +8 -7
- ansible/plugins/lookup/indexed_items.py +1 -2
- ansible/plugins/lookup/ini.py +6 -3
- ansible/plugins/lookup/inventory_hostnames.py +1 -2
- ansible/plugins/lookup/items.py +1 -2
- ansible/plugins/lookup/lines.py +1 -2
- ansible/plugins/lookup/list.py +1 -3
- ansible/plugins/lookup/nested.py +1 -2
- ansible/plugins/lookup/password.py +16 -14
- ansible/plugins/lookup/pipe.py +1 -2
- ansible/plugins/lookup/random_choice.py +1 -2
- ansible/plugins/lookup/sequence.py +21 -52
- ansible/plugins/lookup/subelements.py +1 -2
- ansible/plugins/lookup/template.py +1 -2
- ansible/plugins/lookup/together.py +1 -2
- ansible/plugins/lookup/unvault.py +1 -2
- ansible/plugins/lookup/url.py +9 -3
- ansible/plugins/lookup/varnames.py +1 -2
- ansible/plugins/lookup/vars.py +1 -2
- ansible/plugins/netconf/__init__.py +1 -2
- ansible/plugins/shell/__init__.py +3 -4
- ansible/plugins/shell/cmd.py +1 -2
- ansible/plugins/shell/powershell.py +1 -2
- ansible/plugins/shell/sh.py +1 -2
- ansible/plugins/strategy/__init__.py +33 -21
- ansible/plugins/strategy/debug.py +1 -2
- ansible/plugins/strategy/free.py +17 -7
- ansible/plugins/strategy/host_pinned.py +1 -3
- ansible/plugins/strategy/linear.py +22 -22
- ansible/plugins/terminal/__init__.py +2 -3
- ansible/plugins/test/__init__.py +1 -2
- ansible/plugins/test/change.yml +1 -1
- ansible/plugins/test/changed.yml +1 -1
- ansible/plugins/test/contains.yml +1 -1
- ansible/plugins/test/core.py +2 -4
- ansible/plugins/test/exists.yml +1 -1
- ansible/plugins/test/failed.yml +1 -1
- ansible/plugins/test/failure.yml +1 -1
- ansible/plugins/test/files.py +1 -3
- ansible/plugins/test/finished.yml +3 -3
- ansible/plugins/test/issuperset.yml +1 -1
- ansible/plugins/test/match.yml +1 -1
- ansible/plugins/test/mathstuff.py +1 -2
- ansible/plugins/test/reachable.yml +1 -1
- ansible/plugins/test/regex.yml +1 -1
- ansible/plugins/test/search.yml +1 -1
- ansible/plugins/test/skip.yml +1 -1
- ansible/plugins/test/skipped.yml +1 -1
- ansible/plugins/test/started.yml +1 -1
- ansible/plugins/test/succeeded.yml +1 -1
- ansible/plugins/test/success.yml +1 -1
- ansible/plugins/test/successful.yml +1 -1
- ansible/plugins/test/superset.yml +1 -1
- ansible/plugins/test/unreachable.yml +1 -1
- ansible/plugins/test/uri.py +1 -3
- ansible/plugins/vars/__init__.py +1 -2
- ansible/plugins/vars/host_group_vars.py +2 -3
- ansible/release.py +3 -5
- ansible/template/__init__.py +24 -37
- ansible/template/native_helpers.py +1 -3
- ansible/template/template.py +1 -3
- ansible/template/vars.py +1 -0
- ansible/utils/__init__.py +1 -3
- ansible/utils/cmd_functions.py +1 -2
- ansible/utils/collection_loader/__init__.py +1 -2
- ansible/utils/collection_loader/_collection_config.py +1 -2
- ansible/utils/collection_loader/_collection_finder.py +1 -2
- ansible/utils/collection_loader/_collection_meta.py +1 -2
- ansible/utils/color.py +1 -2
- ansible/utils/context_objects.py +1 -4
- ansible/utils/display.py +88 -30
- ansible/utils/encrypt.py +4 -105
- ansible/utils/fqcn.py +1 -2
- ansible/utils/galaxy.py +1 -3
- ansible/utils/hashing.py +1 -3
- ansible/utils/helpers.py +1 -3
- ansible/utils/jsonrpc.py +1 -2
- ansible/utils/listify.py +1 -3
- ansible/utils/lock.py +1 -3
- ansible/utils/multiprocessing.py +1 -3
- ansible/utils/native_jinja.py +1 -3
- ansible/utils/path.py +1 -2
- ansible/utils/plugin_docs.py +7 -6
- ansible/utils/py3compat.py +17 -55
- ansible/utils/sentinel.py +1 -3
- ansible/utils/shlex.py +1 -3
- ansible/utils/singleton.py +1 -3
- ansible/utils/ssh_functions.py +1 -3
- ansible/utils/unicode.py +1 -3
- ansible/utils/unsafe_proxy.py +1 -2
- ansible/utils/vars.py +6 -8
- ansible/utils/version.py +1 -3
- ansible/vars/clean.py +1 -3
- ansible/vars/fact_cache.py +1 -2
- ansible/vars/hostvars.py +3 -7
- ansible/vars/manager.py +24 -6
- ansible/vars/reserved.py +1 -3
- {ansible_core-2.16.6.data → ansible_core-2.17.0rc1.data}/scripts/ansible-test +1 -2
- {ansible_core-2.16.6.dist-info → ansible_core-2.17.0rc1.dist-info}/METADATA +3 -3
- ansible_core-2.17.0rc1.dist-info/RECORD +987 -0
- ansible_test/__init__.py +1 -2
- ansible_test/_data/completion/docker.txt +7 -9
- ansible_test/_data/completion/remote.txt +6 -7
- ansible_test/_data/requirements/ansible-test.txt +0 -2
- ansible_test/_data/requirements/constraints.txt +1 -6
- ansible_test/_data/requirements/sanity.ansible-doc.txt +3 -3
- ansible_test/_data/requirements/sanity.changelog.txt +3 -3
- ansible_test/_data/requirements/sanity.import.plugin.txt +2 -2
- ansible_test/_data/requirements/sanity.mypy.txt +12 -12
- ansible_test/_data/requirements/sanity.pep8.txt +1 -1
- ansible_test/_data/requirements/sanity.pylint.txt +7 -7
- ansible_test/_data/requirements/sanity.runtime-metadata.txt +1 -1
- ansible_test/_data/requirements/sanity.validate-modules.txt +3 -3
- ansible_test/_data/requirements/sanity.yamllint.txt +2 -2
- ansible_test/_internal/bootstrap.py +2 -2
- ansible_test/_internal/classification/__init__.py +0 -5
- ansible_test/_internal/commands/integration/cloud/cs.py +1 -1
- ansible_test/_internal/commands/integration/cloud/nios.py +1 -1
- ansible_test/_internal/commands/sanity/__init__.py +1 -27
- ansible_test/_internal/commands/sanity/import.py +0 -18
- ansible_test/_internal/commands/sanity/mypy.py +7 -10
- ansible_test/_internal/commands/units/__init__.py +1 -1
- ansible_test/_internal/config.py +0 -1
- ansible_test/_internal/content_config.py +0 -5
- ansible_test/_internal/coverage_util.py +0 -1
- ansible_test/_internal/docker_util.py +1 -1
- ansible_test/_internal/host_profiles.py +5 -4
- ansible_test/_internal/python_requirements.py +1 -119
- ansible_test/_internal/ssh.py +1 -0
- ansible_test/_internal/util.py +1 -1
- ansible_test/_internal/util_common.py +1 -1
- ansible_test/_internal/venv.py +10 -108
- ansible_test/_util/__init__.py +1 -2
- ansible_test/_util/controller/sanity/mypy/ansible-core.ini +0 -6
- ansible_test/_util/controller/sanity/mypy/modules.ini +0 -6
- ansible_test/_util/controller/sanity/pylint/config/ansible-test-target.cfg +0 -1
- ansible_test/_util/controller/sanity/pylint/config/ansible-test.cfg +0 -1
- ansible_test/_util/controller/sanity/pylint/config/code-smell.cfg +0 -1
- ansible_test/_util/controller/sanity/pylint/config/collection.cfg +0 -1
- ansible_test/_util/controller/sanity/pylint/config/default.cfg +0 -1
- ansible_test/_util/controller/sanity/pylint/plugins/deprecated.py +1 -2
- ansible_test/_util/controller/sanity/shellcheck/exclude.txt +0 -1
- ansible_test/_util/controller/sanity/validate-modules/validate_modules/main.py +31 -59
- ansible_test/_util/controller/sanity/validate-modules/validate_modules/module_args.py +0 -7
- ansible_test/_util/controller/sanity/validate-modules/validate_modules/schema.py +10 -2
- ansible_test/_util/controller/sanity/validate-modules/validate_modules/utils.py +1 -1
- ansible_test/_util/controller/sanity/yamllint/yamllinter.py +16 -4
- ansible_test/_util/target/__init__.py +1 -2
- ansible_test/_util/target/cli/ansible_test_cli_stub.py +1 -2
- ansible_test/_util/target/common/constants.py +1 -4
- ansible_test/_util/target/injector/python.py +4 -19
- ansible_test/_util/target/pytest/plugins/ansible_forked.py +2 -9
- ansible_test/_util/target/pytest/plugins/ansible_pytest_collections.py +1 -5
- ansible_test/_util/target/pytest/plugins/ansible_pytest_coverage.py +1 -2
- ansible_test/_util/target/sanity/compile/compile.py +3 -12
- ansible_test/_util/target/sanity/import/importer.py +1 -12
- ansible_test/_util/target/setup/bootstrap.sh +49 -105
- ansible_test/_util/target/setup/probe_cgroups.py +1 -2
- ansible_test/_util/target/setup/quiet_pip.py +1 -16
- ansible_test/_util/target/setup/requirements.py +9 -2
- ansible_test/_util/target/tools/virtualenvcheck.py +1 -2
- ansible_test/_util/target/tools/yamlcheck.py +1 -2
- ansible/module_utils/common/_json_compat.py +0 -16
- ansible/module_utils/compat/_selectors2.py +0 -655
- ansible/modules/yum.py +0 -1821
- ansible/plugins/action/yum.py +0 -111
- ansible_core-2.16.6.dist-info/RECORD +0 -1009
- ansible_test/_util/controller/sanity/code-smell/future-import-boilerplate.json +0 -7
- ansible_test/_util/controller/sanity/code-smell/future-import-boilerplate.py +0 -46
- ansible_test/_util/controller/sanity/code-smell/metaclass-boilerplate.json +0 -7
- ansible_test/_util/controller/sanity/code-smell/metaclass-boilerplate.py +0 -44
- ansible_test/_util/controller/sanity/code-smell/no-basestring.json +0 -7
- ansible_test/_util/controller/sanity/code-smell/no-basestring.py +0 -21
- ansible_test/_util/controller/sanity/code-smell/no-dict-iteritems.json +0 -7
- ansible_test/_util/controller/sanity/code-smell/no-dict-iteritems.py +0 -21
- ansible_test/_util/controller/sanity/code-smell/no-dict-iterkeys.json +0 -7
- ansible_test/_util/controller/sanity/code-smell/no-dict-iterkeys.py +0 -21
- ansible_test/_util/controller/sanity/code-smell/no-dict-itervalues.json +0 -7
- ansible_test/_util/controller/sanity/code-smell/no-dict-itervalues.py +0 -21
- ansible_test/_util/controller/sanity/code-smell/no-main-display.json +0 -10
- ansible_test/_util/controller/sanity/code-smell/no-main-display.py +0 -21
- ansible_test/_util/controller/sanity/code-smell/no-unicode-literals.json +0 -7
- ansible_test/_util/controller/sanity/code-smell/no-unicode-literals.py +0 -21
- ansible_test/_util/controller/tools/sslcheck.py +0 -22
- ansible_test/_util/target/common/__init__.py +0 -2
- {ansible_core-2.16.6.dist-info → ansible_core-2.17.0rc1.dist-info}/COPYING +0 -0
- {ansible_core-2.16.6.dist-info → ansible_core-2.17.0rc1.dist-info}/WHEEL +0 -0
- {ansible_core-2.16.6.dist-info → ansible_core-2.17.0rc1.dist-info}/entry_points.txt +0 -0
- {ansible_core-2.16.6.dist-info → ansible_core-2.17.0rc1.dist-info}/top_level.txt +0 -0
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
# Copyright (c) 2017 Ansible Project
|
|
2
2
|
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
|
3
3
|
|
|
4
|
-
from __future__ import
|
|
5
|
-
__metaclass__ = type
|
|
4
|
+
from __future__ import annotations
|
|
6
5
|
|
|
7
6
|
DOCUMENTATION = '''
|
|
8
7
|
name: auto
|
|
@@ -37,7 +36,7 @@ class InventoryModule(BaseInventoryPlugin):
|
|
|
37
36
|
return super(InventoryModule, self).verify_file(path)
|
|
38
37
|
|
|
39
38
|
def parse(self, inventory, loader, path, cache=True):
|
|
40
|
-
config_data = loader.load_from_file(path, cache=
|
|
39
|
+
config_data = loader.load_from_file(path, cache='none')
|
|
41
40
|
|
|
42
41
|
try:
|
|
43
42
|
plugin_name = config_data.get('plugin', None)
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
# Copyright (c) 2017 Ansible Project
|
|
2
2
|
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
|
3
3
|
|
|
4
|
-
from __future__ import
|
|
5
|
-
__metaclass__ = type
|
|
4
|
+
from __future__ import annotations
|
|
6
5
|
|
|
7
6
|
DOCUMENTATION = '''
|
|
8
7
|
name: constructed
|
|
@@ -26,6 +25,8 @@ DOCUMENTATION = '''
|
|
|
26
25
|
- The host_group_vars (enabled by default) 'vars plugin' is the one responsible for reading host_vars/ and group_vars/ directories.
|
|
27
26
|
- This will execute all vars plugins, even those that are not supposed to execute at the 'inventory' stage.
|
|
28
27
|
See vars plugins docs for details on 'stage'.
|
|
28
|
+
- Implicit groups, such as 'all' or 'ungrouped', need to be explicitly defined in any previous inventory to apply the
|
|
29
|
+
corresponding group_vars
|
|
29
30
|
required: false
|
|
30
31
|
default: false
|
|
31
32
|
type: boolean
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
# Copyright (c) 2017 Ansible Project
|
|
2
2
|
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
|
3
3
|
|
|
4
|
-
from __future__ import
|
|
5
|
-
__metaclass__ = type
|
|
4
|
+
from __future__ import annotations
|
|
6
5
|
|
|
7
6
|
DOCUMENTATION = '''
|
|
8
7
|
name: generator
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
# Copyright (c) 2017 Ansible Project
|
|
2
2
|
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
|
3
3
|
|
|
4
|
-
from __future__ import
|
|
5
|
-
__metaclass__ = type
|
|
4
|
+
from __future__ import annotations
|
|
6
5
|
|
|
7
6
|
DOCUMENTATION = r'''
|
|
8
7
|
name: host_list
|
ansible/plugins/inventory/ini.py
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
# Copyright (c) 2017 Ansible Project
|
|
2
2
|
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
|
3
|
-
from __future__ import
|
|
4
|
-
__metaclass__ = type
|
|
3
|
+
from __future__ import annotations
|
|
5
4
|
|
|
6
5
|
DOCUMENTATION = '''
|
|
7
6
|
name: ini
|
|
@@ -2,8 +2,7 @@
|
|
|
2
2
|
# Copyright (c) 2017 Ansible Project
|
|
3
3
|
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
|
4
4
|
|
|
5
|
-
from __future__ import
|
|
6
|
-
__metaclass__ = type
|
|
5
|
+
from __future__ import annotations
|
|
7
6
|
|
|
8
7
|
DOCUMENTATION = '''
|
|
9
8
|
name: script
|
|
@@ -24,7 +23,7 @@ DOCUMENTATION = '''
|
|
|
24
23
|
- The source provided must be an executable that returns Ansible inventory JSON
|
|
25
24
|
- The source must accept C(--list) and C(--host <hostname>) as arguments.
|
|
26
25
|
C(--host) will only be used if no C(_meta) key is present.
|
|
27
|
-
This is a performance optimization as the script would be called per host otherwise.
|
|
26
|
+
This is a performance optimization as the script would be called one additional time per host otherwise.
|
|
28
27
|
notes:
|
|
29
28
|
- Enabled in configuration by default.
|
|
30
29
|
- The plugin does not cache results because external inventory scripts are responsible for their own caching.
|
|
@@ -32,6 +31,126 @@ DOCUMENTATION = '''
|
|
|
32
31
|
- To find the scripts that used to be part of the code release, go to U(https://github.com/ansible-community/contrib-scripts/).
|
|
33
32
|
'''
|
|
34
33
|
|
|
34
|
+
EXAMPLES = r'''# fmt: code
|
|
35
|
+
|
|
36
|
+
### simple bash script
|
|
37
|
+
|
|
38
|
+
#!/usr/bin/env bash
|
|
39
|
+
|
|
40
|
+
if [ "$1" == "--list" ]; then
|
|
41
|
+
cat<<EOF
|
|
42
|
+
{
|
|
43
|
+
"bash_hosts": {
|
|
44
|
+
"hosts": [
|
|
45
|
+
"myhost.domain.com",
|
|
46
|
+
"myhost2.domain.com"
|
|
47
|
+
],
|
|
48
|
+
"vars": {
|
|
49
|
+
"host_test": "test-value"
|
|
50
|
+
}
|
|
51
|
+
},
|
|
52
|
+
"_meta": {
|
|
53
|
+
"hostvars": {
|
|
54
|
+
"myhost.domain.com": {
|
|
55
|
+
"host_specific_test_var": "test-value"
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
EOF
|
|
61
|
+
elif [ "$1" == "--host" ]; then
|
|
62
|
+
# this should not normally be called by Ansible as we return _meta above
|
|
63
|
+
if [ "$2" == "myhost.domain.com" ]; then
|
|
64
|
+
echo '{"_meta": {hostvars": {"myhost.domain.com": {"host_specific-test_var": "test-value"}}}}'
|
|
65
|
+
else
|
|
66
|
+
echo '{"_meta": {hostvars": {}}}'
|
|
67
|
+
fi
|
|
68
|
+
else
|
|
69
|
+
echo "Invalid option: use --list or --host <hostname>"
|
|
70
|
+
exit 1
|
|
71
|
+
fi
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
### python example with ini config
|
|
75
|
+
|
|
76
|
+
#!/usr/bin/env python
|
|
77
|
+
"""
|
|
78
|
+
# ansible_inventory.py
|
|
79
|
+
"""
|
|
80
|
+
import argparse
|
|
81
|
+
import json
|
|
82
|
+
import os.path
|
|
83
|
+
import sys
|
|
84
|
+
from configparser import ConfigParser
|
|
85
|
+
from inventories.custom import MyInventoryAPI
|
|
86
|
+
|
|
87
|
+
def load_config() -> ConfigParser:
|
|
88
|
+
cp = ConfigParser()
|
|
89
|
+
config_file = os.path.expanduser("~/.config/ansible_inventory_script.cfg")
|
|
90
|
+
cp.read(config_file)
|
|
91
|
+
if not cp.has_option('DEFAULT', 'namespace'):
|
|
92
|
+
raise ValueError("Missing configuration option: DEFAULT -> namespace")
|
|
93
|
+
return cp
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
def get_api_data(namespace: str, pretty=False) -> str:
|
|
97
|
+
"""
|
|
98
|
+
:param namespace: parameter for our custom api
|
|
99
|
+
:param pretty: Human redable JSON vs machine readable
|
|
100
|
+
:return: JSON string
|
|
101
|
+
"""
|
|
102
|
+
found_data = list(MyInventoryAPI(namespace))
|
|
103
|
+
hostvars = {}
|
|
104
|
+
data = { '_meta': { 'hostvars': {}},}
|
|
105
|
+
|
|
106
|
+
groups = found_data['groups'].keys()
|
|
107
|
+
for group in groups:
|
|
108
|
+
groups[group]['hosts'] = found_data[groups].get('host_list', [])
|
|
109
|
+
if group not in data:
|
|
110
|
+
data[group] = {}
|
|
111
|
+
data[group]['hosts'] = found_data[groups].get('host_list', [])
|
|
112
|
+
data[group]['vars'] = found_data[groups].get('info', [])
|
|
113
|
+
data[group]['children'] = found_data[group].get('subgroups', [])
|
|
114
|
+
|
|
115
|
+
for host_data in found_data['hosts']:
|
|
116
|
+
for name in host_data.items():
|
|
117
|
+
# turn info into vars
|
|
118
|
+
data['_meta'][name] = found_data[name].get('info', {})
|
|
119
|
+
# set ansible_host if possible
|
|
120
|
+
if 'address' in found_data[name]:
|
|
121
|
+
data[name]['_meta']['ansible_host'] = found_data[name]['address']
|
|
122
|
+
data['_meta']['hostvars'] = hostvars
|
|
123
|
+
|
|
124
|
+
return json.dumps(data, indent=pretty)
|
|
125
|
+
|
|
126
|
+
if __name__ == '__main__':
|
|
127
|
+
|
|
128
|
+
arg_parser = argparse.ArgumentParser( description=__doc__, prog=__file__)
|
|
129
|
+
arg_parser.add_argument('--pretty', action='store_true', default=False, help="Pretty JSON")
|
|
130
|
+
mandatory_options = arg_parser.add_mutually_exclusive_group()
|
|
131
|
+
mandatory_options.add_argument('--list', action='store', nargs="*", help="Get inventory JSON from our API")
|
|
132
|
+
mandatory_options.add_argument('--host', action='store',
|
|
133
|
+
help="Get variables for specific host, not used but kept for compatability")
|
|
134
|
+
|
|
135
|
+
try:
|
|
136
|
+
config = load_config()
|
|
137
|
+
namespace = config.get('DEFAULT', 'namespace')
|
|
138
|
+
|
|
139
|
+
args = arg_parser.parse_args()
|
|
140
|
+
if args.host:
|
|
141
|
+
print('{"_meta":{}}')
|
|
142
|
+
sys.stderr.write('This script already provides _meta via --list, so this option is really ignored')
|
|
143
|
+
elif len(args.list) >= 0:
|
|
144
|
+
print(get_api_data(namespace, args.pretty))
|
|
145
|
+
else:
|
|
146
|
+
raise ValueError("Valid options are --list or --host <HOSTNAME>")
|
|
147
|
+
|
|
148
|
+
except ValueError:
|
|
149
|
+
raise
|
|
150
|
+
|
|
151
|
+
'''
|
|
152
|
+
|
|
153
|
+
|
|
35
154
|
import os
|
|
36
155
|
import subprocess
|
|
37
156
|
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
# Copyright (c) 2018 Matt Martz <matt@sivel.net>
|
|
2
2
|
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
|
3
3
|
|
|
4
|
-
from __future__ import
|
|
5
|
-
__metaclass__ = type
|
|
4
|
+
from __future__ import annotations
|
|
6
5
|
|
|
7
6
|
DOCUMENTATION = r'''
|
|
8
7
|
name: toml
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
# Copyright (c) 2017 Ansible Project
|
|
2
2
|
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
|
3
3
|
|
|
4
|
-
from __future__ import
|
|
5
|
-
__metaclass__ = type
|
|
4
|
+
from __future__ import annotations
|
|
6
5
|
|
|
7
6
|
DOCUMENTATION = '''
|
|
8
7
|
name: yaml
|
|
@@ -102,7 +101,7 @@ class InventoryModule(BaseFileInventoryPlugin):
|
|
|
102
101
|
self.set_options()
|
|
103
102
|
|
|
104
103
|
try:
|
|
105
|
-
data = self.loader.load_from_file(path, cache=
|
|
104
|
+
data = self.loader.load_from_file(path, cache='none')
|
|
106
105
|
except Exception as e:
|
|
107
106
|
raise AnsibleParserError(e)
|
|
108
107
|
|
|
@@ -114,7 +113,7 @@ class InventoryModule(BaseFileInventoryPlugin):
|
|
|
114
113
|
raise AnsibleParserError('Plugin configuration YAML file, not YAML inventory')
|
|
115
114
|
|
|
116
115
|
# We expect top level keys to correspond to groups, iterate over them
|
|
117
|
-
# to get host, vars and subgroups (which we iterate over
|
|
116
|
+
# to get host, vars and subgroups (which we iterate over recursively)
|
|
118
117
|
if isinstance(data, MutableMapping):
|
|
119
118
|
for group_name in data:
|
|
120
119
|
self._parse_group(group_name, data[group_name])
|
ansible/plugins/list.py
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
# (c) Ansible Project
|
|
2
2
|
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
|
3
3
|
|
|
4
|
-
from __future__ import
|
|
5
|
-
__metaclass__ = type
|
|
4
|
+
from __future__ import annotations
|
|
6
5
|
|
|
7
6
|
|
|
8
7
|
import os
|
|
@@ -35,7 +34,7 @@ def get_composite_name(collection, name, path, depth):
|
|
|
35
34
|
resolved_collection = 'ansible.builtin'
|
|
36
35
|
resource_name = '.'.join(name.split(f"{resolved_collection}.")[1:])
|
|
37
36
|
|
|
38
|
-
#
|
|
37
|
+
# create FQCN
|
|
39
38
|
composite = [resolved_collection]
|
|
40
39
|
if depth:
|
|
41
40
|
composite.extend(path.split(os.path.sep)[depth * -1:])
|
ansible/plugins/loader.py
CHANGED
|
@@ -4,8 +4,7 @@
|
|
|
4
4
|
# (c) 2017 Ansible Project
|
|
5
5
|
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
|
6
6
|
|
|
7
|
-
from __future__ import
|
|
8
|
-
__metaclass__ = type
|
|
7
|
+
from __future__ import annotations
|
|
9
8
|
|
|
10
9
|
import glob
|
|
11
10
|
import os
|
|
@@ -15,6 +14,7 @@ import sys
|
|
|
15
14
|
import warnings
|
|
16
15
|
|
|
17
16
|
from collections import defaultdict, namedtuple
|
|
17
|
+
from importlib import import_module
|
|
18
18
|
from traceback import format_exc
|
|
19
19
|
|
|
20
20
|
import ansible.module_utils.compat.typing as t
|
|
@@ -26,7 +26,6 @@ from ansible import __version__ as ansible_version
|
|
|
26
26
|
from ansible import constants as C
|
|
27
27
|
from ansible.errors import AnsibleError, AnsiblePluginCircularRedirect, AnsiblePluginRemovedError, AnsibleCollectionUnsupportedVersionError
|
|
28
28
|
from ansible.module_utils.common.text.converters import to_bytes, to_text, to_native
|
|
29
|
-
from ansible.module_utils.compat.importlib import import_module
|
|
30
29
|
from ansible.module_utils.six import string_types
|
|
31
30
|
from ansible.parsing.utils.yaml import from_yaml
|
|
32
31
|
from ansible.parsing.yaml.loader import AnsibleLoader
|
|
@@ -1232,24 +1231,22 @@ class Jinja2Loader(PluginLoader):
|
|
|
1232
1231
|
# check deprecations
|
|
1233
1232
|
deprecation_entry = routing_entry.get('deprecation')
|
|
1234
1233
|
if deprecation_entry:
|
|
1235
|
-
warning_text = deprecation_entry.get('warning_text')
|
|
1234
|
+
warning_text = deprecation_entry.get('warning_text') or ''
|
|
1236
1235
|
removal_date = deprecation_entry.get('removal_date')
|
|
1237
1236
|
removal_version = deprecation_entry.get('removal_version')
|
|
1238
1237
|
|
|
1239
|
-
if
|
|
1240
|
-
warning_text = '{0} "{1}" is deprecated'.format(self.type, key)
|
|
1238
|
+
warning_text = f'{self.type.title()} "{key}" has been deprecated.{" " if warning_text else ""}{warning_text}'
|
|
1241
1239
|
|
|
1242
1240
|
display.deprecated(warning_text, version=removal_version, date=removal_date, collection_name=acr.collection)
|
|
1243
1241
|
|
|
1244
1242
|
# check removal
|
|
1245
1243
|
tombstone_entry = routing_entry.get('tombstone')
|
|
1246
1244
|
if tombstone_entry:
|
|
1247
|
-
warning_text = tombstone_entry.get('warning_text')
|
|
1245
|
+
warning_text = tombstone_entry.get('warning_text') or ''
|
|
1248
1246
|
removal_date = tombstone_entry.get('removal_date')
|
|
1249
1247
|
removal_version = tombstone_entry.get('removal_version')
|
|
1250
1248
|
|
|
1251
|
-
if
|
|
1252
|
-
warning_text = '{0} "{1}" has been removed'.format(self.type, key)
|
|
1249
|
+
warning_text = f'{self.type.title()} "{key}" has been removed.{" " if warning_text else ""}{warning_text}'
|
|
1253
1250
|
|
|
1254
1251
|
exc_msg = display.get_deprecation_message(warning_text, version=removal_version, date=removal_date,
|
|
1255
1252
|
collection_name=acr.collection, removed=True)
|
|
@@ -1299,12 +1296,14 @@ class Jinja2Loader(PluginLoader):
|
|
|
1299
1296
|
fq_name = '.'.join((parent_prefix, func_name))
|
|
1300
1297
|
src_name = f"ansible_collections.{acr.collection}.plugins.{self.type}.{acr.subdirs}.{func_name}"
|
|
1301
1298
|
# TODO: load anyways into CACHE so we only match each at end of loop
|
|
1302
|
-
# the files
|
|
1299
|
+
# the files themselves should already be cached by base class caching of modules(python)
|
|
1303
1300
|
if key in (func_name, fq_name):
|
|
1304
1301
|
plugin = self._plugin_wrapper_type(func)
|
|
1305
1302
|
if plugin:
|
|
1306
1303
|
context = plugin_impl.plugin_load_context
|
|
1307
1304
|
self._update_object(plugin, src_name, plugin_impl.object._original_path, resolved=fq_name)
|
|
1305
|
+
# context will have filename, which for tests/filters might not be correct
|
|
1306
|
+
context._resolved_fqcn = plugin.ansible_name
|
|
1308
1307
|
# FIXME: once we start caching these results, we'll be missing functions that would have loaded later
|
|
1309
1308
|
break # go to next file as it can override if dupe (dont break both loops)
|
|
1310
1309
|
|
|
@@ -1448,7 +1447,7 @@ def _load_plugin_filter():
|
|
|
1448
1447
|
display.warning(u'The plugin filter file, {0} does not exist.'
|
|
1449
1448
|
u' Skipping.'.format(filter_cfg))
|
|
1450
1449
|
|
|
1451
|
-
#
|
|
1450
|
+
# Special case: the stat module as Ansible can run very few things if stat is rejected
|
|
1452
1451
|
if 'stat' in filters['ansible.modules']:
|
|
1453
1452
|
raise AnsibleError('The stat module was specified in the module reject list file, {0}, but'
|
|
1454
1453
|
' Ansible will not function without the stat module. Please remove stat'
|
|
@@ -15,9 +15,7 @@
|
|
|
15
15
|
# You should have received a copy of the GNU General Public License
|
|
16
16
|
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
|
|
17
17
|
|
|
18
|
-
|
|
19
|
-
from __future__ import (absolute_import, division, print_function)
|
|
20
|
-
__metaclass__ = type
|
|
18
|
+
from __future__ import annotations
|
|
21
19
|
|
|
22
20
|
from abc import abstractmethod
|
|
23
21
|
|
ansible/plugins/lookup/config.py
CHANGED
|
@@ -1,42 +1,46 @@
|
|
|
1
1
|
# (c) 2017 Ansible Project
|
|
2
2
|
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
|
3
|
-
from __future__ import
|
|
4
|
-
__metaclass__ = type
|
|
3
|
+
from __future__ import annotations
|
|
5
4
|
|
|
6
5
|
DOCUMENTATION = """
|
|
7
6
|
name: config
|
|
8
7
|
author: Ansible Core Team
|
|
9
8
|
version_added: "2.5"
|
|
10
|
-
short_description:
|
|
9
|
+
short_description: Display the 'resolved' Ansible option values.
|
|
11
10
|
description:
|
|
12
|
-
- Retrieves the value of an Ansible configuration setting.
|
|
13
|
-
|
|
11
|
+
- Retrieves the value of an Ansible configuration setting, resolving all sources, from defaults, ansible.cfg, envirionmnet,
|
|
12
|
+
CLI, and variables, but not keywords.
|
|
13
|
+
- The values returned assume the context of the current host or C(inventory_hostname).
|
|
14
|
+
- You can use C(ansible-config list) to see the global available settings, add C(-t all) to also show plugin options.
|
|
14
15
|
options:
|
|
15
16
|
_terms:
|
|
16
|
-
description: The
|
|
17
|
+
description: The option(s) to look up.
|
|
17
18
|
required: True
|
|
18
19
|
on_missing:
|
|
19
|
-
description:
|
|
20
|
-
- action to take if term is missing from config
|
|
21
|
-
- Error will raise a fatal error
|
|
22
|
-
- Skip will just ignore the term
|
|
23
|
-
- Warn will skip over it but issue a warning
|
|
20
|
+
description: Action to take if term is missing from config
|
|
24
21
|
default: error
|
|
25
22
|
type: string
|
|
26
|
-
choices:
|
|
23
|
+
choices:
|
|
24
|
+
error: Issue an error message and raise fatal signal
|
|
25
|
+
warn: Issue a warning message and continue
|
|
26
|
+
skip: Silently ignore
|
|
27
27
|
plugin_type:
|
|
28
|
-
description:
|
|
28
|
+
description: The type of the plugin referenced by 'plugin_name' option.
|
|
29
29
|
choices: ['become', 'cache', 'callback', 'cliconf', 'connection', 'httpapi', 'inventory', 'lookup', 'netconf', 'shell', 'vars']
|
|
30
30
|
type: string
|
|
31
31
|
version_added: '2.12'
|
|
32
32
|
plugin_name:
|
|
33
|
-
description: name of the plugin for which you want to retrieve configuration settings.
|
|
33
|
+
description: The name of the plugin for which you want to retrieve configuration settings.
|
|
34
34
|
type: string
|
|
35
35
|
version_added: '2.12'
|
|
36
36
|
show_origin:
|
|
37
|
-
description:
|
|
37
|
+
description: Set this to return what configuration subsystem the value came from
|
|
38
|
+
(defaults, config file, environment, CLI, or variables).
|
|
38
39
|
type: bool
|
|
39
40
|
version_added: '2.16'
|
|
41
|
+
notes:
|
|
42
|
+
- Be aware that currently this lookup cannot take keywords nor delegation into account,
|
|
43
|
+
so for options that support keywords or are affected by delegation, it is at best a good guess or approximation.
|
|
40
44
|
"""
|
|
41
45
|
|
|
42
46
|
EXAMPLES = """
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
# (c) 2013, Jan-Piet Mens <jpmens(at)gmail.com>
|
|
2
2
|
# (c) 2017 Ansible Project
|
|
3
3
|
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
|
4
|
-
from __future__ import
|
|
5
|
-
__metaclass__ = type
|
|
4
|
+
from __future__ import annotations
|
|
6
5
|
|
|
7
6
|
DOCUMENTATION = r"""
|
|
8
7
|
name: csvfile
|
|
@@ -17,6 +16,11 @@ DOCUMENTATION = r"""
|
|
|
17
16
|
col:
|
|
18
17
|
description: column to return (0 indexed).
|
|
19
18
|
default: "1"
|
|
19
|
+
keycol:
|
|
20
|
+
description: column to search in (0 indexed).
|
|
21
|
+
default: 0
|
|
22
|
+
type: int
|
|
23
|
+
version_added: "2.17"
|
|
20
24
|
default:
|
|
21
25
|
description: what to return if the value is not found in the file.
|
|
22
26
|
delimiter:
|
|
@@ -83,7 +87,7 @@ from ansible.module_utils.common.text.converters import to_bytes, to_native, to_
|
|
|
83
87
|
|
|
84
88
|
class CSVRecoder:
|
|
85
89
|
"""
|
|
86
|
-
Iterator that reads an encoded stream and
|
|
90
|
+
Iterator that reads an encoded stream and encodes the input to UTF-8
|
|
87
91
|
"""
|
|
88
92
|
def __init__(self, f, encoding='utf-8'):
|
|
89
93
|
self.reader = codecs.getreader(encoding)(f)
|
|
@@ -123,14 +127,14 @@ class CSVReader:
|
|
|
123
127
|
|
|
124
128
|
class LookupModule(LookupBase):
|
|
125
129
|
|
|
126
|
-
def read_csv(self, filename, key, delimiter, encoding='utf-8', dflt=None, col=1):
|
|
130
|
+
def read_csv(self, filename, key, delimiter, encoding='utf-8', dflt=None, col=1, keycol=0):
|
|
127
131
|
|
|
128
132
|
try:
|
|
129
133
|
f = open(to_bytes(filename), 'rb')
|
|
130
134
|
creader = CSVReader(f, delimiter=to_native(delimiter), encoding=encoding)
|
|
131
135
|
|
|
132
136
|
for row in creader:
|
|
133
|
-
if len(row) and row[
|
|
137
|
+
if len(row) and row[keycol] == key:
|
|
134
138
|
return row[int(col)]
|
|
135
139
|
except Exception as e:
|
|
136
140
|
raise AnsibleError("csvfile: %s" % to_native(e))
|
|
@@ -156,6 +160,7 @@ class LookupModule(LookupBase):
|
|
|
156
160
|
|
|
157
161
|
# parameters override per term using k/v
|
|
158
162
|
try:
|
|
163
|
+
reset_params = False
|
|
159
164
|
for name, value in kv.items():
|
|
160
165
|
if name == '_raw_params':
|
|
161
166
|
continue
|
|
@@ -163,7 +168,11 @@ class LookupModule(LookupBase):
|
|
|
163
168
|
raise AnsibleAssertionError('%s is not a valid option' % name)
|
|
164
169
|
|
|
165
170
|
self._deprecate_inline_kv()
|
|
166
|
-
|
|
171
|
+
self.set_option(name, value)
|
|
172
|
+
reset_params = True
|
|
173
|
+
|
|
174
|
+
if reset_params:
|
|
175
|
+
paramvals = self.get_options()
|
|
167
176
|
|
|
168
177
|
except (ValueError, AssertionError) as e:
|
|
169
178
|
raise AnsibleError(e)
|
|
@@ -173,7 +182,7 @@ class LookupModule(LookupBase):
|
|
|
173
182
|
paramvals['delimiter'] = "\t"
|
|
174
183
|
|
|
175
184
|
lookupfile = self.find_file_in_search_path(variables, 'files', paramvals['file'])
|
|
176
|
-
var = self.read_csv(lookupfile, key, paramvals['delimiter'], paramvals['encoding'], paramvals['default'], paramvals['col'])
|
|
185
|
+
var = self.read_csv(lookupfile, key, paramvals['delimiter'], paramvals['encoding'], paramvals['default'], paramvals['col'], paramvals['keycol'])
|
|
177
186
|
if var is not None:
|
|
178
187
|
if isinstance(var, MutableSequence):
|
|
179
188
|
for v in var:
|
ansible/plugins/lookup/dict.py
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
# (c) 2014, Kent R. Spillner <kspillner@acm.org>
|
|
2
2
|
# (c) 2017 Ansible Project
|
|
3
3
|
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
|
4
|
-
from __future__ import
|
|
5
|
-
__metaclass__ = type
|
|
4
|
+
from __future__ import annotations
|
|
6
5
|
|
|
7
6
|
DOCUMENTATION = """
|
|
8
7
|
name: dict
|
|
@@ -49,7 +48,7 @@ tasks:
|
|
|
49
48
|
RETURN = """
|
|
50
49
|
_list:
|
|
51
50
|
description:
|
|
52
|
-
- list of composed
|
|
51
|
+
- list of composed dictionaries with key and value
|
|
53
52
|
type: list
|
|
54
53
|
"""
|
|
55
54
|
|
ansible/plugins/lookup/env.py
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
# (c) 2012, Jan-Piet Mens <jpmens(at)gmail.com>
|
|
2
2
|
# (c) 2017 Ansible Project
|
|
3
3
|
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
|
4
|
-
from __future__ import
|
|
5
|
-
__metaclass__ = type
|
|
4
|
+
from __future__ import annotations
|
|
6
5
|
|
|
7
6
|
DOCUMENTATION = """
|
|
8
7
|
name: env
|
|
@@ -56,11 +55,12 @@ RETURN = """
|
|
|
56
55
|
type: list
|
|
57
56
|
"""
|
|
58
57
|
|
|
58
|
+
import os
|
|
59
|
+
|
|
59
60
|
from jinja2.runtime import Undefined
|
|
60
61
|
|
|
61
62
|
from ansible.errors import AnsibleUndefinedVariable
|
|
62
63
|
from ansible.plugins.lookup import LookupBase
|
|
63
|
-
from ansible.utils import py3compat
|
|
64
64
|
|
|
65
65
|
|
|
66
66
|
class LookupModule(LookupBase):
|
|
@@ -72,7 +72,7 @@ class LookupModule(LookupBase):
|
|
|
72
72
|
d = self.get_option('default')
|
|
73
73
|
for term in terms:
|
|
74
74
|
var = term.split()[0]
|
|
75
|
-
val =
|
|
75
|
+
val = os.environ.get(var, d)
|
|
76
76
|
if isinstance(val, Undefined):
|
|
77
77
|
raise AnsibleUndefinedVariable('The "env" lookup, found an undefined variable: %s' % var)
|
|
78
78
|
ret.append(val)
|
ansible/plugins/lookup/file.py
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
# (c) 2012, Daniel Hokka Zakrisson <daniel@hozac.com>
|
|
2
2
|
# (c) 2017 Ansible Project
|
|
3
3
|
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
|
4
|
-
from __future__ import
|
|
5
|
-
__metaclass__ = type
|
|
4
|
+
from __future__ import annotations
|
|
6
5
|
|
|
7
6
|
DOCUMENTATION = """
|
|
8
7
|
name: file
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
# (c) 2012, Michael DeHaan <michael.dehaan@gmail.com>
|
|
2
2
|
# (c) 2017 Ansible Project
|
|
3
3
|
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
|
4
|
-
from __future__ import
|
|
5
|
-
__metaclass__ = type
|
|
4
|
+
from __future__ import annotations
|
|
6
5
|
|
|
7
6
|
DOCUMENTATION = """
|
|
8
7
|
name: fileglob
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
# (c) 2013, seth vidal <skvidal@fedoraproject.org> red hat, inc
|
|
2
2
|
# (c) 2017 Ansible Project
|
|
3
3
|
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
|
4
|
-
from __future__ import
|
|
5
|
-
__metaclass__ = type
|
|
4
|
+
from __future__ import annotations
|
|
6
5
|
|
|
7
6
|
DOCUMENTATION = """
|
|
8
7
|
name: first_found
|
|
@@ -147,6 +146,7 @@ from jinja2.exceptions import UndefinedError
|
|
|
147
146
|
from ansible.errors import AnsibleLookupError, AnsibleUndefinedVariable
|
|
148
147
|
from ansible.module_utils.six import string_types
|
|
149
148
|
from ansible.plugins.lookup import LookupBase
|
|
149
|
+
from ansible.utils.path import unfrackpath
|
|
150
150
|
|
|
151
151
|
|
|
152
152
|
def _splitter(value, chars):
|
|
@@ -198,7 +198,7 @@ class LookupModule(LookupBase):
|
|
|
198
198
|
# NOTE: this is used as 'global' but can be set many times?!?!?
|
|
199
199
|
skip = self.get_option('skip')
|
|
200
200
|
|
|
201
|
-
# magic extra
|
|
201
|
+
# magic extra splitting to create lists
|
|
202
202
|
filelist = _split_on(files, ',;')
|
|
203
203
|
pathlist = _split_on(paths, ',:;')
|
|
204
204
|
|
|
@@ -209,7 +209,7 @@ class LookupModule(LookupBase):
|
|
|
209
209
|
f = os.path.join(path, fn)
|
|
210
210
|
total_search.append(f)
|
|
211
211
|
elif filelist:
|
|
212
|
-
# NOTE: this is now 'extend',
|
|
212
|
+
# NOTE: this is now 'extend', previously it would clobber all options, but we deemed that a bug
|
|
213
213
|
total_search.extend(filelist)
|
|
214
214
|
else:
|
|
215
215
|
total_search.append(term)
|
|
@@ -218,8 +218,9 @@ class LookupModule(LookupBase):
|
|
|
218
218
|
|
|
219
219
|
def run(self, terms, variables, **kwargs):
|
|
220
220
|
|
|
221
|
+
self.set_options(var_options=variables, direct=kwargs)
|
|
222
|
+
|
|
221
223
|
if not terms:
|
|
222
|
-
self.set_options(var_options=variables, direct=kwargs)
|
|
223
224
|
terms = self.get_option('files')
|
|
224
225
|
|
|
225
226
|
total_search, skip = self._process_terms(terms, variables, kwargs)
|
|
@@ -246,10 +247,10 @@ class LookupModule(LookupBase):
|
|
|
246
247
|
|
|
247
248
|
# exit if we find one!
|
|
248
249
|
if path is not None:
|
|
249
|
-
return [path]
|
|
250
|
+
return [unfrackpath(path, follow=False)]
|
|
250
251
|
|
|
251
252
|
# if we get here, no file was found
|
|
252
253
|
if skip:
|
|
253
|
-
# NOTE: global skip
|
|
254
|
+
# NOTE: global skip won't matter, only last 'skip' value in dict term
|
|
254
255
|
return []
|
|
255
256
|
raise AnsibleLookupError("No file was found when using first_found.")
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
# (c) 2012, Michael DeHaan <michael.dehaan@gmail.com>
|
|
2
2
|
# (c) 2017 Ansible Project
|
|
3
3
|
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
|
4
|
-
from __future__ import
|
|
5
|
-
__metaclass__ = type
|
|
4
|
+
from __future__ import annotations
|
|
6
5
|
|
|
7
6
|
DOCUMENTATION = """
|
|
8
7
|
name: indexed_items
|