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/user.py
CHANGED
|
@@ -28,11 +28,12 @@ options:
|
|
|
28
28
|
comment:
|
|
29
29
|
description:
|
|
30
30
|
- Optionally sets the description (aka I(GECOS)) of user account.
|
|
31
|
+
- On macOS, this defaults to the O(name) option.
|
|
31
32
|
type: str
|
|
32
33
|
hidden:
|
|
33
34
|
description:
|
|
34
35
|
- macOS only, optionally hide the user from the login window and system preferences.
|
|
35
|
-
- The default will be
|
|
36
|
+
- The default will be V(true) if the O(system) option is used.
|
|
36
37
|
type: bool
|
|
37
38
|
version_added: "2.6"
|
|
38
39
|
non_unique:
|
|
@@ -49,28 +50,29 @@ options:
|
|
|
49
50
|
group:
|
|
50
51
|
description:
|
|
51
52
|
- Optionally sets the user's primary group (takes a group name).
|
|
53
|
+
- On macOS, this defaults to V('staff')
|
|
52
54
|
type: str
|
|
53
55
|
groups:
|
|
54
56
|
description:
|
|
55
|
-
-
|
|
56
|
-
- By default, the user is removed from all other groups. Configure
|
|
57
|
-
- When set to an empty string
|
|
57
|
+
- A list of supplementary groups which the user is also a member of.
|
|
58
|
+
- By default, the user is removed from all other groups. Configure O(append) to modify this.
|
|
59
|
+
- When set to an empty string V(''),
|
|
58
60
|
the user is removed from all groups except the primary group.
|
|
59
61
|
- Before Ansible 2.3, the only input format allowed was a comma separated string.
|
|
60
62
|
type: list
|
|
61
63
|
elements: str
|
|
62
64
|
append:
|
|
63
65
|
description:
|
|
64
|
-
- If
|
|
65
|
-
- If
|
|
66
|
+
- If V(true), add the user to the groups specified in O(groups).
|
|
67
|
+
- If V(false), user will only be added to the groups specified in O(groups),
|
|
66
68
|
removing them from all other groups.
|
|
67
69
|
type: bool
|
|
68
70
|
default: no
|
|
69
71
|
shell:
|
|
70
72
|
description:
|
|
71
73
|
- Optionally set the user's shell.
|
|
72
|
-
- On macOS, before Ansible 2.5, the default shell for non-system users was
|
|
73
|
-
Since Ansible 2.5, the default shell for non-system users on macOS is
|
|
74
|
+
- On macOS, before Ansible 2.5, the default shell for non-system users was V(/usr/bin/false).
|
|
75
|
+
Since Ansible 2.5, the default shell for non-system users on macOS is V(/bin/bash).
|
|
74
76
|
- See notes for details on how other operating systems determine the default shell by
|
|
75
77
|
the underlying tool.
|
|
76
78
|
type: str
|
|
@@ -81,7 +83,7 @@ options:
|
|
|
81
83
|
skeleton:
|
|
82
84
|
description:
|
|
83
85
|
- Optionally set a home skeleton directory.
|
|
84
|
-
- Requires
|
|
86
|
+
- Requires O(create_home) option!
|
|
85
87
|
type: str
|
|
86
88
|
version_added: "2.0"
|
|
87
89
|
password:
|
|
@@ -90,9 +92,12 @@ options:
|
|
|
90
92
|
- B(Linux/Unix/POSIX:) Enter the hashed password as the value.
|
|
91
93
|
- See L(FAQ entry,https://docs.ansible.com/ansible/latest/reference_appendices/faq.html#how-do-i-generate-encrypted-passwords-for-the-user-module)
|
|
92
94
|
for details on various ways to generate the hash of a password.
|
|
93
|
-
- To create an account with a locked/disabled password on Linux systems, set this to
|
|
94
|
-
- To create an account with a locked/disabled password on OpenBSD, set this to
|
|
95
|
+
- To create an account with a locked/disabled password on Linux systems, set this to V('!') or V('*').
|
|
96
|
+
- To create an account with a locked/disabled password on OpenBSD, set this to V('*************').
|
|
95
97
|
- B(OS X/macOS:) Enter the cleartext password as the value. Be sure to take relevant security precautions.
|
|
98
|
+
- On macOS, the password specified in the C(password) option will always be set, regardless of whether the user account already exists or not.
|
|
99
|
+
- When the password is passed as an argument, the C(user) module will always return changed to C(true) for macOS systems.
|
|
100
|
+
Since macOS no longer provides access to the hashed passwords directly.
|
|
96
101
|
type: str
|
|
97
102
|
state:
|
|
98
103
|
description:
|
|
@@ -104,34 +109,34 @@ options:
|
|
|
104
109
|
default: present
|
|
105
110
|
create_home:
|
|
106
111
|
description:
|
|
107
|
-
- Unless set to
|
|
112
|
+
- Unless set to V(false), a home directory will be made for the user
|
|
108
113
|
when the account is created or if the home directory does not exist.
|
|
109
|
-
- Changed from
|
|
114
|
+
- Changed from O(createhome) to O(create_home) in Ansible 2.5.
|
|
110
115
|
type: bool
|
|
111
116
|
default: yes
|
|
112
117
|
aliases: [ createhome ]
|
|
113
118
|
move_home:
|
|
114
119
|
description:
|
|
115
|
-
- "If set to
|
|
120
|
+
- "If set to V(true) when used with O(home), attempt to move the user's old home
|
|
116
121
|
directory to the specified directory if it isn't there already and the old home exists."
|
|
117
122
|
type: bool
|
|
118
123
|
default: no
|
|
119
124
|
system:
|
|
120
125
|
description:
|
|
121
|
-
- When creating an account
|
|
126
|
+
- When creating an account O(state=present), setting this to V(true) makes the user a system account.
|
|
122
127
|
- This setting cannot be changed on existing users.
|
|
123
128
|
type: bool
|
|
124
129
|
default: no
|
|
125
130
|
force:
|
|
126
131
|
description:
|
|
127
|
-
- This only affects
|
|
132
|
+
- This only affects O(state=absent), it forces removal of the user and associated directories on supported platforms.
|
|
128
133
|
- The behavior is the same as C(userdel --force), check the man page for C(userdel) on your system for details and support.
|
|
129
|
-
- When used with
|
|
134
|
+
- When used with O(generate_ssh_key=yes) this forces an existing key to be overwritten.
|
|
130
135
|
type: bool
|
|
131
136
|
default: no
|
|
132
137
|
remove:
|
|
133
138
|
description:
|
|
134
|
-
- This only affects
|
|
139
|
+
- This only affects O(state=absent), it attempts to remove directories associated with the user.
|
|
135
140
|
- The behavior is the same as C(userdel --remove), check the man page for details and support.
|
|
136
141
|
type: bool
|
|
137
142
|
default: no
|
|
@@ -142,7 +147,7 @@ options:
|
|
|
142
147
|
generate_ssh_key:
|
|
143
148
|
description:
|
|
144
149
|
- Whether to generate a SSH key for the user in question.
|
|
145
|
-
- This will B(not) overwrite an existing SSH key unless used with
|
|
150
|
+
- This will B(not) overwrite an existing SSH key unless used with O(force=yes).
|
|
146
151
|
type: bool
|
|
147
152
|
default: no
|
|
148
153
|
version_added: "0.9"
|
|
@@ -164,7 +169,7 @@ options:
|
|
|
164
169
|
description:
|
|
165
170
|
- Optionally specify the SSH key filename.
|
|
166
171
|
- If this is a relative filename then it will be relative to the user's home directory.
|
|
167
|
-
- This parameter defaults to
|
|
172
|
+
- This parameter defaults to V(.ssh/id_rsa).
|
|
168
173
|
type: path
|
|
169
174
|
version_added: "0.9"
|
|
170
175
|
ssh_key_comment:
|
|
@@ -181,8 +186,8 @@ options:
|
|
|
181
186
|
version_added: "0.9"
|
|
182
187
|
update_password:
|
|
183
188
|
description:
|
|
184
|
-
-
|
|
185
|
-
-
|
|
189
|
+
- V(always) will update passwords if they differ.
|
|
190
|
+
- V(on_create) will only set the password for newly created users.
|
|
186
191
|
type: str
|
|
187
192
|
choices: [ always, on_create ]
|
|
188
193
|
default: always
|
|
@@ -200,7 +205,7 @@ options:
|
|
|
200
205
|
- Lock the password (C(usermod -L), C(usermod -U), C(pw lock)).
|
|
201
206
|
- Implementation differs by platform. This option does not always mean the user cannot login using other methods.
|
|
202
207
|
- This option does not disable the user, only lock the password.
|
|
203
|
-
- This must be set to
|
|
208
|
+
- This must be set to V(False) in order to unlock a currently locked password. The absence of this parameter will not unlock a password.
|
|
204
209
|
- Currently supported on Linux, FreeBSD, DragonFlyBSD, NetBSD, OpenBSD.
|
|
205
210
|
type: bool
|
|
206
211
|
version_added: "2.6"
|
|
@@ -218,28 +223,25 @@ options:
|
|
|
218
223
|
profile:
|
|
219
224
|
description:
|
|
220
225
|
- Sets the profile of the user.
|
|
221
|
-
- Does nothing when used with other platforms.
|
|
222
226
|
- Can set multiple profiles using comma separation.
|
|
223
|
-
- To delete all the profiles, use
|
|
224
|
-
- Currently supported on Illumos/Solaris.
|
|
227
|
+
- To delete all the profiles, use O(profile='').
|
|
228
|
+
- Currently supported on Illumos/Solaris. Does nothing when used with other platforms.
|
|
225
229
|
type: str
|
|
226
230
|
version_added: "2.8"
|
|
227
231
|
authorization:
|
|
228
232
|
description:
|
|
229
233
|
- Sets the authorization of the user.
|
|
230
|
-
- Does nothing when used with other platforms.
|
|
231
234
|
- Can set multiple authorizations using comma separation.
|
|
232
|
-
- To delete all authorizations, use
|
|
233
|
-
- Currently supported on Illumos/Solaris.
|
|
235
|
+
- To delete all authorizations, use O(authorization='').
|
|
236
|
+
- Currently supported on Illumos/Solaris. Does nothing when used with other platforms.
|
|
234
237
|
type: str
|
|
235
238
|
version_added: "2.8"
|
|
236
239
|
role:
|
|
237
240
|
description:
|
|
238
241
|
- Sets the role of the user.
|
|
239
|
-
- Does nothing when used with other platforms.
|
|
240
242
|
- Can set multiple roles using comma separation.
|
|
241
|
-
- To delete all roles, use
|
|
242
|
-
- Currently supported on Illumos/Solaris.
|
|
243
|
+
- To delete all roles, use O(role='').
|
|
244
|
+
- Currently supported on Illumos/Solaris. Does nothing when used with other platforms.
|
|
243
245
|
type: str
|
|
244
246
|
version_added: "2.8"
|
|
245
247
|
password_expire_max:
|
|
@@ -254,12 +256,17 @@ options:
|
|
|
254
256
|
- Supported on Linux only.
|
|
255
257
|
type: int
|
|
256
258
|
version_added: "2.11"
|
|
259
|
+
password_expire_warn:
|
|
260
|
+
description:
|
|
261
|
+
- Number of days of warning before password expires.
|
|
262
|
+
- Supported on Linux only.
|
|
263
|
+
type: int
|
|
264
|
+
version_added: "2.16"
|
|
257
265
|
umask:
|
|
258
266
|
description:
|
|
259
267
|
- Sets the umask of the user.
|
|
260
|
-
- Does nothing when used with other platforms.
|
|
261
|
-
-
|
|
262
|
-
- Requires C(local) is omitted or False.
|
|
268
|
+
- Currently supported on Linux. Does nothing when used with other platforms.
|
|
269
|
+
- Requires O(local) is omitted or V(False).
|
|
263
270
|
type: str
|
|
264
271
|
version_added: "2.12"
|
|
265
272
|
extends_documentation_fragment: action_common_attributes
|
|
@@ -340,12 +347,17 @@ EXAMPLES = r'''
|
|
|
340
347
|
ansible.builtin.user:
|
|
341
348
|
name: pushkar15
|
|
342
349
|
password_expire_min: 5
|
|
350
|
+
|
|
351
|
+
- name: Set number of warning days for password expiration
|
|
352
|
+
ansible.builtin.user:
|
|
353
|
+
name: jane157
|
|
354
|
+
password_expire_warn: 30
|
|
343
355
|
'''
|
|
344
356
|
|
|
345
357
|
RETURN = r'''
|
|
346
358
|
append:
|
|
347
359
|
description: Whether or not to append the user to groups.
|
|
348
|
-
returned: When state is
|
|
360
|
+
returned: When O(state) is V(present) and the user exists
|
|
349
361
|
type: bool
|
|
350
362
|
sample: True
|
|
351
363
|
comment:
|
|
@@ -360,7 +372,7 @@ create_home:
|
|
|
360
372
|
sample: True
|
|
361
373
|
force:
|
|
362
374
|
description: Whether or not a user account was forcibly deleted.
|
|
363
|
-
returned: When
|
|
375
|
+
returned: When O(state) is V(absent) and user exists
|
|
364
376
|
type: bool
|
|
365
377
|
sample: False
|
|
366
378
|
group:
|
|
@@ -370,17 +382,17 @@ group:
|
|
|
370
382
|
sample: 1001
|
|
371
383
|
groups:
|
|
372
384
|
description: List of groups of which the user is a member.
|
|
373
|
-
returned: When
|
|
385
|
+
returned: When O(groups) is not empty and O(state) is V(present)
|
|
374
386
|
type: str
|
|
375
387
|
sample: 'chrony,apache'
|
|
376
388
|
home:
|
|
377
389
|
description: "Path to user's home directory."
|
|
378
|
-
returned: When
|
|
390
|
+
returned: When O(state) is V(present)
|
|
379
391
|
type: str
|
|
380
392
|
sample: '/home/asmith'
|
|
381
393
|
move_home:
|
|
382
394
|
description: Whether or not to move an existing home directory.
|
|
383
|
-
returned: When
|
|
395
|
+
returned: When O(state) is V(present) and user exists
|
|
384
396
|
type: bool
|
|
385
397
|
sample: False
|
|
386
398
|
name:
|
|
@@ -390,32 +402,32 @@ name:
|
|
|
390
402
|
sample: asmith
|
|
391
403
|
password:
|
|
392
404
|
description: Masked value of the password.
|
|
393
|
-
returned: When
|
|
405
|
+
returned: When O(state) is V(present) and O(password) is not empty
|
|
394
406
|
type: str
|
|
395
407
|
sample: 'NOT_LOGGING_PASSWORD'
|
|
396
408
|
remove:
|
|
397
409
|
description: Whether or not to remove the user account.
|
|
398
|
-
returned: When
|
|
410
|
+
returned: When O(state) is V(absent) and user exists
|
|
399
411
|
type: bool
|
|
400
412
|
sample: True
|
|
401
413
|
shell:
|
|
402
414
|
description: User login shell.
|
|
403
|
-
returned: When
|
|
415
|
+
returned: When O(state) is V(present)
|
|
404
416
|
type: str
|
|
405
417
|
sample: '/bin/bash'
|
|
406
418
|
ssh_fingerprint:
|
|
407
419
|
description: Fingerprint of generated SSH key.
|
|
408
|
-
returned: When
|
|
420
|
+
returned: When O(generate_ssh_key) is V(True)
|
|
409
421
|
type: str
|
|
410
422
|
sample: '2048 SHA256:aYNHYcyVm87Igh0IMEDMbvW0QDlRQfE0aJugp684ko8 ansible-generated on host (RSA)'
|
|
411
423
|
ssh_key_file:
|
|
412
424
|
description: Path to generated SSH private key file.
|
|
413
|
-
returned: When
|
|
425
|
+
returned: When O(generate_ssh_key) is V(True)
|
|
414
426
|
type: str
|
|
415
427
|
sample: /home/asmith/.ssh/id_rsa
|
|
416
428
|
ssh_public_key:
|
|
417
429
|
description: Generated SSH public key file.
|
|
418
|
-
returned: When
|
|
430
|
+
returned: When O(generate_ssh_key) is V(True)
|
|
419
431
|
type: str
|
|
420
432
|
sample: >
|
|
421
433
|
'ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC95opt4SPEC06tOYsJQJIuN23BbLMGmYo8ysVZQc4h2DZE9ugbjWWGS1/pweUGjVstgzMkBEeBCByaEf/RJKNecKRPeGd2Bw9DCj/bn5Z6rGfNENKBmo
|
|
@@ -433,12 +445,12 @@ stdout:
|
|
|
433
445
|
sample:
|
|
434
446
|
system:
|
|
435
447
|
description: Whether or not the account is a system account.
|
|
436
|
-
returned: When
|
|
448
|
+
returned: When O(system) is passed to the module and the account does not exist
|
|
437
449
|
type: bool
|
|
438
450
|
sample: True
|
|
439
451
|
uid:
|
|
440
452
|
description: User ID of the user account.
|
|
441
|
-
returned: When
|
|
453
|
+
returned: When O(uid) is passed to the module
|
|
442
454
|
type: int
|
|
443
455
|
sample: 1044
|
|
444
456
|
'''
|
|
@@ -459,7 +471,7 @@ import time
|
|
|
459
471
|
import math
|
|
460
472
|
|
|
461
473
|
from ansible.module_utils import distro
|
|
462
|
-
from ansible.module_utils.
|
|
474
|
+
from ansible.module_utils.common.text.converters import to_bytes, to_native, to_text
|
|
463
475
|
from ansible.module_utils.basic import AnsibleModule
|
|
464
476
|
from ansible.module_utils.common.locale import get_best_parsable_locale
|
|
465
477
|
from ansible.module_utils.common.sys_info import get_platform_subclass
|
|
@@ -564,6 +576,7 @@ class User(object):
|
|
|
564
576
|
self.role = module.params['role']
|
|
565
577
|
self.password_expire_max = module.params['password_expire_max']
|
|
566
578
|
self.password_expire_min = module.params['password_expire_min']
|
|
579
|
+
self.password_expire_warn = module.params['password_expire_warn']
|
|
567
580
|
self.umask = module.params['umask']
|
|
568
581
|
|
|
569
582
|
if self.umask is not None and self.local:
|
|
@@ -903,7 +916,8 @@ class User(object):
|
|
|
903
916
|
|
|
904
917
|
if self.expires is not None:
|
|
905
918
|
|
|
906
|
-
current_expires =
|
|
919
|
+
current_expires = self.user_password()[1] or '0'
|
|
920
|
+
current_expires = int(current_expires)
|
|
907
921
|
|
|
908
922
|
if self.expires < time.gmtime(0):
|
|
909
923
|
if current_expires >= 0:
|
|
@@ -1080,6 +1094,7 @@ class User(object):
|
|
|
1080
1094
|
def set_password_expire(self):
|
|
1081
1095
|
min_needs_change = self.password_expire_min is not None
|
|
1082
1096
|
max_needs_change = self.password_expire_max is not None
|
|
1097
|
+
warn_needs_change = self.password_expire_warn is not None
|
|
1083
1098
|
|
|
1084
1099
|
if HAVE_SPWD:
|
|
1085
1100
|
try:
|
|
@@ -1089,8 +1104,9 @@ class User(object):
|
|
|
1089
1104
|
|
|
1090
1105
|
min_needs_change &= self.password_expire_min != shadow_info.sp_min
|
|
1091
1106
|
max_needs_change &= self.password_expire_max != shadow_info.sp_max
|
|
1107
|
+
warn_needs_change &= self.password_expire_warn != shadow_info.sp_warn
|
|
1092
1108
|
|
|
1093
|
-
if not (min_needs_change or max_needs_change):
|
|
1109
|
+
if not (min_needs_change or max_needs_change or warn_needs_change):
|
|
1094
1110
|
return (None, '', '') # target state already reached
|
|
1095
1111
|
|
|
1096
1112
|
command_name = 'chage'
|
|
@@ -1099,6 +1115,8 @@ class User(object):
|
|
|
1099
1115
|
cmd.extend(["-m", self.password_expire_min])
|
|
1100
1116
|
if max_needs_change:
|
|
1101
1117
|
cmd.extend(["-M", self.password_expire_max])
|
|
1118
|
+
if warn_needs_change:
|
|
1119
|
+
cmd.extend(["-W", self.password_expire_warn])
|
|
1102
1120
|
cmd.append(self.name)
|
|
1103
1121
|
|
|
1104
1122
|
return self.execute_command(cmd)
|
|
@@ -1273,7 +1291,7 @@ class User(object):
|
|
|
1273
1291
|
else:
|
|
1274
1292
|
skeleton = '/etc/skel'
|
|
1275
1293
|
|
|
1276
|
-
if os.path.exists(skeleton):
|
|
1294
|
+
if os.path.exists(skeleton) and skeleton != os.devnull:
|
|
1277
1295
|
try:
|
|
1278
1296
|
shutil.copytree(skeleton, path, symlinks=True)
|
|
1279
1297
|
except OSError as e:
|
|
@@ -1542,7 +1560,8 @@ class FreeBsdUser(User):
|
|
|
1542
1560
|
|
|
1543
1561
|
if self.expires is not None:
|
|
1544
1562
|
|
|
1545
|
-
current_expires =
|
|
1563
|
+
current_expires = self.user_password()[1] or '0'
|
|
1564
|
+
current_expires = int(current_expires)
|
|
1546
1565
|
|
|
1547
1566
|
# If expiration is negative or zero and the current expiration is greater than zero, disable expiration.
|
|
1548
1567
|
# In OpenBSD, setting expiration to zero disables expiration. It does not expire the account.
|
|
@@ -2494,6 +2513,14 @@ class DarwinUser(User):
|
|
|
2494
2513
|
if rc != 0:
|
|
2495
2514
|
self.module.fail_json(msg='Cannot create user "%s".' % self.name, err=err, out=out, rc=rc)
|
|
2496
2515
|
|
|
2516
|
+
# Make the Gecos (alias display name) default to username
|
|
2517
|
+
if self.comment is None:
|
|
2518
|
+
self.comment = self.name
|
|
2519
|
+
|
|
2520
|
+
# Make user group default to 'staff'
|
|
2521
|
+
if self.group is None:
|
|
2522
|
+
self.group = 'staff'
|
|
2523
|
+
|
|
2497
2524
|
self._make_group_numerical()
|
|
2498
2525
|
if self.uid is None:
|
|
2499
2526
|
self.uid = str(self._get_next_uid(self.system))
|
|
@@ -3092,6 +3119,7 @@ def main():
|
|
|
3092
3119
|
login_class=dict(type='str'),
|
|
3093
3120
|
password_expire_max=dict(type='int', no_log=False),
|
|
3094
3121
|
password_expire_min=dict(type='int', no_log=False),
|
|
3122
|
+
password_expire_warn=dict(type='int', no_log=False),
|
|
3095
3123
|
# following options are specific to macOS
|
|
3096
3124
|
hidden=dict(type='bool'),
|
|
3097
3125
|
# following options are specific to selinux
|
ansible/modules/wait_for.py
CHANGED
|
@@ -12,7 +12,7 @@ DOCUMENTATION = r'''
|
|
|
12
12
|
module: wait_for
|
|
13
13
|
short_description: Waits for a condition before continuing
|
|
14
14
|
description:
|
|
15
|
-
- You can wait for a set amount of time
|
|
15
|
+
- You can wait for a set amount of time O(timeout), this is the default if nothing is specified or just O(timeout) is specified.
|
|
16
16
|
This does not produce an error.
|
|
17
17
|
- Waiting for a port to become available is useful for when services are not immediately available after their init scripts return
|
|
18
18
|
which is true of certain Java application servers.
|
|
@@ -49,7 +49,7 @@ options:
|
|
|
49
49
|
port:
|
|
50
50
|
description:
|
|
51
51
|
- Port number to poll.
|
|
52
|
-
-
|
|
52
|
+
- O(path) and O(port) are mutually exclusive parameters.
|
|
53
53
|
type: int
|
|
54
54
|
active_connection_states:
|
|
55
55
|
description:
|
|
@@ -60,17 +60,17 @@ options:
|
|
|
60
60
|
version_added: "2.3"
|
|
61
61
|
state:
|
|
62
62
|
description:
|
|
63
|
-
- Either
|
|
64
|
-
- When checking a port
|
|
65
|
-
- When checking for a file or a search string
|
|
66
|
-
|
|
63
|
+
- Either V(present), V(started), or V(stopped), V(absent), or V(drained).
|
|
64
|
+
- When checking a port V(started) will ensure the port is open, V(stopped) will check that it is closed, V(drained) will check for active connections.
|
|
65
|
+
- When checking for a file or a search string V(present) or V(started) will ensure that the file or string is present before continuing,
|
|
66
|
+
V(absent) will check that file is absent or removed.
|
|
67
67
|
type: str
|
|
68
68
|
choices: [ absent, drained, present, started, stopped ]
|
|
69
69
|
default: started
|
|
70
70
|
path:
|
|
71
71
|
description:
|
|
72
72
|
- Path to a file on the filesystem that must exist before continuing.
|
|
73
|
-
-
|
|
73
|
+
- O(path) and O(port) are mutually exclusive parameters.
|
|
74
74
|
type: path
|
|
75
75
|
version_added: "1.4"
|
|
76
76
|
search_regex:
|
|
@@ -81,7 +81,7 @@ options:
|
|
|
81
81
|
version_added: "1.4"
|
|
82
82
|
exclude_hosts:
|
|
83
83
|
description:
|
|
84
|
-
- List of hosts or IPs to ignore when looking for active TCP connections for
|
|
84
|
+
- List of hosts or IPs to ignore when looking for active TCP connections for V(drained) state.
|
|
85
85
|
type: list
|
|
86
86
|
elements: str
|
|
87
87
|
version_added: "1.8"
|
|
@@ -238,7 +238,8 @@ import traceback
|
|
|
238
238
|
|
|
239
239
|
from ansible.module_utils.basic import AnsibleModule, missing_required_lib
|
|
240
240
|
from ansible.module_utils.common.sys_info import get_platform_subclass
|
|
241
|
-
from ansible.module_utils.
|
|
241
|
+
from ansible.module_utils.common.text.converters import to_bytes
|
|
242
|
+
from ansible.module_utils.compat.datetime import utcnow
|
|
242
243
|
|
|
243
244
|
|
|
244
245
|
HAS_PSUTIL = False
|
|
@@ -532,7 +533,7 @@ def main():
|
|
|
532
533
|
except Exception:
|
|
533
534
|
module.fail_json(msg="unknown active_connection_state (%s) defined" % _connection_state, elapsed=0)
|
|
534
535
|
|
|
535
|
-
start =
|
|
536
|
+
start = utcnow()
|
|
536
537
|
|
|
537
538
|
if delay:
|
|
538
539
|
time.sleep(delay)
|
|
@@ -543,7 +544,7 @@ def main():
|
|
|
543
544
|
# first wait for the stop condition
|
|
544
545
|
end = start + datetime.timedelta(seconds=timeout)
|
|
545
546
|
|
|
546
|
-
while
|
|
547
|
+
while utcnow() < end:
|
|
547
548
|
if path:
|
|
548
549
|
try:
|
|
549
550
|
if not os.access(b_path, os.F_OK):
|
|
@@ -560,7 +561,7 @@ def main():
|
|
|
560
561
|
# Conditions not yet met, wait and try again
|
|
561
562
|
time.sleep(module.params['sleep'])
|
|
562
563
|
else:
|
|
563
|
-
elapsed =
|
|
564
|
+
elapsed = utcnow() - start
|
|
564
565
|
if port:
|
|
565
566
|
module.fail_json(msg=msg or "Timeout when waiting for %s:%s to stop." % (host, port), elapsed=elapsed.seconds)
|
|
566
567
|
elif path:
|
|
@@ -569,14 +570,14 @@ def main():
|
|
|
569
570
|
elif state in ['started', 'present']:
|
|
570
571
|
# wait for start condition
|
|
571
572
|
end = start + datetime.timedelta(seconds=timeout)
|
|
572
|
-
while
|
|
573
|
+
while utcnow() < end:
|
|
573
574
|
if path:
|
|
574
575
|
try:
|
|
575
576
|
os.stat(b_path)
|
|
576
577
|
except OSError as e:
|
|
577
578
|
# If anything except file not present, throw an error
|
|
578
579
|
if e.errno != 2:
|
|
579
|
-
elapsed =
|
|
580
|
+
elapsed = utcnow() - start
|
|
580
581
|
module.fail_json(msg=msg or "Failed to stat %s, %s" % (path, e.strerror), elapsed=elapsed.seconds)
|
|
581
582
|
# file doesn't exist yet, so continue
|
|
582
583
|
else:
|
|
@@ -598,7 +599,7 @@ def main():
|
|
|
598
599
|
except IOError:
|
|
599
600
|
pass
|
|
600
601
|
elif port:
|
|
601
|
-
alt_connect_timeout = math.ceil(_timedelta_total_seconds(end -
|
|
602
|
+
alt_connect_timeout = math.ceil(_timedelta_total_seconds(end - utcnow()))
|
|
602
603
|
try:
|
|
603
604
|
s = socket.create_connection((host, port), min(connect_timeout, alt_connect_timeout))
|
|
604
605
|
except Exception:
|
|
@@ -609,8 +610,8 @@ def main():
|
|
|
609
610
|
if b_compiled_search_re:
|
|
610
611
|
b_data = b''
|
|
611
612
|
matched = False
|
|
612
|
-
while
|
|
613
|
-
max_timeout = math.ceil(_timedelta_total_seconds(end -
|
|
613
|
+
while utcnow() < end:
|
|
614
|
+
max_timeout = math.ceil(_timedelta_total_seconds(end - utcnow()))
|
|
614
615
|
readable = select.select([s], [], [], max_timeout)[0]
|
|
615
616
|
if not readable:
|
|
616
617
|
# No new data. Probably means our timeout
|
|
@@ -654,7 +655,7 @@ def main():
|
|
|
654
655
|
|
|
655
656
|
else: # while-else
|
|
656
657
|
# Timeout expired
|
|
657
|
-
elapsed =
|
|
658
|
+
elapsed = utcnow() - start
|
|
658
659
|
if port:
|
|
659
660
|
if search_regex:
|
|
660
661
|
module.fail_json(msg=msg or "Timeout when waiting for search string %s in %s:%s" % (search_regex, host, port), elapsed=elapsed.seconds)
|
|
@@ -670,17 +671,17 @@ def main():
|
|
|
670
671
|
# wait until all active connections are gone
|
|
671
672
|
end = start + datetime.timedelta(seconds=timeout)
|
|
672
673
|
tcpconns = TCPConnectionInfo(module)
|
|
673
|
-
while
|
|
674
|
+
while utcnow() < end:
|
|
674
675
|
if tcpconns.get_active_connections_count() == 0:
|
|
675
676
|
break
|
|
676
677
|
|
|
677
678
|
# Conditions not yet met, wait and try again
|
|
678
679
|
time.sleep(module.params['sleep'])
|
|
679
680
|
else:
|
|
680
|
-
elapsed =
|
|
681
|
+
elapsed = utcnow() - start
|
|
681
682
|
module.fail_json(msg=msg or "Timeout when waiting for %s:%s to drain" % (host, port), elapsed=elapsed.seconds)
|
|
682
683
|
|
|
683
|
-
elapsed =
|
|
684
|
+
elapsed = utcnow() - start
|
|
684
685
|
module.exit_json(state=state, port=port, search_regex=search_regex, match_groups=match_groups, match_groupdict=match_groupdict, path=path,
|
|
685
686
|
elapsed=elapsed.seconds)
|
|
686
687
|
|
|
@@ -12,9 +12,9 @@ DOCUMENTATION = r'''
|
|
|
12
12
|
module: wait_for_connection
|
|
13
13
|
short_description: Waits until remote system is reachable/usable
|
|
14
14
|
description:
|
|
15
|
-
- Waits for a total of
|
|
16
|
-
- Retries the transport connection after a timeout of
|
|
17
|
-
- Tests the transport connection every
|
|
15
|
+
- Waits for a total of O(timeout) seconds.
|
|
16
|
+
- Retries the transport connection after a timeout of O(connect_timeout).
|
|
17
|
+
- Tests the transport connection every O(sleep) seconds.
|
|
18
18
|
- This module makes use of internal ansible transport (and configuration) and the ping/win_ping module to guarantee correct end-to-end functioning.
|
|
19
19
|
- This module is also supported for Windows targets.
|
|
20
20
|
version_added: '2.3'
|
|
@@ -101,7 +101,7 @@ EXAMPLES = r'''
|
|
|
101
101
|
customization:
|
|
102
102
|
hostname: '{{ vm_shortname }}'
|
|
103
103
|
runonce:
|
|
104
|
-
-
|
|
104
|
+
- cmd.exe /c winrm.cmd quickconfig -quiet -force
|
|
105
105
|
delegate_to: localhost
|
|
106
106
|
|
|
107
107
|
- name: Wait for system to become reachable over WinRM
|