ansible-core 2.15.4rc1__py3-none-any.whl → 2.16.0b2__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/cli/__init__.py +3 -3
- ansible/cli/adhoc.py +1 -1
- ansible/cli/arguments/option_helpers.py +15 -5
- ansible/cli/config.py +2 -2
- ansible/cli/console.py +21 -17
- ansible/cli/doc.py +8 -9
- ansible/cli/galaxy.py +60 -27
- ansible/cli/inventory.py +1 -1
- ansible/cli/playbook.py +1 -1
- ansible/cli/pull.py +2 -2
- ansible/cli/scripts/ansible_connection_cli_stub.py +1 -1
- ansible/cli/vault.py +11 -6
- ansible/collections/__init__.py +0 -29
- ansible/collections/list.py +23 -44
- ansible/config/ansible_builtin_runtime.yml +8 -4
- ansible/config/base.yml +34 -22
- ansible/config/manager.py +1 -1
- ansible/constants.py +3 -5
- ansible/errors/__init__.py +1 -1
- ansible/executor/interpreter_discovery.py +1 -1
- ansible/executor/module_common.py +39 -32
- ansible/executor/play_iterator.py +0 -15
- ansible/executor/playbook_executor.py +3 -3
- ansible/executor/powershell/module_manifest.py +1 -1
- ansible/executor/powershell/module_wrapper.ps1 +4 -1
- ansible/executor/process/worker.py +22 -7
- ansible/executor/task_executor.py +39 -40
- ansible/executor/task_queue_manager.py +8 -11
- ansible/galaxy/__init__.py +1 -1
- ansible/galaxy/api.py +8 -11
- ansible/galaxy/collection/__init__.py +17 -4
- ansible/galaxy/collection/concrete_artifact_manager.py +7 -2
- ansible/galaxy/collection/galaxy_api_proxy.py +1 -1
- ansible/galaxy/data/container/README.md +3 -5
- ansible/galaxy/dependency_resolution/__init__.py +1 -6
- ansible/galaxy/dependency_resolution/dataclasses.py +22 -1
- ansible/galaxy/dependency_resolution/providers.py +61 -69
- ansible/galaxy/role.py +31 -13
- ansible/galaxy/token.py +2 -2
- ansible/inventory/group.py +1 -1
- ansible/inventory/manager.py +1 -1
- ansible/module_utils/ansible_release.py +2 -2
- ansible/module_utils/basic.py +11 -41
- ansible/module_utils/common/file.py +0 -100
- ansible/module_utils/common/json.py +1 -1
- ansible/module_utils/common/locale.py +1 -1
- ansible/module_utils/common/text/converters.py +2 -2
- ansible/module_utils/common/validation.py +1 -1
- ansible/module_utils/compat/_selectors2.py +4 -4
- ansible/module_utils/compat/datetime.py +40 -0
- ansible/module_utils/compat/selinux.py +1 -1
- ansible/module_utils/compat/typing.py +1 -1
- ansible/module_utils/connection.py +1 -1
- ansible/module_utils/facts/hardware/linux.py +2 -2
- ansible/module_utils/facts/hardware/openbsd.py +1 -1
- ansible/module_utils/facts/network/linux.py +3 -3
- ansible/module_utils/facts/other/facter.py +8 -15
- ansible/module_utils/facts/sysctl.py +1 -1
- ansible/module_utils/facts/system/date_time.py +2 -2
- ansible/module_utils/facts/system/distribution.py +1 -1
- ansible/module_utils/facts/system/local.py +6 -2
- ansible/module_utils/facts/system/pkg_mgr.py +6 -1
- ansible/module_utils/facts/system/service_mgr.py +4 -2
- ansible/module_utils/parsing/convert_bool.py +1 -1
- ansible/module_utils/service.py +9 -6
- ansible/module_utils/urls.py +40 -22
- ansible/modules/add_host.py +2 -2
- ansible/modules/apt.py +48 -31
- ansible/modules/apt_key.py +4 -4
- ansible/modules/apt_repository.py +5 -5
- ansible/modules/assemble.py +7 -7
- ansible/modules/assert.py +1 -1
- ansible/modules/async_status.py +11 -7
- ansible/modules/async_wrapper.py +1 -1
- ansible/modules/blockinfile.py +60 -17
- ansible/modules/command.py +37 -15
- ansible/modules/copy.py +35 -30
- ansible/modules/cron.py +14 -14
- ansible/modules/deb822_repository.py +4 -3
- ansible/modules/debconf.py +35 -14
- ansible/modules/debug.py +1 -1
- ansible/modules/dnf.py +29 -27
- ansible/modules/dnf5.py +22 -22
- ansible/modules/dpkg_selections.py +9 -2
- ansible/modules/expect.py +4 -4
- ansible/modules/fetch.py +7 -7
- ansible/modules/file.py +30 -30
- ansible/modules/find.py +82 -22
- ansible/modules/gather_facts.py +6 -2
- ansible/modules/get_url.py +29 -29
- ansible/modules/getent.py +4 -4
- ansible/modules/git.py +27 -27
- ansible/modules/group.py +5 -12
- ansible/modules/hostname.py +21 -2
- ansible/modules/include_role.py +5 -5
- ansible/modules/include_tasks.py +2 -2
- ansible/modules/include_vars.py +5 -5
- ansible/modules/iptables.py +70 -65
- ansible/modules/known_hosts.py +7 -7
- ansible/modules/lineinfile.py +33 -33
- ansible/modules/meta.py +13 -13
- ansible/modules/package.py +8 -8
- ansible/modules/package_facts.py +3 -3
- ansible/modules/pause.py +2 -2
- ansible/modules/ping.py +5 -5
- ansible/modules/pip.py +80 -46
- ansible/modules/reboot.py +8 -4
- ansible/modules/replace.py +20 -15
- ansible/modules/rpm_key.py +2 -2
- ansible/modules/script.py +16 -10
- ansible/modules/service.py +26 -98
- ansible/modules/service_facts.py +36 -12
- ansible/modules/set_fact.py +2 -2
- ansible/modules/set_stats.py +2 -2
- ansible/modules/setup.py +18 -18
- ansible/modules/shell.py +3 -3
- ansible/modules/stat.py +9 -30
- ansible/modules/subversion.py +9 -9
- ansible/modules/systemd.py +20 -19
- ansible/modules/systemd_service.py +20 -19
- ansible/modules/sysvinit.py +26 -21
- ansible/modules/tempfile.py +5 -4
- ansible/modules/template.py +60 -6
- ansible/modules/unarchive.py +21 -18
- ansible/modules/uri.py +39 -39
- ansible/modules/user.py +81 -53
- ansible/modules/wait_for.py +22 -21
- ansible/modules/wait_for_connection.py +4 -4
- ansible/modules/yum.py +38 -38
- ansible/modules/yum_repository.py +58 -80
- ansible/parsing/dataloader.py +27 -27
- ansible/parsing/mod_args.py +1 -1
- ansible/parsing/plugin_docs.py +3 -3
- ansible/parsing/splitter.py +14 -16
- ansible/parsing/utils/yaml.py +1 -1
- ansible/parsing/vault/__init__.py +8 -6
- ansible/parsing/yaml/constructor.py +1 -1
- ansible/parsing/yaml/objects.py +1 -1
- ansible/playbook/__init__.py +1 -1
- ansible/playbook/base.py +2 -2
- ansible/playbook/block.py +0 -1
- ansible/playbook/conditional.py +40 -114
- ansible/playbook/helpers.py +5 -28
- ansible/playbook/included_file.py +8 -7
- ansible/playbook/play.py +1 -1
- ansible/playbook/play_context.py +2 -2
- ansible/playbook/playbook_include.py +2 -2
- ansible/playbook/role/__init__.py +1 -1
- ansible/playbook/role/include.py +1 -1
- ansible/playbook/role/metadata.py +1 -1
- ansible/playbook/role_include.py +1 -1
- ansible/playbook/task.py +2 -2
- ansible/playbook/task_include.py +1 -24
- ansible/plugins/__init__.py +13 -5
- ansible/plugins/action/__init__.py +17 -43
- ansible/plugins/action/add_host.py +2 -3
- ansible/plugins/action/assemble.py +1 -1
- ansible/plugins/action/assert.py +2 -1
- ansible/plugins/action/copy.py +2 -2
- ansible/plugins/action/debug.py +2 -1
- ansible/plugins/action/fail.py +1 -0
- ansible/plugins/action/fetch.py +3 -1
- ansible/plugins/action/gather_facts.py +37 -13
- ansible/plugins/action/group_by.py +1 -0
- ansible/plugins/action/include_vars.py +3 -2
- ansible/plugins/action/normal.py +3 -3
- ansible/plugins/action/pause.py +1 -1
- ansible/plugins/action/reboot.py +21 -16
- ansible/plugins/action/script.py +23 -8
- ansible/plugins/action/set_fact.py +1 -0
- ansible/plugins/action/set_stats.py +1 -0
- ansible/plugins/action/shell.py +6 -0
- ansible/plugins/action/template.py +1 -1
- ansible/plugins/action/unarchive.py +1 -1
- ansible/plugins/action/uri.py +1 -1
- ansible/plugins/action/validate_argument_spec.py +1 -0
- ansible/plugins/action/wait_for_connection.py +4 -4
- ansible/plugins/become/__init__.py +1 -1
- ansible/plugins/become/su.py +1 -1
- ansible/plugins/cache/__init__.py +1 -1
- ansible/plugins/callback/junit.py +1 -1
- ansible/plugins/callback/oneline.py +1 -1
- ansible/plugins/callback/tree.py +1 -1
- ansible/plugins/cliconf/__init__.py +2 -2
- ansible/plugins/connection/__init__.py +65 -37
- ansible/plugins/connection/local.py +9 -8
- ansible/plugins/connection/paramiko_ssh.py +34 -28
- ansible/plugins/connection/psrp.py +56 -43
- ansible/plugins/connection/ssh.py +67 -43
- ansible/plugins/connection/winrm.py +77 -30
- ansible/plugins/doc_fragments/constructed.py +4 -4
- ansible/plugins/doc_fragments/files.py +12 -12
- ansible/plugins/doc_fragments/inventory_cache.py +0 -6
- ansible/plugins/doc_fragments/result_format_callback.py +5 -5
- ansible/plugins/doc_fragments/shell_common.py +2 -2
- ansible/plugins/doc_fragments/shell_windows.py +1 -1
- ansible/plugins/doc_fragments/template_common.py +6 -6
- ansible/plugins/doc_fragments/url.py +10 -10
- ansible/plugins/doc_fragments/url_windows.py +15 -15
- ansible/plugins/doc_fragments/vars_plugin_staging.py +4 -4
- ansible/plugins/filter/b64decode.yml +1 -1
- ansible/plugins/filter/b64encode.yml +2 -2
- ansible/plugins/filter/bool.yml +5 -5
- ansible/plugins/filter/combine.yml +1 -1
- ansible/plugins/filter/commonpath.yml +2 -1
- ansible/plugins/filter/core.py +6 -8
- ansible/plugins/filter/dict2items.yml +11 -1
- ansible/plugins/filter/difference.yml +1 -0
- ansible/plugins/filter/encryption.py +1 -1
- ansible/plugins/filter/extract.yml +1 -1
- ansible/plugins/filter/flatten.yml +1 -1
- ansible/plugins/filter/from_yaml.yml +1 -1
- ansible/plugins/filter/from_yaml_all.yml +2 -2
- ansible/plugins/filter/hash.yml +1 -1
- ansible/plugins/filter/human_readable.yml +1 -1
- ansible/plugins/filter/human_to_bytes.yml +2 -2
- ansible/plugins/filter/intersect.yml +1 -0
- ansible/plugins/filter/mandatory.yml +7 -0
- ansible/plugins/filter/mathstuff.py +15 -17
- ansible/plugins/filter/normpath.yml +1 -1
- ansible/plugins/filter/path_join.yml +8 -1
- ansible/plugins/filter/realpath.yml +3 -2
- ansible/plugins/filter/regex_findall.yml +8 -2
- ansible/plugins/filter/regex_replace.yml +9 -3
- ansible/plugins/filter/regex_search.yml +8 -2
- ansible/plugins/filter/relpath.yml +2 -2
- ansible/plugins/filter/root.yml +1 -1
- ansible/plugins/filter/splitext.yml +1 -1
- ansible/plugins/filter/subelements.yml +2 -2
- ansible/plugins/filter/symmetric_difference.yml +1 -0
- ansible/plugins/filter/ternary.yml +5 -5
- ansible/plugins/filter/to_json.yml +7 -7
- ansible/plugins/filter/to_nice_json.yml +5 -5
- ansible/plugins/filter/to_yaml.yml +2 -2
- ansible/plugins/filter/type_debug.yml +1 -1
- ansible/plugins/filter/union.yml +1 -0
- ansible/plugins/filter/unvault.yml +2 -2
- ansible/plugins/filter/urldecode.yml +13 -32
- ansible/plugins/filter/urlsplit.py +1 -1
- ansible/plugins/filter/vault.yml +1 -1
- ansible/plugins/filter/zip.yml +1 -1
- ansible/plugins/filter/zip_longest.yml +1 -1
- ansible/plugins/inventory/__init__.py +1 -1
- ansible/plugins/inventory/advanced_host_list.py +1 -1
- ansible/plugins/inventory/constructed.py +2 -2
- ansible/plugins/inventory/host_list.py +1 -1
- ansible/plugins/inventory/ini.py +6 -3
- ansible/plugins/inventory/script.py +8 -2
- ansible/plugins/inventory/toml.py +1 -1
- ansible/plugins/inventory/yaml.py +1 -1
- ansible/plugins/list.py +21 -17
- ansible/plugins/loader.py +66 -88
- ansible/plugins/lookup/__init__.py +1 -1
- ansible/plugins/lookup/config.py +16 -6
- ansible/plugins/lookup/csvfile.py +7 -4
- ansible/plugins/lookup/env.py +1 -1
- ansible/plugins/lookup/file.py +5 -2
- ansible/plugins/lookup/fileglob.py +5 -2
- ansible/plugins/lookup/first_found.py +20 -14
- ansible/plugins/lookup/ini.py +6 -3
- ansible/plugins/lookup/lines.py +2 -1
- ansible/plugins/lookup/password.py +7 -7
- ansible/plugins/lookup/pipe.py +1 -0
- ansible/plugins/lookup/random_choice.py +2 -2
- ansible/plugins/lookup/sequence.py +1 -1
- ansible/plugins/lookup/subelements.py +2 -2
- ansible/plugins/lookup/template.py +4 -1
- ansible/plugins/lookup/unvault.py +4 -1
- ansible/plugins/lookup/url.py +6 -6
- ansible/plugins/lookup/varnames.py +1 -1
- ansible/plugins/netconf/__init__.py +3 -3
- ansible/plugins/shell/__init__.py +1 -1
- ansible/plugins/shell/cmd.py +7 -7
- ansible/plugins/shell/powershell.py +1 -1
- ansible/plugins/strategy/__init__.py +8 -10
- ansible/plugins/strategy/free.py +1 -1
- ansible/plugins/strategy/linear.py +3 -3
- ansible/plugins/terminal/__init__.py +2 -2
- ansible/plugins/test/abs.yml +1 -1
- ansible/plugins/test/all.yml +1 -1
- ansible/plugins/test/any.yml +1 -1
- ansible/plugins/test/change.yml +2 -2
- ansible/plugins/test/changed.yml +2 -2
- ansible/plugins/test/contains.yml +1 -1
- ansible/plugins/test/core.py +1 -1
- ansible/plugins/test/directory.yml +1 -1
- ansible/plugins/test/exists.yml +3 -2
- ansible/plugins/test/failed.yml +2 -2
- ansible/plugins/test/failure.yml +2 -2
- ansible/plugins/test/falsy.yml +2 -2
- ansible/plugins/test/file.yml +1 -1
- ansible/plugins/test/finished.yml +2 -2
- ansible/plugins/test/is_abs.yml +1 -1
- ansible/plugins/test/is_dir.yml +1 -1
- ansible/plugins/test/is_file.yml +1 -1
- ansible/plugins/test/is_link.yml +1 -1
- ansible/plugins/test/is_mount.yml +1 -1
- ansible/plugins/test/is_same_file.yml +1 -1
- ansible/plugins/test/isnan.yml +1 -1
- ansible/plugins/test/issubset.yml +1 -2
- ansible/plugins/test/issuperset.yml +1 -2
- ansible/plugins/test/link.yml +1 -1
- ansible/plugins/test/link_exists.yml +1 -1
- ansible/plugins/test/match.yml +2 -2
- ansible/plugins/test/mount.yml +1 -1
- ansible/plugins/test/nan.yml +1 -1
- ansible/plugins/test/reachable.yml +2 -2
- ansible/plugins/test/regex.yml +1 -1
- ansible/plugins/test/same_file.yml +1 -1
- ansible/plugins/test/search.yml +2 -2
- ansible/plugins/test/skip.yml +3 -3
- ansible/plugins/test/skipped.yml +3 -3
- ansible/plugins/test/started.yml +2 -2
- ansible/plugins/test/subset.yml +1 -2
- ansible/plugins/test/succeeded.yml +2 -2
- ansible/plugins/test/success.yml +2 -2
- ansible/plugins/test/successful.yml +2 -2
- ansible/plugins/test/superset.yml +1 -2
- ansible/plugins/test/truthy.yml +3 -3
- ansible/plugins/test/unreachable.yml +2 -2
- ansible/plugins/test/uri.yml +1 -1
- ansible/plugins/test/url.yml +1 -1
- ansible/plugins/test/urn.yml +1 -1
- ansible/plugins/test/vault_encrypted.yml +1 -1
- ansible/plugins/test/version.yml +7 -7
- ansible/plugins/test/version_compare.yml +7 -7
- ansible/plugins/vars/host_group_vars.py +1 -1
- ansible/release.py +2 -2
- ansible/template/__init__.py +24 -26
- ansible/template/native_helpers.py +1 -1
- ansible/template/vars.py +1 -1
- ansible/utils/_junit_xml.py +1 -1
- ansible/utils/cmd_functions.py +1 -1
- ansible/utils/collection_loader/_collection_finder.py +12 -1
- ansible/utils/display.py +113 -62
- ansible/utils/encrypt.py +11 -14
- ansible/utils/hashing.py +1 -1
- ansible/utils/jsonrpc.py +1 -1
- ansible/utils/path.py +1 -1
- ansible/utils/plugin_docs.py +1 -1
- ansible/utils/py3compat.py +1 -1
- ansible/utils/shlex.py +2 -10
- ansible/utils/ssh_functions.py +5 -4
- ansible/utils/unicode.py +1 -1
- ansible/utils/unsafe_proxy.py +1 -1
- ansible/utils/vars.py +4 -29
- ansible/vars/hostvars.py +1 -2
- ansible/vars/manager.py +13 -9
- ansible/vars/plugins.py +2 -2
- {ansible_core-2.15.4rc1.dist-info → ansible_core-2.16.0b2.dist-info}/COPYING +4 -5
- {ansible_core-2.15.4rc1.dist-info → ansible_core-2.16.0b2.dist-info}/METADATA +2 -4
- {ansible_core-2.15.4rc1.dist-info → ansible_core-2.16.0b2.dist-info}/RECORD +424 -425
- ansible_test/_data/completion/docker.txt +9 -9
- ansible_test/_data/completion/remote.txt +4 -7
- ansible_test/_data/completion/windows.txt +0 -2
- ansible_test/_data/requirements/ansible-test.txt +2 -1
- ansible_test/_data/requirements/ansible.txt +0 -3
- ansible_test/_data/requirements/constraints.txt +0 -2
- ansible_test/_data/requirements/sanity.ansible-doc.txt +3 -5
- ansible_test/_data/requirements/sanity.changelog.in +1 -2
- ansible_test/_data/requirements/sanity.changelog.txt +4 -6
- ansible_test/_data/requirements/sanity.import.plugin.txt +2 -4
- ansible_test/_data/requirements/sanity.import.txt +1 -3
- ansible_test/_data/requirements/sanity.integration-aliases.txt +1 -3
- 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 +6 -12
- ansible_test/_data/requirements/sanity.runtime-metadata.txt +1 -3
- ansible_test/_data/requirements/sanity.validate-modules.in +1 -1
- ansible_test/_data/requirements/sanity.validate-modules.txt +3 -5
- ansible_test/_data/requirements/sanity.yamllint.txt +3 -5
- ansible_test/_data/requirements/units.txt +0 -1
- ansible_test/_internal/ci/azp.py +4 -4
- ansible_test/_internal/cli/environments.py +0 -13
- ansible_test/_internal/commands/coverage/analyze/targets/__init__.py +4 -4
- ansible_test/_internal/commands/coverage/combine.py +1 -1
- ansible_test/_internal/commands/integration/cloud/acme.py +6 -8
- ansible_test/_internal/commands/integration/cloud/cs.py +4 -9
- ansible_test/_internal/commands/integration/cloud/galaxy.py +103 -96
- ansible_test/_internal/commands/integration/cloud/httptester.py +0 -3
- ansible_test/_internal/commands/integration/cloud/nios.py +7 -9
- ansible_test/_internal/commands/integration/cloud/openshift.py +2 -7
- ansible_test/_internal/commands/integration/cloud/vcenter.py +11 -95
- ansible_test/_internal/commands/sanity/__init__.py +10 -0
- ansible_test/_internal/commands/sanity/import.py +8 -2
- ansible_test/_internal/commands/sanity/pylint.py +27 -1
- ansible_test/_internal/commands/units/__init__.py +2 -1
- ansible_test/_internal/config.py +0 -7
- ansible_test/_internal/containers.py +11 -56
- ansible_test/_internal/core_ci.py +0 -7
- ansible_test/_internal/coverage_util.py +8 -3
- ansible_test/_internal/delegation.py +0 -1
- ansible_test/_internal/diff.py +1 -1
- ansible_test/_internal/docker_util.py +9 -2
- ansible_test/_internal/host_profiles.py +6 -6
- ansible_test/_internal/http.py +1 -1
- ansible_test/_internal/junit_xml.py +1 -1
- ansible_test/_internal/pypi_proxy.py +1 -1
- ansible_test/_internal/python_requirements.py +3 -8
- ansible_test/_internal/util.py +1 -6
- ansible_test/_util/controller/sanity/code-smell/no-get-exception.json +4 -0
- ansible_test/_util/controller/sanity/code-smell/replace-urlopen.json +4 -0
- ansible_test/_util/controller/sanity/code-smell/use-compat-six.json +4 -0
- ansible_test/_util/controller/sanity/mypy/ansible-core.ini +3 -0
- ansible_test/_util/controller/sanity/pylint/config/ansible-test-target.cfg +2 -0
- ansible_test/_util/controller/sanity/pylint/config/ansible-test.cfg +0 -1
- ansible_test/_util/controller/sanity/pylint/config/collection.cfg +1 -0
- ansible_test/_util/controller/sanity/pylint/plugins/deprecated.py +172 -10
- ansible_test/_util/controller/sanity/pylint/plugins/string_format.py +13 -2
- ansible_test/_util/controller/sanity/pylint/plugins/unwanted.py +7 -1
- ansible_test/_util/controller/sanity/validate-modules/validate_modules/main.py +6 -6
- ansible_test/_util/controller/sanity/validate-modules/validate_modules/module_args.py +1 -1
- ansible_test/_util/controller/sanity/validate-modules/validate_modules/utils.py +1 -1
- ansible_test/_util/controller/sanity/yamllint/yamllinter.py +3 -3
- ansible_test/_util/controller/tools/collection_detail.py +2 -2
- ansible_test/_util/target/common/constants.py +2 -2
- ansible_test/_util/target/pytest/plugins/ansible_forked.py +103 -0
- ansible_test/_util/target/sanity/import/importer.py +0 -8
- ansible_test/_util/target/setup/bootstrap.sh +36 -16
- ansible_test/_util/target/setup/quiet_pip.py +0 -4
- ansible/modules/_include.py +0 -80
- ansible_test/_internal/commands/integration/cloud/foreman.py +0 -102
- ansible_test/_util/target/setup/ConfigureRemotingForAnsible.ps1 +0 -435
- {ansible_core-2.15.4rc1.data → ansible_core-2.16.0b2.data}/scripts/ansible-test +0 -0
- {ansible_core-2.15.4rc1.dist-info → ansible_core-2.16.0b2.dist-info}/WHEEL +0 -0
- {ansible_core-2.15.4rc1.dist-info → ansible_core-2.16.0b2.dist-info}/entry_points.txt +0 -0
- {ansible_core-2.15.4rc1.dist-info → ansible_core-2.16.0b2.dist-info}/top_level.txt +0 -0
ansible/modules/lineinfile.py
CHANGED
|
@@ -25,20 +25,20 @@ options:
|
|
|
25
25
|
path:
|
|
26
26
|
description:
|
|
27
27
|
- The file to modify.
|
|
28
|
-
- Before Ansible 2.3 this option was only usable as
|
|
28
|
+
- Before Ansible 2.3 this option was only usable as O(dest), O(destfile) and O(name).
|
|
29
29
|
type: path
|
|
30
30
|
required: true
|
|
31
31
|
aliases: [ dest, destfile, name ]
|
|
32
32
|
regexp:
|
|
33
33
|
description:
|
|
34
34
|
- The regular expression to look for in every line of the file.
|
|
35
|
-
- For
|
|
36
|
-
- For
|
|
35
|
+
- For O(state=present), the pattern to replace if found. Only the last line found will be replaced.
|
|
36
|
+
- For O(state=absent), the pattern of the line(s) to remove.
|
|
37
37
|
- If the regular expression is not matched, the line will be
|
|
38
|
-
added to the file in keeping with
|
|
38
|
+
added to the file in keeping with O(insertbefore) or O(insertafter)
|
|
39
39
|
settings.
|
|
40
40
|
- When modifying a line the regexp should typically match both the initial state of
|
|
41
|
-
the line as well as its state after replacement by
|
|
41
|
+
the line as well as its state after replacement by O(line) to ensure idempotence.
|
|
42
42
|
- Uses Python regular expressions. See U(https://docs.python.org/3/library/re.html).
|
|
43
43
|
type: str
|
|
44
44
|
aliases: [ regex ]
|
|
@@ -46,12 +46,12 @@ options:
|
|
|
46
46
|
search_string:
|
|
47
47
|
description:
|
|
48
48
|
- The literal string to look for in every line of the file. This does not have to match the entire line.
|
|
49
|
-
- For
|
|
50
|
-
- For
|
|
49
|
+
- For O(state=present), the line to replace if the string is found in the file. Only the last line found will be replaced.
|
|
50
|
+
- For O(state=absent), the line(s) to remove if the string is in the line.
|
|
51
51
|
- If the literal expression is not matched, the line will be
|
|
52
|
-
added to the file in keeping with
|
|
52
|
+
added to the file in keeping with O(insertbefore) or O(insertafter)
|
|
53
53
|
settings.
|
|
54
|
-
- Mutually exclusive with
|
|
54
|
+
- Mutually exclusive with O(backrefs) and O(regexp).
|
|
55
55
|
type: str
|
|
56
56
|
version_added: '2.11'
|
|
57
57
|
state:
|
|
@@ -63,53 +63,53 @@ options:
|
|
|
63
63
|
line:
|
|
64
64
|
description:
|
|
65
65
|
- The line to insert/replace into the file.
|
|
66
|
-
- Required for
|
|
67
|
-
- If
|
|
68
|
-
expanded with the
|
|
66
|
+
- Required for O(state=present).
|
|
67
|
+
- If O(backrefs) is set, may contain backreferences that will get
|
|
68
|
+
expanded with the O(regexp) capture groups if the regexp matches.
|
|
69
69
|
type: str
|
|
70
70
|
aliases: [ value ]
|
|
71
71
|
backrefs:
|
|
72
72
|
description:
|
|
73
|
-
- Used with
|
|
74
|
-
- If set,
|
|
75
|
-
that will get populated if the
|
|
73
|
+
- Used with O(state=present).
|
|
74
|
+
- If set, O(line) can contain backreferences (both positional and named)
|
|
75
|
+
that will get populated if the O(regexp) matches.
|
|
76
76
|
- This parameter changes the operation of the module slightly;
|
|
77
|
-
|
|
77
|
+
O(insertbefore) and O(insertafter) will be ignored, and if the O(regexp)
|
|
78
78
|
does not match anywhere in the file, the file will be left unchanged.
|
|
79
|
-
- If the
|
|
79
|
+
- If the O(regexp) does match, the last matching line will be replaced by
|
|
80
80
|
the expanded line parameter.
|
|
81
|
-
- Mutually exclusive with
|
|
81
|
+
- Mutually exclusive with O(search_string).
|
|
82
82
|
type: bool
|
|
83
83
|
default: no
|
|
84
84
|
version_added: "1.1"
|
|
85
85
|
insertafter:
|
|
86
86
|
description:
|
|
87
|
-
- Used with
|
|
87
|
+
- Used with O(state=present).
|
|
88
88
|
- If specified, the line will be inserted after the last match of specified regular expression.
|
|
89
89
|
- If the first match is required, use(firstmatch=yes).
|
|
90
|
-
- A special value is available;
|
|
90
|
+
- A special value is available; V(EOF) for inserting the line at the end of the file.
|
|
91
91
|
- If specified regular expression has no matches, EOF will be used instead.
|
|
92
|
-
- If
|
|
93
|
-
- If regular expressions are passed to both
|
|
94
|
-
- May not be used with
|
|
92
|
+
- If O(insertbefore) is set, default value V(EOF) will be ignored.
|
|
93
|
+
- If regular expressions are passed to both O(regexp) and O(insertafter), O(insertafter) is only honored if no match for O(regexp) is found.
|
|
94
|
+
- May not be used with O(backrefs) or O(insertbefore).
|
|
95
95
|
type: str
|
|
96
96
|
choices: [ EOF, '*regex*' ]
|
|
97
97
|
default: EOF
|
|
98
98
|
insertbefore:
|
|
99
99
|
description:
|
|
100
|
-
- Used with
|
|
100
|
+
- Used with O(state=present).
|
|
101
101
|
- If specified, the line will be inserted before the last match of specified regular expression.
|
|
102
|
-
- If the first match is required, use
|
|
103
|
-
- A value is available;
|
|
102
|
+
- If the first match is required, use O(firstmatch=yes).
|
|
103
|
+
- A value is available; V(BOF) for inserting the line at the beginning of the file.
|
|
104
104
|
- If specified regular expression has no matches, the line will be inserted at the end of the file.
|
|
105
|
-
- If regular expressions are passed to both
|
|
106
|
-
- May not be used with
|
|
105
|
+
- If regular expressions are passed to both O(regexp) and O(insertbefore), O(insertbefore) is only honored if no match for O(regexp) is found.
|
|
106
|
+
- May not be used with O(backrefs) or O(insertafter).
|
|
107
107
|
type: str
|
|
108
108
|
choices: [ BOF, '*regex*' ]
|
|
109
109
|
version_added: "1.1"
|
|
110
110
|
create:
|
|
111
111
|
description:
|
|
112
|
-
- Used with
|
|
112
|
+
- Used with O(state=present).
|
|
113
113
|
- If specified, the file will be created if it does not already exist.
|
|
114
114
|
- By default it will fail if the file is missing.
|
|
115
115
|
type: bool
|
|
@@ -122,8 +122,8 @@ options:
|
|
|
122
122
|
default: no
|
|
123
123
|
firstmatch:
|
|
124
124
|
description:
|
|
125
|
-
- Used with
|
|
126
|
-
- If set,
|
|
125
|
+
- Used with O(insertafter) or O(insertbefore).
|
|
126
|
+
- If set, O(insertafter) and O(insertbefore) will work with the first line that matches the given regular expression.
|
|
127
127
|
type: bool
|
|
128
128
|
default: no
|
|
129
129
|
version_added: "2.5"
|
|
@@ -148,7 +148,7 @@ attributes:
|
|
|
148
148
|
vault:
|
|
149
149
|
support: none
|
|
150
150
|
notes:
|
|
151
|
-
- As of Ansible 2.3, the
|
|
151
|
+
- As of Ansible 2.3, the O(dest) option has been changed to O(path) as default, but O(dest) still works as well.
|
|
152
152
|
seealso:
|
|
153
153
|
- module: ansible.builtin.blockinfile
|
|
154
154
|
- module: ansible.builtin.copy
|
|
@@ -255,7 +255,7 @@ import tempfile
|
|
|
255
255
|
|
|
256
256
|
# import module snippets
|
|
257
257
|
from ansible.module_utils.basic import AnsibleModule
|
|
258
|
-
from ansible.module_utils.
|
|
258
|
+
from ansible.module_utils.common.text.converters import to_bytes, to_native, to_text
|
|
259
259
|
|
|
260
260
|
|
|
261
261
|
def write_changes(module, b_lines, dest):
|
ansible/modules/meta.py
CHANGED
|
@@ -19,21 +19,21 @@ options:
|
|
|
19
19
|
free_form:
|
|
20
20
|
description:
|
|
21
21
|
- This module takes a free form command, as a string. There is not an actual option named "free form". See the examples!
|
|
22
|
-
-
|
|
22
|
+
- V(flush_handlers) makes Ansible run any handler tasks which have thus far been notified. Ansible inserts these tasks internally at certain
|
|
23
23
|
points to implicitly trigger handler runs (after pre/post tasks, the final role execution, and the main tasks section of your plays).
|
|
24
|
-
-
|
|
24
|
+
- V(refresh_inventory) (added in Ansible 2.0) forces the reload of the inventory, which in the case of dynamic inventory scripts means they will be
|
|
25
25
|
re-executed. If the dynamic inventory script is using a cache, Ansible cannot know this and has no way of refreshing it (you can disable the cache
|
|
26
26
|
or, if available for your specific inventory datasource (e.g. aws), you can use the an inventory plugin instead of an inventory script).
|
|
27
27
|
This is mainly useful when additional hosts are created and users wish to use them instead of using the M(ansible.builtin.add_host) module.
|
|
28
|
-
-
|
|
29
|
-
-
|
|
28
|
+
- V(noop) (added in Ansible 2.0) This literally does 'nothing'. It is mainly used internally and not recommended for general use.
|
|
29
|
+
- V(clear_facts) (added in Ansible 2.1) causes the gathered facts for the hosts specified in the play's list of hosts to be cleared,
|
|
30
30
|
including the fact cache.
|
|
31
|
-
-
|
|
32
|
-
-
|
|
33
|
-
-
|
|
34
|
-
-
|
|
35
|
-
-
|
|
36
|
-
Note that with C(serial=0) or undefined this behaves the same as
|
|
31
|
+
- V(clear_host_errors) (added in Ansible 2.1) clears the failed state (if any) from hosts specified in the play's list of hosts.
|
|
32
|
+
- V(end_play) (added in Ansible 2.2) causes the play to end without failing the host(s). Note that this affects all hosts.
|
|
33
|
+
- V(reset_connection) (added in Ansible 2.3) interrupts a persistent connection (i.e. ssh + control persist)
|
|
34
|
+
- V(end_host) (added in Ansible 2.8) is a per-host variation of V(end_play). Causes the play to end for the current host without failing it.
|
|
35
|
+
- V(end_batch) (added in Ansible 2.12) causes the current batch (see C(serial)) to end without failing the host(s).
|
|
36
|
+
Note that with C(serial=0) or undefined this behaves the same as V(end_play).
|
|
37
37
|
choices: [ clear_facts, clear_host_errors, end_host, end_play, flush_handlers, noop, refresh_inventory, reset_connection, end_batch ]
|
|
38
38
|
required: true
|
|
39
39
|
extends_documentation_fragment:
|
|
@@ -61,12 +61,12 @@ attributes:
|
|
|
61
61
|
details: Only some options support conditionals and when they do they act 'bypassing the host loop', taking the values from first available host
|
|
62
62
|
support: partial
|
|
63
63
|
connection:
|
|
64
|
-
details: Most options in this action do not use a connection, except
|
|
64
|
+
details: Most options in this action do not use a connection, except V(reset_connection) which still does not connect to the remote
|
|
65
65
|
support: partial
|
|
66
66
|
notes:
|
|
67
|
-
-
|
|
67
|
+
- V(clear_facts) will remove the persistent facts from M(ansible.builtin.set_fact) using O(ansible.builtin.set_fact#module:cacheable=True),
|
|
68
68
|
but not the current host variable it creates for the current run.
|
|
69
|
-
- Skipping
|
|
69
|
+
- Skipping M(ansible.builtin.meta) tasks with tags is not supported before Ansible 2.11.
|
|
70
70
|
seealso:
|
|
71
71
|
- module: ansible.builtin.assert
|
|
72
72
|
- module: ansible.builtin.fail
|
ansible/modules/package.py
CHANGED
|
@@ -18,8 +18,8 @@ short_description: Generic OS package manager
|
|
|
18
18
|
description:
|
|
19
19
|
- This modules manages packages on a target without specifying a package manager module (like M(ansible.builtin.yum), M(ansible.builtin.apt), ...).
|
|
20
20
|
It is convenient to use in an heterogeneous environment of machines without having to create a specific task for
|
|
21
|
-
each package manager.
|
|
22
|
-
discovered by the module M(ansible.builtin.setup). If
|
|
21
|
+
each package manager. M(ansible.builtin.package) calls behind the module for the package manager used by the operating system
|
|
22
|
+
discovered by the module M(ansible.builtin.setup). If M(ansible.builtin.setup) was not yet run, M(ansible.builtin.package) will run it.
|
|
23
23
|
- This module acts as a proxy to the underlying package manager module. While all arguments will be passed to the
|
|
24
24
|
underlying module, not all modules support the same arguments. This documentation only covers the minimum intersection
|
|
25
25
|
of module arguments that all packaging modules support.
|
|
@@ -28,17 +28,17 @@ options:
|
|
|
28
28
|
name:
|
|
29
29
|
description:
|
|
30
30
|
- Package name, or package specifier with version.
|
|
31
|
-
- Syntax varies with package manager. For example
|
|
32
|
-
- Package names also vary with package manager; this module will not "translate" them per distro. For example
|
|
31
|
+
- Syntax varies with package manager. For example V(name-1.0) or V(name=1.0).
|
|
32
|
+
- Package names also vary with package manager; this module will not "translate" them per distro. For example V(libyaml-dev), V(libyaml-devel).
|
|
33
33
|
required: true
|
|
34
34
|
state:
|
|
35
35
|
description:
|
|
36
|
-
- Whether to install (
|
|
37
|
-
- You can use other states like
|
|
36
|
+
- Whether to install (V(present)), or remove (V(absent)) a package.
|
|
37
|
+
- You can use other states like V(latest) ONLY if they are supported by the underlying package module(s) executed.
|
|
38
38
|
required: true
|
|
39
39
|
use:
|
|
40
40
|
description:
|
|
41
|
-
- The required package manager module to use (
|
|
41
|
+
- The required package manager module to use (V(yum), V(apt), and so on). The default V(auto) will use existing facts or try to autodetect it.
|
|
42
42
|
- You should only use this field if the automatic selection is not working for some reason.
|
|
43
43
|
default: auto
|
|
44
44
|
requirements:
|
|
@@ -63,7 +63,7 @@ attributes:
|
|
|
63
63
|
details: The support depends on the availability for the specific plugin for each platform and if fact gathering is able to detect it
|
|
64
64
|
platforms: all
|
|
65
65
|
notes:
|
|
66
|
-
- While
|
|
66
|
+
- While M(ansible.builtin.package) abstracts package managers to ease dealing with multiple distributions, package name often differs for the same software.
|
|
67
67
|
|
|
68
68
|
'''
|
|
69
69
|
EXAMPLES = '''
|
ansible/modules/package_facts.py
CHANGED
|
@@ -27,8 +27,8 @@ options:
|
|
|
27
27
|
strategy:
|
|
28
28
|
description:
|
|
29
29
|
- This option controls how the module queries the package managers on the system.
|
|
30
|
-
|
|
31
|
-
|
|
30
|
+
V(first) means it will return only information for the first supported package manager available.
|
|
31
|
+
V(all) will return information for all supported and available package managers on the system.
|
|
32
32
|
choices: ['first', 'all']
|
|
33
33
|
default: 'first'
|
|
34
34
|
type: str
|
|
@@ -240,7 +240,7 @@ ansible_facts:
|
|
|
240
240
|
|
|
241
241
|
import re
|
|
242
242
|
|
|
243
|
-
from ansible.module_utils.
|
|
243
|
+
from ansible.module_utils.common.text.converters import to_native, to_text
|
|
244
244
|
from ansible.module_utils.basic import AnsibleModule, missing_required_lib
|
|
245
245
|
from ansible.module_utils.common.locale import get_best_parsable_locale
|
|
246
246
|
from ansible.module_utils.common.process import get_bin_path
|
ansible/modules/pause.py
CHANGED
|
@@ -30,11 +30,11 @@ options:
|
|
|
30
30
|
prompt:
|
|
31
31
|
description:
|
|
32
32
|
- Optional text to use for the prompt message.
|
|
33
|
-
- User input is only returned if
|
|
33
|
+
- User input is only returned if O(seconds=None) and O(minutes=None), otherwise this is just a custom message before playbook execution is paused.
|
|
34
34
|
echo:
|
|
35
35
|
description:
|
|
36
36
|
- Controls whether or not keyboard input is shown when typing.
|
|
37
|
-
- Only has effect if
|
|
37
|
+
- Only has effect if O(seconds=None) and O(minutes=None).
|
|
38
38
|
type: bool
|
|
39
39
|
default: 'yes'
|
|
40
40
|
version_added: 2.5
|
ansible/modules/ping.py
CHANGED
|
@@ -12,9 +12,9 @@ DOCUMENTATION = '''
|
|
|
12
12
|
---
|
|
13
13
|
module: ping
|
|
14
14
|
version_added: historical
|
|
15
|
-
short_description: Try to connect to host, verify a usable python and return
|
|
15
|
+
short_description: Try to connect to host, verify a usable python and return V(pong) on success
|
|
16
16
|
description:
|
|
17
|
-
- A trivial test module, this module always returns
|
|
17
|
+
- A trivial test module, this module always returns V(pong) on successful
|
|
18
18
|
contact. It does not make sense in playbooks, but it is useful from
|
|
19
19
|
C(/usr/bin/ansible) to verify the ability to login and that a usable Python is configured.
|
|
20
20
|
- This is NOT ICMP ping, this is just a trivial test module that requires Python on the remote-node.
|
|
@@ -23,8 +23,8 @@ description:
|
|
|
23
23
|
options:
|
|
24
24
|
data:
|
|
25
25
|
description:
|
|
26
|
-
- Data to return for the
|
|
27
|
-
- If this parameter is set to
|
|
26
|
+
- Data to return for the RV(ping) return value.
|
|
27
|
+
- If this parameter is set to V(crash), the module will cause an exception.
|
|
28
28
|
type: str
|
|
29
29
|
default: pong
|
|
30
30
|
extends_documentation_fragment:
|
|
@@ -58,7 +58,7 @@ EXAMPLES = '''
|
|
|
58
58
|
|
|
59
59
|
RETURN = '''
|
|
60
60
|
ping:
|
|
61
|
-
description: Value provided with the data parameter.
|
|
61
|
+
description: Value provided with the O(data) parameter.
|
|
62
62
|
returned: success
|
|
63
63
|
type: str
|
|
64
64
|
sample: pong
|
ansible/modules/pip.py
CHANGED
|
@@ -12,8 +12,8 @@ DOCUMENTATION = '''
|
|
|
12
12
|
module: pip
|
|
13
13
|
short_description: Manages Python library dependencies
|
|
14
14
|
description:
|
|
15
|
-
- "Manage Python library dependencies. To use this module, one of the following keys is required:
|
|
16
|
-
or
|
|
15
|
+
- "Manage Python library dependencies. To use this module, one of the following keys is required: O(name)
|
|
16
|
+
or O(requirements)."
|
|
17
17
|
version_added: "0.7"
|
|
18
18
|
options:
|
|
19
19
|
name:
|
|
@@ -24,7 +24,7 @@ options:
|
|
|
24
24
|
elements: str
|
|
25
25
|
version:
|
|
26
26
|
description:
|
|
27
|
-
- The version number to install of the Python library specified in the
|
|
27
|
+
- The version number to install of the Python library specified in the O(name) parameter.
|
|
28
28
|
type: str
|
|
29
29
|
requirements:
|
|
30
30
|
description:
|
|
@@ -53,17 +53,17 @@ options:
|
|
|
53
53
|
virtualenv_command:
|
|
54
54
|
description:
|
|
55
55
|
- The command or a pathname to the command to create the virtual
|
|
56
|
-
environment with. For example
|
|
57
|
-
|
|
56
|
+
environment with. For example V(pyvenv), V(virtualenv),
|
|
57
|
+
V(virtualenv2), V(~/bin/virtualenv), V(/usr/local/bin/virtualenv).
|
|
58
58
|
type: path
|
|
59
59
|
default: virtualenv
|
|
60
60
|
version_added: "1.1"
|
|
61
61
|
virtualenv_python:
|
|
62
62
|
description:
|
|
63
63
|
- The Python executable used for creating the virtual environment.
|
|
64
|
-
For example
|
|
64
|
+
For example V(python3.12), V(python2.7). When not specified, the
|
|
65
65
|
Python version used to run the ansible module is used. This parameter
|
|
66
|
-
should not be used when
|
|
66
|
+
should not be used when O(virtualenv_command) is using V(pyvenv) or
|
|
67
67
|
the C(-m venv) module.
|
|
68
68
|
type: str
|
|
69
69
|
version_added: "2.0"
|
|
@@ -94,9 +94,9 @@ options:
|
|
|
94
94
|
description:
|
|
95
95
|
- The explicit executable or pathname for the pip executable,
|
|
96
96
|
if different from the Ansible Python interpreter. For
|
|
97
|
-
example
|
|
97
|
+
example V(pip3.3), if there are both Python 2.7 and 3.3 installations
|
|
98
98
|
in the system and you want to run pip for the Python 3.3 installation.
|
|
99
|
-
- Mutually exclusive with
|
|
99
|
+
- Mutually exclusive with O(virtualenv) (added in 2.1).
|
|
100
100
|
- Does not affect the Ansible Python interpreter.
|
|
101
101
|
- The setuptools package must be installed for both the Ansible Python interpreter
|
|
102
102
|
and for the version of Python specified by this option.
|
|
@@ -125,16 +125,16 @@ notes:
|
|
|
125
125
|
installed on the remote host if the virtualenv parameter is specified and
|
|
126
126
|
the virtualenv needs to be created.
|
|
127
127
|
- Although it executes using the Ansible Python interpreter, the pip module shells out to
|
|
128
|
-
run the actual pip command, so it can use any pip version you specify with
|
|
128
|
+
run the actual pip command, so it can use any pip version you specify with O(executable).
|
|
129
129
|
By default, it uses the pip version for the Ansible Python interpreter. For example, pip3 on python 3, and pip2 or pip on python 2.
|
|
130
130
|
- The interpreter used by Ansible
|
|
131
131
|
(see R(ansible_python_interpreter, ansible_python_interpreter))
|
|
132
132
|
requires the setuptools package, regardless of the version of pip set with
|
|
133
|
-
the
|
|
133
|
+
the O(executable) option.
|
|
134
134
|
requirements:
|
|
135
135
|
- pip
|
|
136
136
|
- virtualenv
|
|
137
|
-
- setuptools
|
|
137
|
+
- setuptools or packaging
|
|
138
138
|
author:
|
|
139
139
|
- Matt Wright (@mattupstate)
|
|
140
140
|
'''
|
|
@@ -264,6 +264,7 @@ virtualenv:
|
|
|
264
264
|
sample: "/tmp/virtualenv"
|
|
265
265
|
'''
|
|
266
266
|
|
|
267
|
+
import argparse
|
|
267
268
|
import os
|
|
268
269
|
import re
|
|
269
270
|
import sys
|
|
@@ -274,16 +275,25 @@ import traceback
|
|
|
274
275
|
|
|
275
276
|
from ansible.module_utils.compat.version import LooseVersion
|
|
276
277
|
|
|
277
|
-
|
|
278
|
+
PACKAGING_IMP_ERR = None
|
|
279
|
+
HAS_PACKAGING = False
|
|
280
|
+
HAS_SETUPTOOLS = False
|
|
278
281
|
try:
|
|
279
|
-
from
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
282
|
+
from packaging.requirements import Requirement as parse_requirement
|
|
283
|
+
HAS_PACKAGING = True
|
|
284
|
+
except Exception:
|
|
285
|
+
# This is catching a generic Exception, due to packaging on EL7 raising a TypeError on import
|
|
286
|
+
HAS_PACKAGING = False
|
|
287
|
+
PACKAGING_IMP_ERR = traceback.format_exc()
|
|
288
|
+
try:
|
|
289
|
+
from pkg_resources import Requirement
|
|
290
|
+
parse_requirement = Requirement.parse # type: ignore[misc,assignment]
|
|
291
|
+
del Requirement
|
|
292
|
+
HAS_SETUPTOOLS = True
|
|
293
|
+
except ImportError:
|
|
294
|
+
pass
|
|
285
295
|
|
|
286
|
-
from ansible.module_utils.
|
|
296
|
+
from ansible.module_utils.common.text.converters import to_native
|
|
287
297
|
from ansible.module_utils.basic import AnsibleModule, is_executable, missing_required_lib
|
|
288
298
|
from ansible.module_utils.common.locale import get_best_parsable_locale
|
|
289
299
|
from ansible.module_utils.six import PY3
|
|
@@ -292,8 +302,16 @@ from ansible.module_utils.six import PY3
|
|
|
292
302
|
#: Python one-liners to be run at the command line that will determine the
|
|
293
303
|
# installed version for these special libraries. These are libraries that
|
|
294
304
|
# don't end up in the output of pip freeze.
|
|
295
|
-
_SPECIAL_PACKAGE_CHECKERS = {
|
|
296
|
-
|
|
305
|
+
_SPECIAL_PACKAGE_CHECKERS = {
|
|
306
|
+
'importlib': {
|
|
307
|
+
'setuptools': 'from importlib.metadata import version; print(version("setuptools"))',
|
|
308
|
+
'pip': 'from importlib.metadata import version; print(version("pip"))',
|
|
309
|
+
},
|
|
310
|
+
'pkg_resources': {
|
|
311
|
+
'setuptools': 'import setuptools; print(setuptools.__version__)',
|
|
312
|
+
'pip': 'import pkg_resources; print(pkg_resources.get_distribution("pip").version)',
|
|
313
|
+
}
|
|
314
|
+
}
|
|
297
315
|
|
|
298
316
|
_VCS_RE = re.compile(r'(svn|git|hg|bzr)\+')
|
|
299
317
|
|
|
@@ -306,6 +324,18 @@ def _is_vcs_url(name):
|
|
|
306
324
|
return re.match(_VCS_RE, name)
|
|
307
325
|
|
|
308
326
|
|
|
327
|
+
def _is_venv_command(command):
|
|
328
|
+
venv_parser = argparse.ArgumentParser()
|
|
329
|
+
venv_parser.add_argument('-m', type=str)
|
|
330
|
+
argv = shlex.split(command)
|
|
331
|
+
if argv[0] == 'pyvenv':
|
|
332
|
+
return True
|
|
333
|
+
args, dummy = venv_parser.parse_known_args(argv[1:])
|
|
334
|
+
if args.m == 'venv':
|
|
335
|
+
return True
|
|
336
|
+
return False
|
|
337
|
+
|
|
338
|
+
|
|
309
339
|
def _is_package_name(name):
|
|
310
340
|
"""Test whether the name is a package name or a version specifier."""
|
|
311
341
|
return not name.lstrip().startswith(tuple(op_dict.keys()))
|
|
@@ -490,7 +520,7 @@ def _fail(module, cmd, out, err):
|
|
|
490
520
|
module.fail_json(cmd=cmd, msg=msg)
|
|
491
521
|
|
|
492
522
|
|
|
493
|
-
def _get_package_info(module, package,
|
|
523
|
+
def _get_package_info(module, package, python_bin=None):
|
|
494
524
|
"""This is only needed for special packages which do not show up in pip freeze
|
|
495
525
|
|
|
496
526
|
pip and setuptools fall into this category.
|
|
@@ -498,20 +528,19 @@ def _get_package_info(module, package, env=None):
|
|
|
498
528
|
:returns: a string containing the version number if the package is
|
|
499
529
|
installed. None if the package is not installed.
|
|
500
530
|
"""
|
|
501
|
-
if env:
|
|
502
|
-
opt_dirs = ['%s/bin' % env]
|
|
503
|
-
else:
|
|
504
|
-
opt_dirs = []
|
|
505
|
-
python_bin = module.get_bin_path('python', False, opt_dirs)
|
|
506
|
-
|
|
507
531
|
if python_bin is None:
|
|
532
|
+
return
|
|
533
|
+
|
|
534
|
+
discovery_mechanism = 'pkg_resources'
|
|
535
|
+
importlib_rc = module.run_command([python_bin, '-c', 'import importlib.metadata'])[0]
|
|
536
|
+
if importlib_rc == 0:
|
|
537
|
+
discovery_mechanism = 'importlib'
|
|
538
|
+
|
|
539
|
+
rc, out, err = module.run_command([python_bin, '-c', _SPECIAL_PACKAGE_CHECKERS[discovery_mechanism][package]])
|
|
540
|
+
if rc:
|
|
508
541
|
formatted_dep = None
|
|
509
542
|
else:
|
|
510
|
-
|
|
511
|
-
if rc:
|
|
512
|
-
formatted_dep = None
|
|
513
|
-
else:
|
|
514
|
-
formatted_dep = '%s==%s' % (package, out.strip())
|
|
543
|
+
formatted_dep = '%s==%s' % (package, out.strip())
|
|
515
544
|
return formatted_dep
|
|
516
545
|
|
|
517
546
|
|
|
@@ -540,7 +569,7 @@ def setup_virtualenv(module, env, chdir, out, err):
|
|
|
540
569
|
virtualenv_python = module.params['virtualenv_python']
|
|
541
570
|
# -p is a virtualenv option, not compatible with pyenv or venv
|
|
542
571
|
# this conditional validates if the command being used is not any of them
|
|
543
|
-
if not
|
|
572
|
+
if not _is_venv_command(module.params['virtualenv_command']):
|
|
544
573
|
if virtualenv_python:
|
|
545
574
|
cmd.append('-p%s' % virtualenv_python)
|
|
546
575
|
elif PY3:
|
|
@@ -589,13 +618,15 @@ class Package:
|
|
|
589
618
|
separator = '==' if version_string[0].isdigit() else ' '
|
|
590
619
|
name_string = separator.join((name_string, version_string))
|
|
591
620
|
try:
|
|
592
|
-
self._requirement =
|
|
621
|
+
self._requirement = parse_requirement(name_string)
|
|
593
622
|
# old pkg_resource will replace 'setuptools' with 'distribute' when it's already installed
|
|
594
|
-
|
|
623
|
+
project_name = Package.canonicalize_name(
|
|
624
|
+
getattr(self._requirement, 'name', None) or getattr(self._requirement, 'project_name', None)
|
|
625
|
+
)
|
|
626
|
+
if project_name == "distribute" and "setuptools" in name_string:
|
|
595
627
|
self.package_name = "setuptools"
|
|
596
|
-
self._requirement.project_name = "setuptools"
|
|
597
628
|
else:
|
|
598
|
-
self.package_name =
|
|
629
|
+
self.package_name = project_name
|
|
599
630
|
self._plain_package = True
|
|
600
631
|
except ValueError as e:
|
|
601
632
|
pass
|
|
@@ -603,7 +634,7 @@ class Package:
|
|
|
603
634
|
@property
|
|
604
635
|
def has_version_specifier(self):
|
|
605
636
|
if self._plain_package:
|
|
606
|
-
return bool(self._requirement.specs)
|
|
637
|
+
return bool(getattr(self._requirement, 'specifier', None) or getattr(self._requirement, 'specs', None))
|
|
607
638
|
return False
|
|
608
639
|
|
|
609
640
|
def is_satisfied_by(self, version_to_test):
|
|
@@ -659,9 +690,9 @@ def main():
|
|
|
659
690
|
supports_check_mode=True,
|
|
660
691
|
)
|
|
661
692
|
|
|
662
|
-
if not HAS_SETUPTOOLS:
|
|
663
|
-
module.fail_json(msg=missing_required_lib("
|
|
664
|
-
exception=
|
|
693
|
+
if not HAS_SETUPTOOLS and not HAS_PACKAGING:
|
|
694
|
+
module.fail_json(msg=missing_required_lib("packaging"),
|
|
695
|
+
exception=PACKAGING_IMP_ERR)
|
|
665
696
|
|
|
666
697
|
state = module.params['state']
|
|
667
698
|
name = module.params['name']
|
|
@@ -701,6 +732,9 @@ def main():
|
|
|
701
732
|
if not os.path.exists(os.path.join(env, 'bin', 'activate')):
|
|
702
733
|
venv_created = True
|
|
703
734
|
out, err = setup_virtualenv(module, env, chdir, out, err)
|
|
735
|
+
py_bin = os.path.join(env, 'bin', 'python')
|
|
736
|
+
else:
|
|
737
|
+
py_bin = module.params['executable'] or sys.executable
|
|
704
738
|
|
|
705
739
|
pip = _get_pip(module, env, module.params['executable'])
|
|
706
740
|
|
|
@@ -783,7 +817,7 @@ def main():
|
|
|
783
817
|
# So we need to get those via a specialcase
|
|
784
818
|
for pkg in ('setuptools', 'pip'):
|
|
785
819
|
if pkg in name:
|
|
786
|
-
formatted_dep = _get_package_info(module, pkg,
|
|
820
|
+
formatted_dep = _get_package_info(module, pkg, py_bin)
|
|
787
821
|
if formatted_dep is not None:
|
|
788
822
|
pkg_list.append(formatted_dep)
|
|
789
823
|
out += '%s\n' % formatted_dep
|
|
@@ -797,7 +831,7 @@ def main():
|
|
|
797
831
|
|
|
798
832
|
out_freeze_before = None
|
|
799
833
|
if requirements or has_vcs:
|
|
800
|
-
|
|
834
|
+
dummy, out_freeze_before, dummy = _get_packages(module, pip, chdir)
|
|
801
835
|
|
|
802
836
|
rc, out_pip, err_pip = module.run_command(cmd, path_prefix=path_prefix, cwd=chdir)
|
|
803
837
|
out += out_pip
|
|
@@ -814,7 +848,7 @@ def main():
|
|
|
814
848
|
if out_freeze_before is None:
|
|
815
849
|
changed = 'Successfully installed' in out_pip
|
|
816
850
|
else:
|
|
817
|
-
|
|
851
|
+
dummy, out_freeze_after, dummy = _get_packages(module, pip, chdir)
|
|
818
852
|
changed = out_freeze_before != out_freeze_after
|
|
819
853
|
|
|
820
854
|
changed = changed or venv_created
|
ansible/modules/reboot.py
CHANGED
|
@@ -10,7 +10,7 @@ DOCUMENTATION = r'''
|
|
|
10
10
|
module: reboot
|
|
11
11
|
short_description: Reboot a machine
|
|
12
12
|
notes:
|
|
13
|
-
-
|
|
13
|
+
- E(PATH) is ignored on the remote node when searching for the C(shutdown) command. Use O(search_paths)
|
|
14
14
|
to specify locations to search if the default paths do not work.
|
|
15
15
|
description:
|
|
16
16
|
- Reboot a machine, wait for it to go down, come back up, and respond to commands.
|
|
@@ -57,7 +57,7 @@ options:
|
|
|
57
57
|
search_paths:
|
|
58
58
|
description:
|
|
59
59
|
- Paths to search on the remote machine for the C(shutdown) command.
|
|
60
|
-
- I(Only) these paths will be searched for the C(shutdown) command.
|
|
60
|
+
- I(Only) these paths will be searched for the C(shutdown) command. E(PATH) is ignored in the remote node when searching for the C(shutdown) command.
|
|
61
61
|
type: list
|
|
62
62
|
elements: str
|
|
63
63
|
default: ['/sbin', '/bin', '/usr/sbin', '/usr/bin', '/usr/local/sbin']
|
|
@@ -75,8 +75,8 @@ options:
|
|
|
75
75
|
description:
|
|
76
76
|
- Command to run that reboots the system, including any parameters passed to the command.
|
|
77
77
|
- Can be an absolute path to the command or just the command name. If an absolute path to the
|
|
78
|
-
command is not given,
|
|
79
|
-
- This will cause
|
|
78
|
+
command is not given, O(search_paths) on the target system will be searched to find the absolute path.
|
|
79
|
+
- This will cause O(pre_reboot_delay), O(post_reboot_delay), and O(msg) to be ignored.
|
|
80
80
|
type: str
|
|
81
81
|
default: '[determined based on target OS]'
|
|
82
82
|
version_added: '2.11'
|
|
@@ -121,6 +121,10 @@ EXAMPLES = r'''
|
|
|
121
121
|
reboot_command: launchctl reboot userspace
|
|
122
122
|
boot_time_command: uptime | cut -d ' ' -f 5
|
|
123
123
|
|
|
124
|
+
- name: Reboot machine and send a message
|
|
125
|
+
ansible.builtin.reboot:
|
|
126
|
+
msg: "Rebooting machine in 5 seconds"
|
|
127
|
+
|
|
124
128
|
'''
|
|
125
129
|
|
|
126
130
|
RETURN = r'''
|