ansible-core 2.16.7rc1__py3-none-any.whl → 2.17.0__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 +326 -202
- 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 +1 -3
- 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 +2 -3
- 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 +39 -46
- ansible/modules/dnf5.py +28 -26
- 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 +12 -15
- ansible/modules/user.py +11 -4
- 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 +6 -4
- 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 +19 -13
- 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 -11
- 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 +14 -27
- 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 +89 -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.7rc1.data → ansible_core-2.17.0.data}/scripts/ansible-test +1 -2
- {ansible_core-2.16.7rc1.dist-info → ansible_core-2.17.0.dist-info}/METADATA +3 -3
- ansible_core-2.17.0.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/pypi_proxy.py +1 -8
- 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.7rc1.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.7rc1.dist-info → ansible_core-2.17.0.dist-info}/COPYING +0 -0
- {ansible_core-2.16.7rc1.dist-info → ansible_core-2.17.0.dist-info}/WHEEL +0 -0
- {ansible_core-2.16.7rc1.dist-info → ansible_core-2.17.0.dist-info}/entry_points.txt +0 -0
- {ansible_core-2.16.7rc1.dist-info → ansible_core-2.17.0.dist-info}/top_level.txt +0 -0
ansible/module_utils/yumdnf.py
CHANGED
|
@@ -9,20 +9,16 @@
|
|
|
9
9
|
# - Abhijeet Kasurde (@Akasurde)
|
|
10
10
|
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
|
11
11
|
|
|
12
|
-
from __future__ import
|
|
13
|
-
__metaclass__ = type
|
|
12
|
+
from __future__ import annotations
|
|
14
13
|
|
|
15
|
-
import os
|
|
16
|
-
import time
|
|
17
|
-
import glob
|
|
18
14
|
from abc import ABCMeta, abstractmethod
|
|
19
15
|
|
|
20
|
-
from ansible.module_utils.six import with_metaclass
|
|
21
|
-
|
|
22
16
|
yumdnf_argument_spec = dict(
|
|
23
17
|
argument_spec=dict(
|
|
24
18
|
allow_downgrade=dict(type='bool', default=False),
|
|
19
|
+
allowerasing=dict(default=False, type="bool"),
|
|
25
20
|
autoremove=dict(type='bool', default=False),
|
|
21
|
+
best=dict(type="bool"),
|
|
26
22
|
bugfix=dict(required=False, type='bool', default=False),
|
|
27
23
|
cacheonly=dict(type='bool', default=False),
|
|
28
24
|
conf_file=dict(type='str'),
|
|
@@ -36,10 +32,14 @@ yumdnf_argument_spec = dict(
|
|
|
36
32
|
enablerepo=dict(type='list', elements='str', default=[]),
|
|
37
33
|
exclude=dict(type='list', elements='str', default=[]),
|
|
38
34
|
installroot=dict(type='str', default="/"),
|
|
39
|
-
install_repoquery=dict(
|
|
35
|
+
install_repoquery=dict(
|
|
36
|
+
type='bool', default=True,
|
|
37
|
+
removed_in_version='2.20', removed_from_collection='ansible.builtin',
|
|
38
|
+
),
|
|
40
39
|
install_weak_deps=dict(type='bool', default=True),
|
|
41
40
|
list=dict(type='str'),
|
|
42
41
|
name=dict(type='list', elements='str', aliases=['pkg'], default=[]),
|
|
42
|
+
nobest=dict(type="bool"),
|
|
43
43
|
releasever=dict(default=None),
|
|
44
44
|
security=dict(type='bool', default=False),
|
|
45
45
|
skip_broken=dict(type='bool', default=False),
|
|
@@ -52,12 +52,12 @@ yumdnf_argument_spec = dict(
|
|
|
52
52
|
lock_timeout=dict(type='int', default=30),
|
|
53
53
|
),
|
|
54
54
|
required_one_of=[['name', 'list', 'update_cache']],
|
|
55
|
-
mutually_exclusive=[['name', 'list']],
|
|
55
|
+
mutually_exclusive=[['name', 'list'], ['best', 'nobest']],
|
|
56
56
|
supports_check_mode=True,
|
|
57
57
|
)
|
|
58
58
|
|
|
59
59
|
|
|
60
|
-
class YumDnf(
|
|
60
|
+
class YumDnf(metaclass=ABCMeta):
|
|
61
61
|
"""
|
|
62
62
|
Abstract class that handles the population of instance variables that should
|
|
63
63
|
be identical between both YUM and DNF modules because of the feature parity
|
|
@@ -69,7 +69,9 @@ class YumDnf(with_metaclass(ABCMeta, object)): # type: ignore[misc]
|
|
|
69
69
|
self.module = module
|
|
70
70
|
|
|
71
71
|
self.allow_downgrade = self.module.params['allow_downgrade']
|
|
72
|
+
self.allowerasing = self.module.params['allowerasing']
|
|
72
73
|
self.autoremove = self.module.params['autoremove']
|
|
74
|
+
self.best = self.module.params['best']
|
|
73
75
|
self.bugfix = self.module.params['bugfix']
|
|
74
76
|
self.cacheonly = self.module.params['cacheonly']
|
|
75
77
|
self.conf_file = self.module.params['conf_file']
|
|
@@ -87,6 +89,7 @@ class YumDnf(with_metaclass(ABCMeta, object)): # type: ignore[misc]
|
|
|
87
89
|
self.install_weak_deps = self.module.params['install_weak_deps']
|
|
88
90
|
self.list = self.module.params['list']
|
|
89
91
|
self.names = [p.strip() for p in self.module.params['name']]
|
|
92
|
+
self.nobest = self.module.params['nobest']
|
|
90
93
|
self.releasever = self.module.params['releasever']
|
|
91
94
|
self.security = self.module.params['security']
|
|
92
95
|
self.skip_broken = self.module.params['skip_broken']
|
|
@@ -127,31 +130,6 @@ class YumDnf(with_metaclass(ABCMeta, object)): # type: ignore[misc]
|
|
|
127
130
|
results=[],
|
|
128
131
|
)
|
|
129
132
|
|
|
130
|
-
# This should really be redefined by both the yum and dnf module but a
|
|
131
|
-
# default isn't a bad idea
|
|
132
|
-
self.lockfile = '/var/run/yum.pid'
|
|
133
|
-
|
|
134
|
-
@abstractmethod
|
|
135
|
-
def is_lockfile_pid_valid(self):
|
|
136
|
-
return
|
|
137
|
-
|
|
138
|
-
def _is_lockfile_present(self):
|
|
139
|
-
return (os.path.isfile(self.lockfile) or glob.glob(self.lockfile)) and self.is_lockfile_pid_valid()
|
|
140
|
-
|
|
141
|
-
def wait_for_lock(self):
|
|
142
|
-
'''Poll until the lock is removed if timeout is a positive number'''
|
|
143
|
-
|
|
144
|
-
if not self._is_lockfile_present():
|
|
145
|
-
return
|
|
146
|
-
|
|
147
|
-
if self.lock_timeout > 0:
|
|
148
|
-
for iteration in range(0, self.lock_timeout):
|
|
149
|
-
time.sleep(1)
|
|
150
|
-
if not self._is_lockfile_present():
|
|
151
|
-
return
|
|
152
|
-
|
|
153
|
-
self.module.fail_json(msg='{0} lockfile is held by another process'.format(self.pkg_mgr_name))
|
|
154
|
-
|
|
155
133
|
def listify_comma_sep_strings_in_list(self, some_list):
|
|
156
134
|
"""
|
|
157
135
|
method to accept a list of strings as the parameter, find any strings
|
ansible/modules/add_host.py
CHANGED
|
@@ -4,8 +4,7 @@
|
|
|
4
4
|
# Copyright: Ansible Team
|
|
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
|
|
|
11
10
|
DOCUMENTATION = r'''
|
ansible/modules/apt.py
CHANGED
|
@@ -6,8 +6,7 @@
|
|
|
6
6
|
|
|
7
7
|
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
|
8
8
|
|
|
9
|
-
from __future__ import
|
|
10
|
-
__metaclass__ = type
|
|
9
|
+
from __future__ import annotations
|
|
11
10
|
|
|
12
11
|
|
|
13
12
|
DOCUMENTATION = '''
|
|
@@ -206,14 +205,17 @@ attributes:
|
|
|
206
205
|
notes:
|
|
207
206
|
- Three of the upgrade modes (V(full), V(safe) and its alias V(true)) required C(aptitude) up to 2.3, since 2.4 C(apt-get) is used as a fall-back.
|
|
208
207
|
- In most cases, packages installed with apt will start newly installed services by default. Most distributions have mechanisms to avoid this.
|
|
209
|
-
For example when installing Postgresql-9.5 in Debian 9, creating an
|
|
210
|
-
a return code of 101 will stop Postgresql 9.5 starting up after install. Remove the file or
|
|
208
|
+
For example when installing Postgresql-9.5 in Debian 9, creating an executable shell script (/usr/sbin/policy-rc.d) that throws
|
|
209
|
+
a return code of 101 will stop Postgresql 9.5 starting up after install. Remove the file or its execute permission afterward.
|
|
211
210
|
- The apt-get commandline supports implicit regex matches here but we do not because it can let typos through easier
|
|
212
211
|
(If you typo C(foo) as C(fo) apt-get would install packages that have "fo" in their name with a warning and a prompt for the user.
|
|
213
|
-
Since we don't have warnings and prompts before installing we disallow this.Use an explicit fnmatch pattern if you want wildcarding)
|
|
212
|
+
Since we don't have warnings and prompts before installing, we disallow this.Use an explicit fnmatch pattern if you want wildcarding)
|
|
214
213
|
- When used with a C(loop:) each package will be processed individually, it is much more efficient to pass the list directly to the O(name) option.
|
|
215
214
|
- When O(default_release) is used, an implicit priority of 990 is used. This is the same behavior as C(apt-get -t).
|
|
216
215
|
- When an exact version is specified, an implicit priority of 1001 is used.
|
|
216
|
+
- If the interpreter can't import ``python-apt``/``python3-apt`` the module will check for it in system-owned interpreters as well.
|
|
217
|
+
If the dependency can't be found, the module will attempt to install it.
|
|
218
|
+
If the dependency is found or installed, the module will be respawned under the correct interpreter.
|
|
217
219
|
'''
|
|
218
220
|
|
|
219
221
|
EXAMPLES = '''
|
|
@@ -322,7 +324,7 @@ EXAMPLES = '''
|
|
|
322
324
|
purge: true
|
|
323
325
|
|
|
324
326
|
- name: Run the equivalent of "apt-get clean" as a separate step
|
|
325
|
-
apt:
|
|
327
|
+
ansible.builtin.apt:
|
|
326
328
|
clean: yes
|
|
327
329
|
'''
|
|
328
330
|
|
|
@@ -370,10 +372,11 @@ import tempfile
|
|
|
370
372
|
import time
|
|
371
373
|
|
|
372
374
|
from ansible.module_utils.basic import AnsibleModule
|
|
375
|
+
from ansible.module_utils.common.file import S_IRWXU_RXG_RXO
|
|
373
376
|
from ansible.module_utils.common.locale import get_best_parsable_locale
|
|
374
377
|
from ansible.module_utils.common.respawn import has_respawned, probe_interpreters_for_module, respawn_module
|
|
375
378
|
from ansible.module_utils.common.text.converters import to_native, to_text
|
|
376
|
-
from ansible.module_utils.six import
|
|
379
|
+
from ansible.module_utils.six import string_types
|
|
377
380
|
from ansible.module_utils.urls import fetch_file
|
|
378
381
|
|
|
379
382
|
DPKG_OPTIONS = 'force-confdef,force-confold'
|
|
@@ -446,7 +449,7 @@ class PolicyRcD(object):
|
|
|
446
449
|
with open('/usr/sbin/policy-rc.d', 'w') as policy_rc_d:
|
|
447
450
|
policy_rc_d.write('#!/bin/sh\nexit %d\n' % self.m.params['policy_rc_d'])
|
|
448
451
|
|
|
449
|
-
os.chmod('/usr/sbin/policy-rc.d',
|
|
452
|
+
os.chmod('/usr/sbin/policy-rc.d', S_IRWXU_RXG_RXO)
|
|
450
453
|
except Exception:
|
|
451
454
|
self.m.fail_json(msg="Failed to create or chmod /usr/sbin/policy-rc.d")
|
|
452
455
|
|
|
@@ -883,6 +886,11 @@ def install_deb(
|
|
|
883
886
|
except Exception as e:
|
|
884
887
|
m.fail_json(msg="Unable to install package: %s" % to_native(e))
|
|
885
888
|
|
|
889
|
+
# Install 'Recommends' of this deb file
|
|
890
|
+
if install_recommends:
|
|
891
|
+
pkg_recommends = get_field_of_deb(m, deb_file, "Recommends")
|
|
892
|
+
deps_to_install.extend([pkg_name.strip() for pkg_name in pkg_recommends.split()])
|
|
893
|
+
|
|
886
894
|
# and add this deb to the list of packages to install
|
|
887
895
|
pkgs_to_install.append(deb_file)
|
|
888
896
|
|
|
@@ -1246,6 +1254,15 @@ def main():
|
|
|
1246
1254
|
)
|
|
1247
1255
|
module.run_command_environ_update = APT_ENV_VARS
|
|
1248
1256
|
|
|
1257
|
+
global APTITUDE_CMD
|
|
1258
|
+
APTITUDE_CMD = module.get_bin_path("aptitude", False)
|
|
1259
|
+
global APT_GET_CMD
|
|
1260
|
+
APT_GET_CMD = module.get_bin_path("apt-get")
|
|
1261
|
+
|
|
1262
|
+
p = module.params
|
|
1263
|
+
install_recommends = p['install_recommends']
|
|
1264
|
+
dpkg_options = expand_dpkg_options(p['dpkg_options'])
|
|
1265
|
+
|
|
1249
1266
|
if not HAS_PYTHON_APT:
|
|
1250
1267
|
# This interpreter can't see the apt Python library- we'll do the following to try and fix that:
|
|
1251
1268
|
# 1) look in common locations for system-owned interpreters that can see it; if we find one, respawn under it
|
|
@@ -1258,13 +1275,13 @@ def main():
|
|
|
1258
1275
|
# made any more complex than it already is to try and cover more, eg, custom interpreters taking over
|
|
1259
1276
|
# system locations)
|
|
1260
1277
|
|
|
1261
|
-
apt_pkg_name = 'python3-apt'
|
|
1278
|
+
apt_pkg_name = 'python3-apt'
|
|
1262
1279
|
|
|
1263
1280
|
if has_respawned():
|
|
1264
1281
|
# this shouldn't be possible; short-circuit early if it happens...
|
|
1265
1282
|
module.fail_json(msg="{0} must be installed and visible from {1}.".format(apt_pkg_name, sys.executable))
|
|
1266
1283
|
|
|
1267
|
-
interpreters = ['/usr/bin/python3', '/usr/bin/
|
|
1284
|
+
interpreters = ['/usr/bin/python3', '/usr/bin/python']
|
|
1268
1285
|
|
|
1269
1286
|
interpreter = probe_interpreters_for_module(interpreters, 'apt')
|
|
1270
1287
|
|
|
@@ -1284,10 +1301,18 @@ def main():
|
|
|
1284
1301
|
module.warn("Auto-installing missing dependency without updating cache: %s" % apt_pkg_name)
|
|
1285
1302
|
else:
|
|
1286
1303
|
module.warn("Updating cache and auto-installing missing dependency: %s" % apt_pkg_name)
|
|
1287
|
-
module.run_command([
|
|
1304
|
+
module.run_command([APT_GET_CMD, 'update'], check_rc=True)
|
|
1288
1305
|
|
|
1289
1306
|
# try to install the apt Python binding
|
|
1290
|
-
|
|
1307
|
+
apt_pkg_cmd = [APT_GET_CMD, 'install', apt_pkg_name, '-y', '-q', dpkg_options]
|
|
1308
|
+
|
|
1309
|
+
if install_recommends is False:
|
|
1310
|
+
apt_pkg_cmd.extend(["-o", "APT::Install-Recommends=no"])
|
|
1311
|
+
elif install_recommends is True:
|
|
1312
|
+
apt_pkg_cmd.extend(["-o", "APT::Install-Recommends=yes"])
|
|
1313
|
+
# install_recommends is None uses the OS default
|
|
1314
|
+
|
|
1315
|
+
module.run_command(apt_pkg_cmd, check_rc=True)
|
|
1291
1316
|
|
|
1292
1317
|
# try again to find the bindings in common places
|
|
1293
1318
|
interpreter = probe_interpreters_for_module(interpreters, 'apt')
|
|
@@ -1301,18 +1326,11 @@ def main():
|
|
|
1301
1326
|
# we've done all we can do; just tell the user it's busted and get out
|
|
1302
1327
|
module.fail_json(msg="{0} must be installed and visible from {1}.".format(apt_pkg_name, sys.executable))
|
|
1303
1328
|
|
|
1304
|
-
global APTITUDE_CMD
|
|
1305
|
-
APTITUDE_CMD = module.get_bin_path("aptitude", False)
|
|
1306
|
-
global APT_GET_CMD
|
|
1307
|
-
APT_GET_CMD = module.get_bin_path("apt-get")
|
|
1308
|
-
|
|
1309
|
-
p = module.params
|
|
1310
|
-
|
|
1311
1329
|
if p['clean'] is True:
|
|
1312
1330
|
aptclean_stdout, aptclean_stderr, aptclean_diff = aptclean(module)
|
|
1313
1331
|
# If there is nothing else to do exit. This will set state as
|
|
1314
1332
|
# changed based on if the cache was updated.
|
|
1315
|
-
if not p['package'] and
|
|
1333
|
+
if not p['package'] and p['upgrade'] == 'no' and not p['deb']:
|
|
1316
1334
|
module.exit_json(
|
|
1317
1335
|
changed=True,
|
|
1318
1336
|
msg=aptclean_stdout,
|
|
@@ -1331,11 +1349,9 @@ def main():
|
|
|
1331
1349
|
|
|
1332
1350
|
updated_cache = False
|
|
1333
1351
|
updated_cache_time = 0
|
|
1334
|
-
install_recommends = p['install_recommends']
|
|
1335
1352
|
allow_unauthenticated = p['allow_unauthenticated']
|
|
1336
1353
|
allow_downgrade = p['allow_downgrade']
|
|
1337
1354
|
allow_change_held_packages = p['allow_change_held_packages']
|
|
1338
|
-
dpkg_options = expand_dpkg_options(p['dpkg_options'])
|
|
1339
1355
|
autoremove = p['autoremove']
|
|
1340
1356
|
fail_on_autoremove = p['fail_on_autoremove']
|
|
1341
1357
|
autoclean = p['autoclean']
|
ansible/modules/apt_key.py
CHANGED
|
@@ -6,8 +6,7 @@
|
|
|
6
6
|
|
|
7
7
|
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
|
8
8
|
|
|
9
|
-
from __future__ import
|
|
10
|
-
__metaclass__ = type
|
|
9
|
+
from __future__ import annotations
|
|
11
10
|
|
|
12
11
|
|
|
13
12
|
DOCUMENTATION = '''
|
|
@@ -181,9 +180,9 @@ import random
|
|
|
181
180
|
import time
|
|
182
181
|
|
|
183
182
|
from ansible.module_utils.basic import AnsibleModule
|
|
183
|
+
from ansible.module_utils.common.file import S_IRWU_RG_RO as DEFAULT_SOURCES_PERM
|
|
184
184
|
from ansible.module_utils.common.respawn import has_respawned, probe_interpreters_for_module, respawn_module
|
|
185
185
|
from ansible.module_utils.common.text.converters import to_native
|
|
186
|
-
from ansible.module_utils.six import PY3
|
|
187
186
|
from ansible.module_utils.urls import fetch_url
|
|
188
187
|
|
|
189
188
|
from ansible.module_utils.common.locale import get_best_parsable_locale
|
|
@@ -202,7 +201,6 @@ except ImportError:
|
|
|
202
201
|
HAVE_PYTHON_APT = False
|
|
203
202
|
|
|
204
203
|
APT_KEY_DIRS = ['/etc/apt/keyrings', '/etc/apt/trusted.gpg.d', '/usr/share/keyrings']
|
|
205
|
-
DEFAULT_SOURCES_PERM = 0o0644
|
|
206
204
|
VALID_SOURCE_TYPES = ('deb', 'deb-src')
|
|
207
205
|
|
|
208
206
|
|
|
@@ -231,6 +229,7 @@ class SourcesList(object):
|
|
|
231
229
|
def __init__(self, module):
|
|
232
230
|
self.module = module
|
|
233
231
|
self.files = {} # group sources by file
|
|
232
|
+
self.files_mapping = {} # internal DS for tracking symlinks
|
|
234
233
|
# Repositories that we're adding -- used to implement mode param
|
|
235
234
|
self.new_repos = set()
|
|
236
235
|
self.default_file = self._apt_cfg_file('Dir::Etc::sourcelist')
|
|
@@ -241,6 +240,8 @@ class SourcesList(object):
|
|
|
241
240
|
|
|
242
241
|
# read sources.list.d
|
|
243
242
|
for file in glob.iglob('%s/*.list' % self._apt_cfg_dir('Dir::Etc::sourceparts')):
|
|
243
|
+
if os.path.islink(file):
|
|
244
|
+
self.files_mapping[file] = os.readlink(file)
|
|
244
245
|
self.load(file)
|
|
245
246
|
|
|
246
247
|
def __iter__(self):
|
|
@@ -373,7 +374,11 @@ class SourcesList(object):
|
|
|
373
374
|
f.write(line)
|
|
374
375
|
except IOError as ex:
|
|
375
376
|
self.module.fail_json(msg="Failed to write to file %s: %s" % (tmp_path, to_native(ex)))
|
|
376
|
-
self.
|
|
377
|
+
if filename in self.files_mapping:
|
|
378
|
+
# Write to symlink target instead of replacing symlink as a normal file
|
|
379
|
+
self.module.atomic_move(tmp_path, self.files_mapping[filename])
|
|
380
|
+
else:
|
|
381
|
+
self.module.atomic_move(tmp_path, filename)
|
|
377
382
|
|
|
378
383
|
# allow the user to override the default mode
|
|
379
384
|
if filename in self.new_repos:
|
|
@@ -418,7 +423,7 @@ class SourcesList(object):
|
|
|
418
423
|
def _add_valid_source(self, source_new, comment_new, file):
|
|
419
424
|
# We'll try to reuse disabled source if we have it.
|
|
420
425
|
# If we have more than one entry, we will enable them all - no advanced logic, remember.
|
|
421
|
-
self.module.log('
|
|
426
|
+
self.module.log('adding source file: %s | %s | %s' % (source_new, comment_new, file))
|
|
422
427
|
found = False
|
|
423
428
|
for filename, n, enabled, source, comment in self:
|
|
424
429
|
if source == source_new:
|
|
@@ -457,7 +462,10 @@ class SourcesList(object):
|
|
|
457
462
|
|
|
458
463
|
class UbuntuSourcesList(SourcesList):
|
|
459
464
|
|
|
460
|
-
|
|
465
|
+
# prefer api.launchpad.net over launchpad.net/api
|
|
466
|
+
# see: https://github.com/ansible/ansible/pull/81978#issuecomment-1767062178
|
|
467
|
+
LP_API = 'https://api.launchpad.net/1.0/~%s/+archive/%s'
|
|
468
|
+
PPA_URI = 'https://ppa.launchpadcontent.net'
|
|
461
469
|
|
|
462
470
|
def __init__(self, module):
|
|
463
471
|
self.module = module
|
|
@@ -489,7 +497,7 @@ class UbuntuSourcesList(SourcesList):
|
|
|
489
497
|
except IndexError:
|
|
490
498
|
ppa_name = 'ppa'
|
|
491
499
|
|
|
492
|
-
line = 'deb
|
|
500
|
+
line = 'deb %s/%s/%s/ubuntu %s main' % (self.PPA_URI, ppa_owner, ppa_name, self.codename)
|
|
493
501
|
return line, ppa_owner, ppa_name
|
|
494
502
|
|
|
495
503
|
def _key_already_exists(self, key_fingerprint):
|
|
@@ -656,13 +664,13 @@ def main():
|
|
|
656
664
|
# made any more complex than it already is to try and cover more, eg, custom interpreters taking over
|
|
657
665
|
# system locations)
|
|
658
666
|
|
|
659
|
-
apt_pkg_name = 'python3-apt'
|
|
667
|
+
apt_pkg_name = 'python3-apt'
|
|
660
668
|
|
|
661
669
|
if has_respawned():
|
|
662
670
|
# this shouldn't be possible; short-circuit early if it happens...
|
|
663
671
|
module.fail_json(msg="{0} must be installed and visible from {1}.".format(apt_pkg_name, sys.executable))
|
|
664
672
|
|
|
665
|
-
interpreters = ['/usr/bin/python3', '/usr/bin/
|
|
673
|
+
interpreters = ['/usr/bin/python3', '/usr/bin/python']
|
|
666
674
|
|
|
667
675
|
interpreter = probe_interpreters_for_module(interpreters, 'apt')
|
|
668
676
|
|
ansible/modules/assemble.py
CHANGED
|
@@ -5,8 +5,7 @@
|
|
|
5
5
|
# Copyright: (c) 2017, Ansible Project
|
|
6
6
|
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
|
7
7
|
|
|
8
|
-
from __future__ import
|
|
9
|
-
__metaclass__ = type
|
|
8
|
+
from __future__ import annotations
|
|
10
9
|
|
|
11
10
|
|
|
12
11
|
DOCUMENTATION = r'''
|
ansible/modules/assert.py
CHANGED
|
@@ -3,8 +3,7 @@
|
|
|
3
3
|
# Copyright: (c) 2012, Dag Wieers <dag@wieers.com>
|
|
4
4
|
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
|
5
5
|
|
|
6
|
-
from __future__ import
|
|
7
|
-
__metaclass__ = type
|
|
6
|
+
from __future__ import annotations
|
|
8
7
|
|
|
9
8
|
|
|
10
9
|
DOCUMENTATION = r'''
|
|
@@ -74,12 +73,17 @@ author:
|
|
|
74
73
|
'''
|
|
75
74
|
|
|
76
75
|
EXAMPLES = r'''
|
|
77
|
-
-
|
|
76
|
+
- name: A single condition can be supplied as string instead of list
|
|
77
|
+
ansible.builtin.assert:
|
|
78
|
+
that: "ansible_os_family != 'RedHat'"
|
|
78
79
|
|
|
79
|
-
-
|
|
80
|
+
- name: Use yaml multiline strings to ease escaping
|
|
81
|
+
ansible.builtin.assert:
|
|
80
82
|
that:
|
|
81
83
|
- "'foo' in some_command_result.stdout"
|
|
82
84
|
- number_of_the_counting == 3
|
|
85
|
+
- >
|
|
86
|
+
"reject" not in some_command_result.stderr
|
|
83
87
|
|
|
84
88
|
- name: After version 2.7 both 'msg' and 'fail_msg' can customize failing assertion message
|
|
85
89
|
ansible.builtin.assert:
|
ansible/modules/async_status.py
CHANGED
|
@@ -3,8 +3,7 @@
|
|
|
3
3
|
# Copyright: (c) 2012, Michael DeHaan <michael.dehaan@gmail.com>, and others
|
|
4
4
|
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
|
5
5
|
|
|
6
|
-
from __future__ import
|
|
7
|
-
__metaclass__ = type
|
|
6
|
+
from __future__ import annotations
|
|
8
7
|
|
|
9
8
|
|
|
10
9
|
DOCUMENTATION = r'''
|
|
@@ -37,7 +36,8 @@ attributes:
|
|
|
37
36
|
async:
|
|
38
37
|
support: none
|
|
39
38
|
check_mode:
|
|
40
|
-
support:
|
|
39
|
+
support: full
|
|
40
|
+
version_added: '2.17'
|
|
41
41
|
diff_mode:
|
|
42
42
|
support: none
|
|
43
43
|
bypass_host_loop:
|
|
@@ -55,17 +55,17 @@ author:
|
|
|
55
55
|
|
|
56
56
|
EXAMPLES = r'''
|
|
57
57
|
---
|
|
58
|
-
- name: Asynchronous
|
|
59
|
-
ansible.builtin.
|
|
58
|
+
- name: Asynchronous dnf task
|
|
59
|
+
ansible.builtin.dnf:
|
|
60
60
|
name: docker-io
|
|
61
61
|
state: present
|
|
62
62
|
async: 1000
|
|
63
63
|
poll: 0
|
|
64
|
-
register:
|
|
64
|
+
register: dnf_sleeper
|
|
65
65
|
|
|
66
66
|
- name: Wait for asynchronous job to end
|
|
67
67
|
ansible.builtin.async_status:
|
|
68
|
-
jid: '{{
|
|
68
|
+
jid: '{{ dnf_sleeper.ansible_job_id }}'
|
|
69
69
|
register: job_result
|
|
70
70
|
until: job_result.finished
|
|
71
71
|
retries: 100
|
|
@@ -73,7 +73,7 @@ EXAMPLES = r'''
|
|
|
73
73
|
|
|
74
74
|
- name: Clean up async file
|
|
75
75
|
ansible.builtin.async_status:
|
|
76
|
-
jid: '{{
|
|
76
|
+
jid: '{{ dnf_sleeper.ansible_job_id }}'
|
|
77
77
|
mode: cleanup
|
|
78
78
|
'''
|
|
79
79
|
|
|
@@ -117,12 +117,15 @@ from ansible.module_utils.common.text.converters import to_native
|
|
|
117
117
|
|
|
118
118
|
def main():
|
|
119
119
|
|
|
120
|
-
module = AnsibleModule(
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
120
|
+
module = AnsibleModule(
|
|
121
|
+
argument_spec=dict(
|
|
122
|
+
jid=dict(type="str", required=True),
|
|
123
|
+
mode=dict(type="str", default="status", choices=["cleanup", "status"]),
|
|
124
|
+
# passed in from the async_status action plugin
|
|
125
|
+
_async_dir=dict(type="path", required=True),
|
|
126
|
+
),
|
|
127
|
+
supports_check_mode=True,
|
|
128
|
+
)
|
|
126
129
|
|
|
127
130
|
mode = module.params['mode']
|
|
128
131
|
jid = module.params['jid']
|
ansible/modules/async_wrapper.py
CHANGED
|
@@ -3,8 +3,7 @@
|
|
|
3
3
|
# Copyright: (c) 2012, Michael DeHaan <michael.dehaan@gmail.com>, and others
|
|
4
4
|
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
|
5
5
|
|
|
6
|
-
from __future__ import
|
|
7
|
-
__metaclass__ = type
|
|
6
|
+
from __future__ import annotations
|
|
8
7
|
|
|
9
8
|
|
|
10
9
|
import errno
|
|
@@ -22,8 +21,6 @@ import multiprocessing
|
|
|
22
21
|
|
|
23
22
|
from ansible.module_utils.common.text.converters import to_text, to_bytes
|
|
24
23
|
|
|
25
|
-
PY3 = sys.version_info[0] == 3
|
|
26
|
-
|
|
27
24
|
syslog.openlog('ansible-%s' % os.path.basename(__file__))
|
|
28
25
|
syslog.syslog(syslog.LOG_NOTICE, 'Invoked with %s' % " ".join(sys.argv[1:]))
|
|
29
26
|
|
|
@@ -169,13 +166,18 @@ def _run_module(wrapped_cmd, jid):
|
|
|
169
166
|
interpreter = _get_interpreter(cmd[0])
|
|
170
167
|
if interpreter:
|
|
171
168
|
cmd = interpreter + cmd
|
|
172
|
-
script = subprocess.Popen(
|
|
173
|
-
|
|
169
|
+
script = subprocess.Popen(
|
|
170
|
+
cmd,
|
|
171
|
+
stdin=subprocess.PIPE,
|
|
172
|
+
stdout=subprocess.PIPE,
|
|
173
|
+
stderr=subprocess.PIPE,
|
|
174
|
+
shell=False,
|
|
175
|
+
text=True,
|
|
176
|
+
encoding="utf-8",
|
|
177
|
+
errors="surrogateescape",
|
|
178
|
+
)
|
|
174
179
|
|
|
175
180
|
(outdata, stderr) = script.communicate()
|
|
176
|
-
if PY3:
|
|
177
|
-
outdata = outdata.decode('utf-8', 'surrogateescape')
|
|
178
|
-
stderr = stderr.decode('utf-8', 'surrogateescape')
|
|
179
181
|
|
|
180
182
|
(filtered_outdata, json_warnings) = _filter_non_json_lines(outdata)
|
|
181
183
|
|
ansible/modules/blockinfile.py
CHANGED
|
@@ -4,8 +4,7 @@
|
|
|
4
4
|
# Copyright: (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
|
|
|
11
10
|
DOCUMENTATION = r'''
|
|
@@ -111,7 +110,7 @@ notes:
|
|
|
111
110
|
- As of Ansible 2.3, the O(dest) option has been changed to O(path) as default, but O(dest) still works as well.
|
|
112
111
|
- Option O(ignore:follow) has been removed in Ansible 2.5, because this module modifies the contents of the file
|
|
113
112
|
so O(ignore:follow=no) does not make sense.
|
|
114
|
-
- When more
|
|
113
|
+
- When more than one block should be handled in one file you must change the O(marker) per task.
|
|
115
114
|
extends_documentation_fragment:
|
|
116
115
|
- action_common_attributes
|
|
117
116
|
- action_common_attributes.files
|
ansible/modules/command.py
CHANGED
|
@@ -4,8 +4,7 @@
|
|
|
4
4
|
# Copyright: (c) 2016, Toshio Kuratomi <tkuratomi@ansible.com>
|
|
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
|
|
|
11
10
|
DOCUMENTATION = r'''
|