ansible-core 2.17.6__py3-none-any.whl → 2.18.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of ansible-core might be problematic. Click here for more details.
- ansible/__main__.py +2 -17
- ansible/cli/__init__.py +3 -15
- ansible/cli/config.py +187 -24
- ansible/cli/console.py +1 -1
- ansible/cli/doc.py +38 -16
- ansible/cli/galaxy.py +3 -49
- ansible/cli/inventory.py +2 -2
- ansible/cli/pull.py +2 -2
- ansible/cli/scripts/ansible_connection_cli_stub.py +1 -10
- ansible/config/base.yml +127 -57
- ansible/config/manager.py +89 -11
- ansible/constants.py +32 -9
- ansible/errors/__init__.py +5 -0
- ansible/executor/interpreter_discovery.py +1 -1
- ansible/executor/play_iterator.py +16 -0
- ansible/executor/playbook_executor.py +1 -4
- ansible/executor/powershell/become_wrapper.ps1 +4 -5
- ansible/executor/powershell/bootstrap_wrapper.ps1 +2 -3
- ansible/executor/powershell/exec_wrapper.ps1 +1 -1
- ansible/executor/powershell/module_manifest.py +2 -2
- ansible/executor/task_executor.py +50 -39
- ansible/executor/task_queue_manager.py +1 -1
- ansible/executor/task_result.py +1 -1
- ansible/galaxy/api.py +3 -4
- ansible/galaxy/collection/__init__.py +21 -10
- ansible/galaxy/collection/concrete_artifact_manager.py +2 -2
- ansible/galaxy/collection/galaxy_api_proxy.py +10 -16
- ansible/galaxy/collection/gpg.py +17 -23
- ansible/galaxy/data/COPYING +7 -0
- ansible/galaxy/data/apb/Dockerfile.j2 +1 -0
- ansible/galaxy/data/apb/Makefile.j2 +1 -0
- ansible/galaxy/data/apb/README.md +7 -3
- ansible/galaxy/data/apb/apb.yml.j2 +1 -0
- ansible/galaxy/data/apb/defaults/main.yml.j2 +1 -0
- ansible/galaxy/data/apb/handlers/main.yml.j2 +1 -0
- ansible/galaxy/data/apb/meta/main.yml.j2 +1 -0
- ansible/galaxy/data/apb/playbooks/deprovision.yml.j2 +1 -0
- ansible/galaxy/data/apb/playbooks/provision.yml.j2 +1 -0
- ansible/galaxy/data/apb/tasks/main.yml.j2 +1 -0
- ansible/galaxy/data/apb/tests/ansible.cfg +1 -0
- ansible/galaxy/data/apb/tests/inventory +1 -0
- ansible/galaxy/data/apb/tests/test.yml.j2 +1 -0
- ansible/galaxy/data/apb/vars/main.yml.j2 +1 -0
- ansible/galaxy/data/collections_galaxy_meta.yml +1 -0
- ansible/galaxy/data/container/defaults/main.yml.j2 +1 -0
- ansible/galaxy/data/container/handlers/main.yml.j2 +1 -0
- ansible/galaxy/data/container/meta/container.yml.j2 +1 -0
- ansible/galaxy/data/container/meta/main.yml.j2 +1 -0
- ansible/galaxy/data/container/tasks/main.yml.j2 +1 -0
- ansible/galaxy/data/container/tests/ansible.cfg +1 -0
- ansible/galaxy/data/container/tests/inventory +1 -0
- ansible/galaxy/data/container/tests/test.yml.j2 +1 -0
- ansible/galaxy/data/container/vars/main.yml.j2 +1 -0
- ansible/galaxy/data/default/collection/README.md.j2 +1 -0
- ansible/galaxy/data/default/collection/galaxy.yml.j2 +1 -0
- ansible/galaxy/data/default/collection/meta/runtime.yml +1 -0
- ansible/galaxy/data/default/collection/plugins/README.md.j2 +1 -0
- ansible/galaxy/data/default/role/defaults/main.yml.j2 +1 -0
- ansible/galaxy/data/default/role/handlers/main.yml.j2 +1 -0
- ansible/galaxy/data/default/role/meta/main.yml.j2 +1 -0
- ansible/galaxy/data/default/role/tasks/main.yml.j2 +1 -0
- ansible/galaxy/data/default/role/tests/inventory +1 -0
- ansible/galaxy/data/default/role/tests/test.yml.j2 +1 -0
- ansible/galaxy/data/default/role/vars/main.yml.j2 +1 -0
- ansible/galaxy/data/network/cliconf_plugins/example.py.j2 +1 -0
- ansible/galaxy/data/network/defaults/main.yml.j2 +1 -0
- ansible/galaxy/data/network/library/example_command.py.j2 +1 -0
- ansible/galaxy/data/network/library/example_config.py.j2 +1 -0
- ansible/galaxy/data/network/library/example_facts.py.j2 +1 -0
- ansible/galaxy/data/network/meta/main.yml.j2 +1 -0
- ansible/galaxy/data/network/module_utils/example.py.j2 +1 -0
- ansible/galaxy/data/network/netconf_plugins/example.py.j2 +1 -0
- ansible/galaxy/data/network/tasks/main.yml.j2 +1 -0
- ansible/galaxy/data/network/terminal_plugins/example.py.j2 +1 -0
- ansible/galaxy/data/network/tests/inventory +1 -0
- ansible/galaxy/data/network/tests/test.yml.j2 +1 -0
- ansible/galaxy/data/network/vars/main.yml.j2 +1 -0
- ansible/galaxy/dependency_resolution/providers.py +3 -3
- ansible/galaxy/role.py +1 -1
- ansible/galaxy/token.py +20 -8
- ansible/keyword_desc.yml +1 -1
- ansible/module_utils/_internal/__init__.py +0 -0
- ansible/module_utils/_internal/_concurrent/__init__.py +0 -0
- ansible/module_utils/_internal/_concurrent/_daemon_threading.py +28 -0
- ansible/module_utils/_internal/_concurrent/_futures.py +21 -0
- ansible/module_utils/ansible_release.py +2 -2
- ansible/module_utils/api.py +2 -2
- ansible/module_utils/basic.py +8 -8
- ansible/module_utils/common/collections.py +1 -1
- ansible/module_utils/common/file.py +0 -6
- ansible/module_utils/common/process.py +22 -9
- ansible/module_utils/common/text/converters.py +5 -8
- ansible/module_utils/common/text/formatters.py +20 -4
- ansible/module_utils/common/validation.py +33 -25
- ansible/module_utils/compat/paramiko.py +6 -1
- ansible/module_utils/compat/selinux.py +2 -2
- ansible/module_utils/connection.py +8 -24
- ansible/module_utils/csharp/Ansible.Become.cs +14 -25
- ansible/module_utils/csharp/Ansible.Process.cs +1 -1
- ansible/module_utils/distro/__init__.py +1 -1
- ansible/module_utils/distro/_distro.py +8 -4
- ansible/module_utils/facts/collector.py +2 -0
- ansible/module_utils/facts/default_collectors.py +3 -1
- ansible/module_utils/facts/hardware/aix.py +54 -52
- ansible/module_utils/facts/hardware/darwin.py +37 -34
- ansible/module_utils/facts/hardware/freebsd.py +55 -15
- ansible/module_utils/facts/hardware/hpux.py +3 -0
- ansible/module_utils/facts/hardware/linux.py +101 -57
- ansible/module_utils/facts/hardware/netbsd.py +3 -0
- ansible/module_utils/facts/hardware/openbsd.py +4 -1
- ansible/module_utils/facts/hardware/sunos.py +7 -1
- ansible/module_utils/facts/network/aix.py +16 -17
- ansible/module_utils/facts/network/fc_wwn.py +4 -1
- ansible/module_utils/facts/network/hpux.py +21 -4
- ansible/module_utils/facts/network/iscsi.py +7 -8
- ansible/module_utils/facts/network/linux.py +0 -2
- ansible/module_utils/facts/other/facter.py +9 -4
- ansible/module_utils/facts/other/ohai.py +5 -5
- ansible/module_utils/facts/packages.py +49 -7
- ansible/module_utils/facts/sysctl.py +33 -31
- ansible/module_utils/facts/system/distribution.py +1 -1
- ansible/module_utils/facts/system/local.py +12 -22
- ansible/module_utils/facts/system/service_mgr.py +3 -1
- ansible/module_utils/facts/system/systemd.py +47 -0
- ansible/module_utils/powershell/Ansible.ModuleUtils.AddType.psm1 +1 -1
- ansible/module_utils/powershell/Ansible.ModuleUtils.CamelConversion.psm1 +1 -1
- ansible/module_utils/splitter.py +1 -1
- ansible/modules/add_host.py +1 -1
- ansible/modules/apt.py +43 -32
- ansible/modules/apt_key.py +6 -6
- ansible/modules/apt_repository.py +23 -14
- ansible/modules/assemble.py +7 -2
- ansible/modules/assert.py +4 -4
- ansible/modules/blockinfile.py +3 -6
- ansible/modules/command.py +1 -1
- ansible/modules/copy.py +4 -4
- ansible/modules/cron.py +13 -10
- ansible/modules/deb822_repository.py +16 -17
- ansible/modules/debconf.py +9 -9
- ansible/modules/debug.py +1 -1
- ansible/modules/dnf.py +79 -164
- ansible/modules/dnf5.py +54 -29
- ansible/modules/dpkg_selections.py +2 -2
- ansible/modules/expect.py +2 -2
- ansible/modules/fetch.py +2 -2
- ansible/modules/file.py +5 -3
- ansible/modules/find.py +40 -12
- ansible/modules/gather_facts.py +4 -2
- ansible/modules/get_url.py +29 -24
- ansible/modules/git.py +35 -35
- ansible/modules/group.py +71 -1
- ansible/modules/hostname.py +2 -4
- ansible/modules/include_vars.py +5 -5
- ansible/modules/iptables.py +13 -16
- ansible/modules/known_hosts.py +16 -13
- ansible/modules/lineinfile.py +1 -4
- ansible/modules/meta.py +6 -1
- ansible/modules/mount_facts.py +651 -0
- ansible/modules/package_facts.py +63 -80
- ansible/modules/pause.py +4 -3
- ansible/modules/pip.py +14 -14
- ansible/modules/replace.py +1 -4
- ansible/modules/rpm_key.py +31 -11
- ansible/modules/service.py +8 -8
- ansible/modules/service_facts.py +20 -5
- ansible/modules/set_stats.py +1 -1
- ansible/modules/setup.py +3 -3
- ansible/modules/stat.py +3 -3
- ansible/modules/subversion.py +1 -1
- ansible/modules/systemd.py +16 -10
- ansible/modules/systemd_service.py +16 -10
- ansible/modules/sysvinit.py +4 -4
- ansible/modules/unarchive.py +35 -22
- ansible/modules/uri.py +24 -18
- ansible/modules/user.py +145 -12
- ansible/modules/validate_argument_spec.py +3 -3
- ansible/modules/wait_for_connection.py +2 -1
- ansible/modules/yum_repository.py +136 -179
- ansible/parsing/dataloader.py +2 -2
- ansible/parsing/mod_args.py +11 -10
- ansible/parsing/vault/__init__.py +8 -3
- ansible/parsing/yaml/constructor.py +10 -8
- ansible/parsing/yaml/objects.py +1 -1
- ansible/playbook/base.py +12 -23
- ansible/playbook/helpers.py +4 -0
- ansible/playbook/loop_control.py +8 -0
- ansible/playbook/play.py +4 -22
- ansible/playbook/play_context.py +0 -16
- ansible/playbook/playbook_include.py +2 -2
- ansible/playbook/role/__init__.py +2 -2
- ansible/plugins/__init__.py +2 -0
- ansible/plugins/action/__init__.py +7 -9
- ansible/plugins/action/dnf.py +7 -5
- ansible/plugins/action/package.py +5 -4
- ansible/plugins/action/reboot.py +2 -2
- ansible/plugins/become/__init__.py +1 -1
- ansible/plugins/callback/__init__.py +44 -3
- ansible/plugins/callback/default.py +1 -1
- ansible/plugins/cliconf/__init__.py +1 -1
- ansible/plugins/connection/paramiko_ssh.py +2 -80
- ansible/plugins/connection/psrp.py +33 -82
- ansible/plugins/connection/ssh.py +0 -8
- ansible/plugins/connection/winrm.py +46 -1
- ansible/plugins/doc_fragments/connection_pipelining.py +2 -2
- ansible/plugins/doc_fragments/constructed.py +10 -10
- ansible/plugins/doc_fragments/default_callback.py +8 -8
- ansible/plugins/doc_fragments/files.py +5 -5
- ansible/plugins/doc_fragments/inventory_cache.py +2 -2
- ansible/plugins/doc_fragments/result_format_callback.py +6 -6
- ansible/plugins/doc_fragments/return_common.py +1 -1
- ansible/plugins/doc_fragments/shell_common.py +2 -10
- ansible/plugins/doc_fragments/shell_windows.py +0 -9
- ansible/plugins/doc_fragments/url.py +2 -2
- ansible/plugins/doc_fragments/url_windows.py +4 -5
- ansible/plugins/doc_fragments/validate.py +1 -1
- ansible/plugins/filter/core.py +2 -0
- ansible/plugins/filter/human_to_bytes.yml +9 -0
- ansible/plugins/filter/password_hash.yml +1 -1
- ansible/plugins/filter/strftime.yml +1 -1
- ansible/plugins/filter/to_nice_json.yml +7 -3
- ansible/plugins/filter/to_uuid.yml +1 -1
- ansible/plugins/inventory/script.py +1 -1
- ansible/plugins/list.py +1 -1
- ansible/plugins/loader.py +0 -11
- ansible/plugins/lookup/config.py +1 -1
- ansible/plugins/lookup/csvfile.py +21 -9
- ansible/plugins/lookup/env.py +8 -9
- ansible/plugins/lookup/ini.py +10 -1
- ansible/plugins/lookup/random_choice.py +2 -2
- ansible/plugins/lookup/url.py +7 -2
- ansible/plugins/shell/__init__.py +15 -20
- ansible/plugins/shell/powershell.py +9 -6
- ansible/plugins/strategy/__init__.py +16 -7
- ansible/plugins/test/core.py +23 -1
- ansible/plugins/test/issubset.yml +1 -1
- ansible/plugins/test/subset.yml +1 -1
- ansible/plugins/test/timedout.yml +20 -0
- ansible/plugins/test/vault_encrypted.yml +6 -6
- ansible/plugins/test/vaulted_file.yml +19 -0
- ansible/release.py +2 -2
- ansible/template/__init__.py +3 -8
- ansible/utils/collection_loader/_collection_finder.py +23 -55
- ansible/utils/display.py +44 -31
- ansible/utils/jsonrpc.py +1 -1
- ansible/utils/listify.py +1 -5
- ansible/utils/path.py +3 -0
- ansible/utils/vars.py +18 -27
- ansible/vars/manager.py +7 -150
- ansible/vars/plugins.py +1 -1
- ansible_core-2.18.0.dist-info/Apache-License.txt +202 -0
- {ansible_core-2.17.6.dist-info → ansible_core-2.18.0.dist-info}/METADATA +36 -23
- ansible_core-2.18.0.dist-info/MIT-license.txt +14 -0
- ansible_core-2.18.0.dist-info/PSF-license.txt +48 -0
- {ansible_core-2.17.6.dist-info → ansible_core-2.18.0.dist-info}/RECORD +316 -311
- {ansible_core-2.17.6.dist-info → ansible_core-2.18.0.dist-info}/entry_points.txt +1 -1
- ansible_core-2.18.0.dist-info/simplified_bsd.txt +8 -0
- ansible_test/_data/completion/docker.txt +7 -7
- ansible_test/_data/completion/remote.txt +5 -4
- ansible_test/_data/completion/windows.txt +4 -4
- ansible_test/_data/requirements/ansible-test.txt +1 -2
- ansible_test/_data/requirements/constraints.txt +1 -2
- ansible_test/_data/requirements/sanity.ansible-doc.txt +3 -3
- ansible_test/_data/requirements/sanity.changelog.in +1 -1
- ansible_test/_data/requirements/sanity.changelog.txt +4 -4
- ansible_test/_data/requirements/sanity.import.plugin.txt +2 -2
- ansible_test/_data/requirements/sanity.import.txt +1 -1
- ansible_test/_data/requirements/sanity.integration-aliases.txt +1 -1
- ansible_test/_data/requirements/sanity.pep8.txt +1 -1
- ansible_test/_data/requirements/sanity.pylint.txt +6 -8
- ansible_test/_data/requirements/sanity.runtime-metadata.txt +2 -2
- ansible_test/_data/requirements/sanity.validate-modules.txt +3 -3
- ansible_test/_data/requirements/sanity.yamllint.in +1 -0
- ansible_test/_data/requirements/sanity.yamllint.txt +1 -1
- ansible_test/_internal/ansible_util.py +8 -35
- ansible_test/_internal/ci/azp.py +1 -1
- ansible_test/_internal/classification/__init__.py +0 -2
- ansible_test/_internal/cli/parsers/key_value_parsers.py +3 -0
- ansible_test/_internal/commands/integration/cloud/hcloud.py +1 -1
- ansible_test/_internal/commands/integration/cloud/httptester.py +1 -1
- ansible_test/_internal/commands/integration/cloud/nios.py +1 -1
- ansible_test/_internal/commands/sanity/__init__.py +96 -19
- ansible_test/_internal/commands/sanity/pylint.py +20 -24
- ansible_test/_internal/completion.py +2 -0
- ansible_test/_internal/constants.py +0 -1
- ansible_test/_internal/coverage_util.py +1 -2
- ansible_test/_internal/docker_util.py +1 -1
- ansible_test/_internal/encoding.py +4 -4
- ansible_test/_internal/host_configs.py +10 -0
- ansible_test/_internal/host_profiles.py +9 -13
- ansible_test/_internal/pypi_proxy.py +1 -1
- ansible_test/_internal/python_requirements.py +5 -14
- ansible_test/_internal/timeout.py +1 -1
- ansible_test/_internal/util.py +40 -0
- ansible_test/_internal/util_common.py +5 -1
- ansible_test/_util/controller/sanity/code-smell/action-plugin-docs.json +3 -1
- ansible_test/_util/controller/sanity/code-smell/action-plugin-docs.py +6 -3
- ansible_test/_util/controller/sanity/code-smell/empty-init.json +0 -2
- ansible_test/_util/controller/sanity/pylint/config/ansible-test-target.cfg +5 -0
- ansible_test/_util/controller/sanity/pylint/config/ansible-test.cfg +5 -0
- ansible_test/_util/controller/sanity/pylint/config/code-smell.cfg +5 -0
- ansible_test/_util/controller/sanity/pylint/config/collection.cfg +6 -0
- ansible_test/_util/controller/sanity/pylint/config/default.cfg +6 -0
- ansible_test/_util/controller/sanity/pylint/plugins/deprecated.py +1 -19
- ansible_test/_util/controller/sanity/shellcheck/exclude.txt +1 -0
- ansible_test/_util/controller/sanity/validate-modules/validate_modules/main.py +67 -2
- ansible_test/_util/controller/sanity/validate-modules/validate_modules/schema.py +27 -5
- ansible_test/_util/target/cli/ansible_test_cli_stub.py +0 -0
- ansible_test/_util/target/common/constants.py +2 -2
- ansible_test/_util/target/injector/python.py +5 -0
- ansible_test/_util/target/pytest/plugins/ansible_pytest_coverage.py +6 -0
- ansible_test/_util/target/sanity/import/importer.py +1 -1
- ansible_test/_util/target/setup/bootstrap.sh +6 -17
- ansible_test/_util/target/setup/requirements.py +18 -24
- ansible_test/config/config.yml +1 -1
- ansible_core-2.17.6.data/scripts/ansible-test +0 -44
- ansible_test/_data/requirements/sanity.mypy.in +0 -10
- ansible_test/_data/requirements/sanity.mypy.txt +0 -18
- ansible_test/_internal/commands/sanity/mypy.py +0 -274
- ansible_test/_util/controller/sanity/mypy/ansible-core.ini +0 -116
- ansible_test/_util/controller/sanity/mypy/ansible-test.ini +0 -27
- ansible_test/_util/controller/sanity/mypy/modules.ini +0 -92
- ansible_test/_util/controller/sanity/mypy/packaging.ini +0 -20
- {ansible_core-2.17.6.dist-info → ansible_core-2.18.0.dist-info}/COPYING +0 -0
- {ansible_core-2.17.6.dist-info → ansible_core-2.18.0.dist-info}/WHEEL +0 -0
- {ansible_core-2.17.6.dist-info → ansible_core-2.18.0.dist-info}/top_level.txt +0 -0
ansible/modules/systemd.py
CHANGED
|
@@ -34,7 +34,7 @@ options:
|
|
|
34
34
|
choices: [ reloaded, restarted, started, stopped ]
|
|
35
35
|
enabled:
|
|
36
36
|
description:
|
|
37
|
-
- Whether the unit should start on boot.
|
|
37
|
+
- Whether the unit should start on boot. At least one of O(state) and O(enabled) are required.
|
|
38
38
|
- If set, requires O(name).
|
|
39
39
|
type: bool
|
|
40
40
|
force:
|
|
@@ -49,8 +49,8 @@ options:
|
|
|
49
49
|
type: bool
|
|
50
50
|
daemon_reload:
|
|
51
51
|
description:
|
|
52
|
-
- Run daemon-reload before doing any other operations, to make sure systemd has read any changes.
|
|
53
|
-
- When set to V(true), runs daemon-reload even if the module does not start or stop anything.
|
|
52
|
+
- Run C(daemon-reload) before doing any other operations, to make sure systemd has read any changes.
|
|
53
|
+
- When set to V(true), runs C(daemon-reload) even if the module does not start or stop anything.
|
|
54
54
|
type: bool
|
|
55
55
|
default: no
|
|
56
56
|
aliases: [ daemon-reload ]
|
|
@@ -63,9 +63,9 @@ options:
|
|
|
63
63
|
version_added: "2.8"
|
|
64
64
|
scope:
|
|
65
65
|
description:
|
|
66
|
-
- Run systemctl within a given service manager scope, either as the default system scope V(system),
|
|
66
|
+
- Run C(systemctl) within a given service manager scope, either as the default system scope V(system),
|
|
67
67
|
the current user's scope V(user), or the scope of all users V(global).
|
|
68
|
-
- "For systemd to work with
|
|
68
|
+
- "For systemd to work with V(user), the executing user must have its own instance of dbus started and accessible (systemd requirement)."
|
|
69
69
|
- "The user dbus process is normally started during normal login, but not during the run of Ansible tasks.
|
|
70
70
|
Otherwise you will probably get a 'Failed to connect to bus: no such file or directory' error."
|
|
71
71
|
- The user must have access, normally given via setting the C(XDG_RUNTIME_DIR) variable, see the example below.
|
|
@@ -95,7 +95,7 @@ notes:
|
|
|
95
95
|
- Globs are not supported in name, in other words, C(postgres*.service).
|
|
96
96
|
- The service names might vary by specific OS/distribution.
|
|
97
97
|
- The order of execution when having multiple properties is to first enable/disable, then mask/unmask and then deal with the service state.
|
|
98
|
-
It has been reported that systemctl can behave differently depending on the order of operations if you do the same manually.
|
|
98
|
+
It has been reported that C(systemctl) can behave differently depending on the order of operations if you do the same manually.
|
|
99
99
|
requirements:
|
|
100
100
|
- A system managed by systemd.
|
|
101
101
|
'''
|
|
@@ -495,6 +495,8 @@ def main():
|
|
|
495
495
|
if rc != 0:
|
|
496
496
|
# some versions of system CAN mask/unmask non existing services, we only fail on missing if they don't
|
|
497
497
|
fail_if_missing(module, found, unit, msg='host')
|
|
498
|
+
# here if service was not missing, but failed for other reasons
|
|
499
|
+
module.fail_json(msg=f"Failed to {action} the service ({unit}): {err.strip()}")
|
|
498
500
|
|
|
499
501
|
# Enable/disable service startup at boot if requested
|
|
500
502
|
if module.params['enabled'] is not None:
|
|
@@ -512,11 +514,15 @@ def main():
|
|
|
512
514
|
|
|
513
515
|
# check systemctl result or if it is a init script
|
|
514
516
|
if rc == 0:
|
|
515
|
-
enabled
|
|
516
|
-
|
|
517
|
-
|
|
517
|
+
# https://www.freedesktop.org/software/systemd/man/systemctl.html#is-enabled%20UNIT%E2%80%A6
|
|
518
|
+
if out.rstrip() in (
|
|
519
|
+
"enabled-runtime", # transiently enabled but we're trying to set a permanent enabled
|
|
520
|
+
"indirect", # We've been asked to enable this unit so do so despite possible reasons
|
|
521
|
+
# that systemctl may have for thinking it's enabled already.
|
|
522
|
+
"alias"): # Let systemd handle the alias as we can't be sure what's needed.
|
|
518
523
|
enabled = False
|
|
519
|
-
|
|
524
|
+
else:
|
|
525
|
+
enabled = True
|
|
520
526
|
elif rc == 1:
|
|
521
527
|
# if not a user or global user service and both init script and unit file exist stdout should have enabled/disabled, otherwise use rc entries
|
|
522
528
|
if module.params['scope'] == 'system' and \
|
|
@@ -34,7 +34,7 @@ options:
|
|
|
34
34
|
choices: [ reloaded, restarted, started, stopped ]
|
|
35
35
|
enabled:
|
|
36
36
|
description:
|
|
37
|
-
- Whether the unit should start on boot.
|
|
37
|
+
- Whether the unit should start on boot. At least one of O(state) and O(enabled) are required.
|
|
38
38
|
- If set, requires O(name).
|
|
39
39
|
type: bool
|
|
40
40
|
force:
|
|
@@ -49,8 +49,8 @@ options:
|
|
|
49
49
|
type: bool
|
|
50
50
|
daemon_reload:
|
|
51
51
|
description:
|
|
52
|
-
- Run daemon-reload before doing any other operations, to make sure systemd has read any changes.
|
|
53
|
-
- When set to V(true), runs daemon-reload even if the module does not start or stop anything.
|
|
52
|
+
- Run C(daemon-reload) before doing any other operations, to make sure systemd has read any changes.
|
|
53
|
+
- When set to V(true), runs C(daemon-reload) even if the module does not start or stop anything.
|
|
54
54
|
type: bool
|
|
55
55
|
default: no
|
|
56
56
|
aliases: [ daemon-reload ]
|
|
@@ -63,9 +63,9 @@ options:
|
|
|
63
63
|
version_added: "2.8"
|
|
64
64
|
scope:
|
|
65
65
|
description:
|
|
66
|
-
- Run systemctl within a given service manager scope, either as the default system scope V(system),
|
|
66
|
+
- Run C(systemctl) within a given service manager scope, either as the default system scope V(system),
|
|
67
67
|
the current user's scope V(user), or the scope of all users V(global).
|
|
68
|
-
- "For systemd to work with
|
|
68
|
+
- "For systemd to work with V(user), the executing user must have its own instance of dbus started and accessible (systemd requirement)."
|
|
69
69
|
- "The user dbus process is normally started during normal login, but not during the run of Ansible tasks.
|
|
70
70
|
Otherwise you will probably get a 'Failed to connect to bus: no such file or directory' error."
|
|
71
71
|
- The user must have access, normally given via setting the C(XDG_RUNTIME_DIR) variable, see the example below.
|
|
@@ -95,7 +95,7 @@ notes:
|
|
|
95
95
|
- Globs are not supported in name, in other words, C(postgres*.service).
|
|
96
96
|
- The service names might vary by specific OS/distribution.
|
|
97
97
|
- The order of execution when having multiple properties is to first enable/disable, then mask/unmask and then deal with the service state.
|
|
98
|
-
It has been reported that systemctl can behave differently depending on the order of operations if you do the same manually.
|
|
98
|
+
It has been reported that C(systemctl) can behave differently depending on the order of operations if you do the same manually.
|
|
99
99
|
requirements:
|
|
100
100
|
- A system managed by systemd.
|
|
101
101
|
'''
|
|
@@ -495,6 +495,8 @@ def main():
|
|
|
495
495
|
if rc != 0:
|
|
496
496
|
# some versions of system CAN mask/unmask non existing services, we only fail on missing if they don't
|
|
497
497
|
fail_if_missing(module, found, unit, msg='host')
|
|
498
|
+
# here if service was not missing, but failed for other reasons
|
|
499
|
+
module.fail_json(msg=f"Failed to {action} the service ({unit}): {err.strip()}")
|
|
498
500
|
|
|
499
501
|
# Enable/disable service startup at boot if requested
|
|
500
502
|
if module.params['enabled'] is not None:
|
|
@@ -512,11 +514,15 @@ def main():
|
|
|
512
514
|
|
|
513
515
|
# check systemctl result or if it is a init script
|
|
514
516
|
if rc == 0:
|
|
515
|
-
enabled
|
|
516
|
-
|
|
517
|
-
|
|
517
|
+
# https://www.freedesktop.org/software/systemd/man/systemctl.html#is-enabled%20UNIT%E2%80%A6
|
|
518
|
+
if out.rstrip() in (
|
|
519
|
+
"enabled-runtime", # transiently enabled but we're trying to set a permanent enabled
|
|
520
|
+
"indirect", # We've been asked to enable this unit so do so despite possible reasons
|
|
521
|
+
# that systemctl may have for thinking it's enabled already.
|
|
522
|
+
"alias"): # Let systemd handle the alias as we can't be sure what's needed.
|
|
518
523
|
enabled = False
|
|
519
|
-
|
|
524
|
+
else:
|
|
525
|
+
enabled = True
|
|
520
526
|
elif rc == 1:
|
|
521
527
|
# if not a user or global user service and both init script and unit file exist stdout should have enabled/disabled, otherwise use rc entries
|
|
522
528
|
if module.params['scope'] == 'system' and \
|
ansible/modules/sysvinit.py
CHANGED
|
@@ -31,7 +31,7 @@ options:
|
|
|
31
31
|
enabled:
|
|
32
32
|
type: bool
|
|
33
33
|
description:
|
|
34
|
-
- Whether the service should start on boot.
|
|
34
|
+
- Whether the service should start on boot. At least one of O(state) and O(enabled) are required.
|
|
35
35
|
sleep:
|
|
36
36
|
default: 1
|
|
37
37
|
description:
|
|
@@ -42,7 +42,7 @@ options:
|
|
|
42
42
|
description:
|
|
43
43
|
- A substring to look for as would be found in the output of the I(ps) command as a stand-in for a status result.
|
|
44
44
|
- If the string is found, the service will be assumed to be running.
|
|
45
|
-
- "This option is mainly for use with init scripts that don't support the
|
|
45
|
+
- "This option is mainly for use with init scripts that don't support the C(status) option."
|
|
46
46
|
type: str
|
|
47
47
|
runlevels:
|
|
48
48
|
description:
|
|
@@ -74,7 +74,7 @@ attributes:
|
|
|
74
74
|
platforms: posix
|
|
75
75
|
notes:
|
|
76
76
|
- One option other than name is required.
|
|
77
|
-
- The service names might vary by specific OS/distribution
|
|
77
|
+
- The service names might vary by specific OS/distribution.
|
|
78
78
|
requirements:
|
|
79
79
|
- That the service managed has a corresponding init script.
|
|
80
80
|
'''
|
|
@@ -203,7 +203,7 @@ def main():
|
|
|
203
203
|
worked = is_started = get_ps(module, pattern)
|
|
204
204
|
else:
|
|
205
205
|
if location.get('service'):
|
|
206
|
-
# standard tool that has been '
|
|
206
|
+
# standard tool that has been 'destandardized' by reimplementation in other OS/distros
|
|
207
207
|
cmd = '%s %s status' % (location['service'], name)
|
|
208
208
|
elif script:
|
|
209
209
|
# maybe script implements status (not LSB)
|
ansible/modules/unarchive.py
CHANGED
|
@@ -241,7 +241,6 @@ uid:
|
|
|
241
241
|
|
|
242
242
|
import binascii
|
|
243
243
|
import codecs
|
|
244
|
-
import datetime
|
|
245
244
|
import fnmatch
|
|
246
245
|
import grp
|
|
247
246
|
import os
|
|
@@ -260,15 +259,8 @@ from ansible.module_utils.common.process import get_bin_path
|
|
|
260
259
|
from ansible.module_utils.common.locale import get_best_parsable_locale
|
|
261
260
|
from ansible.module_utils.urls import fetch_file
|
|
262
261
|
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
except ImportError: # older python
|
|
266
|
-
from pipes import quote
|
|
267
|
-
|
|
268
|
-
try: # python 3.2+
|
|
269
|
-
from zipfile import BadZipFile # type: ignore[attr-defined]
|
|
270
|
-
except ImportError: # older python
|
|
271
|
-
from zipfile import BadZipfile as BadZipFile
|
|
262
|
+
from shlex import quote
|
|
263
|
+
from zipfile import BadZipFile
|
|
272
264
|
|
|
273
265
|
# String from tar that shows the tar contents are different from the
|
|
274
266
|
# filesystem
|
|
@@ -283,6 +275,8 @@ ZIP_FILE_MODE_RE = re.compile(r'([r-][w-][SsTtx-]){3}')
|
|
|
283
275
|
INVALID_OWNER_RE = re.compile(r': Invalid owner')
|
|
284
276
|
INVALID_GROUP_RE = re.compile(r': Invalid group')
|
|
285
277
|
SYMLINK_DIFF_RE = re.compile(r': Symlink differs$')
|
|
278
|
+
CONTENT_DIFF_RE = re.compile(r': Contents differ$')
|
|
279
|
+
SIZE_DIFF_RE = re.compile(r': Size differs$')
|
|
286
280
|
|
|
287
281
|
|
|
288
282
|
def crc32(path, buffer_size):
|
|
@@ -411,6 +405,27 @@ class ZipArchive(object):
|
|
|
411
405
|
archive.close()
|
|
412
406
|
return self._files_in_archive
|
|
413
407
|
|
|
408
|
+
def _valid_time_stamp(self, timestamp_str):
|
|
409
|
+
""" Return a valid time object from the given time string """
|
|
410
|
+
DT_RE = re.compile(r'^(\d{4})(\d{2})(\d{2})\.(\d{2})(\d{2})(\d{2})$')
|
|
411
|
+
match = DT_RE.match(timestamp_str)
|
|
412
|
+
epoch_date_time = (1980, 1, 1, 0, 0, 0, 0, 0, 0)
|
|
413
|
+
if match:
|
|
414
|
+
try:
|
|
415
|
+
if int(match.groups()[0]) < 1980:
|
|
416
|
+
date_time = epoch_date_time
|
|
417
|
+
elif int(match.groups()[0]) > 2107:
|
|
418
|
+
date_time = (2107, 12, 31, 23, 59, 59, 0, 0, 0)
|
|
419
|
+
else:
|
|
420
|
+
date_time = (int(m) for m in match.groups() + (0, 0, 0))
|
|
421
|
+
except ValueError:
|
|
422
|
+
date_time = epoch_date_time
|
|
423
|
+
else:
|
|
424
|
+
# Assume epoch date
|
|
425
|
+
date_time = epoch_date_time
|
|
426
|
+
|
|
427
|
+
return time.mktime(time.struct_time(date_time))
|
|
428
|
+
|
|
414
429
|
def is_unarchived(self):
|
|
415
430
|
# BSD unzip doesn't support zipinfo listings with timestamp.
|
|
416
431
|
if self.zipinfoflag:
|
|
@@ -609,8 +624,7 @@ class ZipArchive(object):
|
|
|
609
624
|
# Note: this timestamp calculation has a rounding error
|
|
610
625
|
# somewhere... unzip and this timestamp can be one second off
|
|
611
626
|
# When that happens, we report a change and re-unzip the file
|
|
612
|
-
|
|
613
|
-
timestamp = time.mktime(dt_object.timetuple())
|
|
627
|
+
timestamp = self._valid_time_stamp(pcs[6])
|
|
614
628
|
|
|
615
629
|
# Compare file timestamps
|
|
616
630
|
if stat.S_ISREG(st.st_mode):
|
|
@@ -879,16 +893,15 @@ class TgzArchive(object):
|
|
|
879
893
|
out += line + '\n'
|
|
880
894
|
if not self.file_args['mode'] and MODE_DIFF_RE.search(line):
|
|
881
895
|
out += line + '\n'
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
out += line + '\n'
|
|
896
|
+
differ_regexes = [
|
|
897
|
+
MOD_TIME_DIFF_RE, MISSING_FILE_RE, INVALID_OWNER_RE,
|
|
898
|
+
INVALID_GROUP_RE, SYMLINK_DIFF_RE, CONTENT_DIFF_RE,
|
|
899
|
+
SIZE_DIFF_RE
|
|
900
|
+
]
|
|
901
|
+
for regex in differ_regexes:
|
|
902
|
+
if regex.search(line):
|
|
903
|
+
out += line + '\n'
|
|
904
|
+
|
|
892
905
|
if out:
|
|
893
906
|
unarchived = False
|
|
894
907
|
return dict(unarchived=unarchived, rc=rc, out=out, err=err, cmd=cmd)
|
ansible/modules/uri.py
CHANGED
|
@@ -22,19 +22,19 @@ options:
|
|
|
22
22
|
- 'When a list is provided, all ciphers are joined in order with V(:)'
|
|
23
23
|
- See the L(OpenSSL Cipher List Format,https://www.openssl.org/docs/manmaster/man1/openssl-ciphers.html#CIPHER-LIST-FORMAT)
|
|
24
24
|
for more details.
|
|
25
|
-
- The available ciphers is dependent on the Python and OpenSSL/LibreSSL versions
|
|
25
|
+
- The available ciphers is dependent on the Python and OpenSSL/LibreSSL versions.
|
|
26
26
|
type: list
|
|
27
27
|
elements: str
|
|
28
28
|
version_added: '2.14'
|
|
29
29
|
decompress:
|
|
30
30
|
description:
|
|
31
|
-
- Whether to attempt to decompress gzip content-encoded responses
|
|
31
|
+
- Whether to attempt to decompress gzip content-encoded responses.
|
|
32
32
|
type: bool
|
|
33
33
|
default: true
|
|
34
34
|
version_added: '2.14'
|
|
35
35
|
url:
|
|
36
36
|
description:
|
|
37
|
-
- HTTP or HTTPS URL in the form (http|https)://host.domain[:port]/path
|
|
37
|
+
- HTTP or HTTPS URL in the form (http|https)://host.domain[:port]/path.
|
|
38
38
|
type: str
|
|
39
39
|
required: true
|
|
40
40
|
dest:
|
|
@@ -58,17 +58,17 @@ options:
|
|
|
58
58
|
to V(json) it will take an already formatted JSON string or convert a data structure
|
|
59
59
|
into JSON.
|
|
60
60
|
- If O(body_format) is set to V(form-urlencoded) it will convert a dictionary
|
|
61
|
-
or list of tuples into an
|
|
61
|
+
or list of tuples into an C(application/x-www-form-urlencoded) string. (Added in v2.7)
|
|
62
62
|
- If O(body_format) is set to V(form-multipart) it will convert a dictionary
|
|
63
|
-
into
|
|
63
|
+
into C(multipart/form-multipart) body. (Added in v2.10)
|
|
64
64
|
type: raw
|
|
65
65
|
body_format:
|
|
66
66
|
description:
|
|
67
67
|
- The serialization format of the body. When set to V(json), V(form-multipart), or V(form-urlencoded), encodes
|
|
68
|
-
the body argument, if needed, and automatically sets the Content-Type header accordingly.
|
|
68
|
+
the body argument, if needed, and automatically sets the C(Content-Type) header accordingly.
|
|
69
69
|
- As of v2.3 it is possible to override the C(Content-Type) header, when
|
|
70
70
|
set to V(json) or V(form-urlencoded) via the O(headers) option.
|
|
71
|
-
- The
|
|
71
|
+
- The C(Content-Type) header cannot be overridden when using V(form-multipart).
|
|
72
72
|
- V(form-urlencoded) was added in v2.7.
|
|
73
73
|
- V(form-multipart) was added in v2.10.
|
|
74
74
|
type: str
|
|
@@ -86,7 +86,7 @@ options:
|
|
|
86
86
|
description:
|
|
87
87
|
- Whether or not to return the body of the response as a "content" key in
|
|
88
88
|
the dictionary result no matter it succeeded or failed.
|
|
89
|
-
- Independently of this option, if the reported Content-
|
|
89
|
+
- Independently of this option, if the reported C(Content-Type) is C(application/json), then the JSON is
|
|
90
90
|
always loaded into a key called RV(ignore:json) in the dictionary results.
|
|
91
91
|
type: bool
|
|
92
92
|
default: no
|
|
@@ -108,15 +108,15 @@ options:
|
|
|
108
108
|
follow_redirects:
|
|
109
109
|
description:
|
|
110
110
|
- Whether or not the URI module should follow redirects.
|
|
111
|
+
type: str
|
|
112
|
+
default: safe
|
|
111
113
|
choices:
|
|
112
114
|
all: Will follow all redirects.
|
|
113
115
|
none: Will not follow any redirects.
|
|
114
116
|
safe: Only redirects doing GET or HEAD requests will be followed.
|
|
115
117
|
urllib2: Defer to urllib2 behavior (As of writing this follows HTTP redirects).
|
|
116
|
-
'no': (DEPRECATED,
|
|
117
|
-
'yes': (DEPRECATED,
|
|
118
|
-
type: str
|
|
119
|
-
default: safe
|
|
118
|
+
'no': (DEPRECATED, removed in 2.22) alias of V(none).
|
|
119
|
+
'yes': (DEPRECATED, removed in 2.22) alias of V(all).
|
|
120
120
|
creates:
|
|
121
121
|
description:
|
|
122
122
|
- A filename, when it already exists, this step will not be run.
|
|
@@ -155,7 +155,7 @@ options:
|
|
|
155
155
|
client_cert:
|
|
156
156
|
description:
|
|
157
157
|
- PEM formatted certificate chain file to be used for SSL client authentication.
|
|
158
|
-
- This file can also include the key as well, and if the key is included, O(client_key) is not required
|
|
158
|
+
- This file can also include the key as well, and if the key is included, O(client_key) is not required.
|
|
159
159
|
type: path
|
|
160
160
|
version_added: '2.4'
|
|
161
161
|
client_key:
|
|
@@ -166,7 +166,7 @@ options:
|
|
|
166
166
|
version_added: '2.4'
|
|
167
167
|
ca_path:
|
|
168
168
|
description:
|
|
169
|
-
- PEM formatted file that contains a CA certificate to be used for validation
|
|
169
|
+
- PEM formatted file that contains a CA certificate to be used for validation.
|
|
170
170
|
type: path
|
|
171
171
|
version_added: '2.11'
|
|
172
172
|
src:
|
|
@@ -195,7 +195,7 @@ options:
|
|
|
195
195
|
default: true
|
|
196
196
|
unix_socket:
|
|
197
197
|
description:
|
|
198
|
-
- Path to Unix domain socket to use for connection
|
|
198
|
+
- Path to Unix domain socket to use for connection.
|
|
199
199
|
type: path
|
|
200
200
|
version_added: '2.8'
|
|
201
201
|
http_agent:
|
|
@@ -225,9 +225,9 @@ options:
|
|
|
225
225
|
version_added: '2.11'
|
|
226
226
|
use_netrc:
|
|
227
227
|
description:
|
|
228
|
-
- Determining whether to use credentials from
|
|
229
|
-
- By default .netrc is used with Basic authentication headers
|
|
230
|
-
- When
|
|
228
|
+
- Determining whether to use credentials from C(~/.netrc) file.
|
|
229
|
+
- By default C(.netrc) is used with Basic authentication headers.
|
|
230
|
+
- When V(false), C(.netrc) credentials are ignored.
|
|
231
231
|
type: bool
|
|
232
232
|
default: true
|
|
233
233
|
version_added: '2.14'
|
|
@@ -581,6 +581,12 @@ def uri(module, url, dest, body, body_format, method, headers, socket_timeout, c
|
|
|
581
581
|
# if destination file already exist, only download if file newer
|
|
582
582
|
kwargs['last_mod_time'] = utcfromtimestamp(os.path.getmtime(dest))
|
|
583
583
|
|
|
584
|
+
if module.params.get('follow_redirects') in ('no', 'yes'):
|
|
585
|
+
module.deprecate(
|
|
586
|
+
"Using 'yes' or 'no' for 'follow_redirects' parameter is deprecated.",
|
|
587
|
+
version='2.22'
|
|
588
|
+
)
|
|
589
|
+
|
|
584
590
|
resp, info = fetch_url(module, url, data=data, headers=headers,
|
|
585
591
|
method=method, timeout=socket_timeout, unix_socket=module.params['unix_socket'],
|
|
586
592
|
ca_path=ca_path, unredirected_headers=unredirected_headers,
|