ansible-core 2.17.4__py3-none-any.whl → 2.18.0b1__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 +30 -53
- 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 +14 -11
- 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 +48 -31
- 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/playbook/task.py +1 -1
- ansible/plugins/__init__.py +2 -0
- ansible/plugins/action/__init__.py +7 -9
- 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.0b1.dist-info/Apache-License.txt +202 -0
- {ansible_core-2.17.4.dist-info → ansible_core-2.18.0b1.dist-info}/METADATA +36 -23
- ansible_core-2.18.0b1.dist-info/MIT-license.txt +14 -0
- ansible_core-2.18.0b1.dist-info/PSF-license.txt +48 -0
- {ansible_core-2.17.4.dist-info → ansible_core-2.18.0b1.dist-info}/RECORD +311 -306
- {ansible_core-2.17.4.dist-info → ansible_core-2.18.0b1.dist-info}/WHEEL +1 -1
- {ansible_core-2.17.4.dist-info → ansible_core-2.18.0b1.dist-info}/entry_points.txt +1 -1
- ansible_core-2.18.0b1.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 +5 -7
- 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/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/collection.cfg +1 -0
- ansible_test/_util/controller/sanity/pylint/config/default.cfg +1 -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 +14 -20
- ansible_test/config/config.yml +1 -1
- ansible_core-2.17.4.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.4.dist-info → ansible_core-2.18.0b1.dist-info}/COPYING +0 -0
- {ansible_core-2.17.4.dist-info → ansible_core-2.18.0b1.dist-info}/top_level.txt +0 -0
ansible/modules/package_facts.py
CHANGED
|
@@ -14,30 +14,43 @@ description:
|
|
|
14
14
|
options:
|
|
15
15
|
manager:
|
|
16
16
|
description:
|
|
17
|
-
- The package manager used by the system so we can query the package information.
|
|
18
|
-
|
|
19
|
-
- The
|
|
20
|
-
- The
|
|
21
|
-
- The
|
|
17
|
+
- The package manager(s) used by the system so we can query the package information.
|
|
18
|
+
This is a list and can support multiple package managers per system, since version 2.8.
|
|
19
|
+
- The V(portage) and V(pkg) options were added in version 2.8.
|
|
20
|
+
- The V(apk) option was added in version 2.11.
|
|
21
|
+
- The V(pkg_info)' option was added in version 2.13.
|
|
22
|
+
- Aliases were added in 2.18, to support using C(manager={{ansible_facts['pkg_mgr']}})
|
|
22
23
|
default: ['auto']
|
|
23
|
-
choices:
|
|
24
|
+
choices:
|
|
25
|
+
auto: Depending on O(strategy), will match the first or all package managers provided, in order
|
|
26
|
+
rpm: For RPM based distros, requires RPM Python bindings, not installed by default on Suse (python3-rpm)
|
|
27
|
+
yum: Alias to rpm
|
|
28
|
+
dnf: Alias to rpm
|
|
29
|
+
dnf5: Alias to rpm
|
|
30
|
+
zypper: Alias to rpm
|
|
31
|
+
apt: For DEB based distros, C(python-apt) package must be installed on targeted hosts
|
|
32
|
+
portage: Handles ebuild packages, it requires the C(qlist) utility, which is part of 'app-portage/portage-utils'
|
|
33
|
+
pkg: libpkg front end (FreeBSD)
|
|
34
|
+
pkg5: Alias to pkg
|
|
35
|
+
pkgng: Alias to pkg
|
|
36
|
+
pacman: Archlinux package manager/builder
|
|
37
|
+
apk: Alpine Linux package manager
|
|
38
|
+
pkg_info: OpenBSD package manager
|
|
39
|
+
openbsd_pkg: Alias to pkg_info
|
|
24
40
|
type: list
|
|
25
41
|
elements: str
|
|
26
42
|
strategy:
|
|
27
43
|
description:
|
|
28
44
|
- This option controls how the module queries the package managers on the system.
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
45
|
+
choices:
|
|
46
|
+
first: returns only information for the first supported package manager available.
|
|
47
|
+
all: returns information for all supported and available package managers on the system.
|
|
32
48
|
default: 'first'
|
|
33
49
|
type: str
|
|
34
50
|
version_added: "2.8"
|
|
35
51
|
version_added: "2.5"
|
|
36
52
|
requirements:
|
|
37
|
-
-
|
|
38
|
-
- For Debian-based systems C(python-apt) package must be installed on targeted hosts.
|
|
39
|
-
- For SUSE-based systems C(python3-rpm) package must be installed on targeted hosts.
|
|
40
|
-
This package is required because SUSE does not include RPM Python bindings by default.
|
|
53
|
+
- See details per package manager in the O(manager) option.
|
|
41
54
|
author:
|
|
42
55
|
- Matthew Jones (@matburt)
|
|
43
56
|
- Brian Coca (@bcoca)
|
|
@@ -240,16 +253,26 @@ ansible_facts:
|
|
|
240
253
|
import re
|
|
241
254
|
|
|
242
255
|
from ansible.module_utils.common.text.converters import to_native, to_text
|
|
243
|
-
from ansible.module_utils.basic import AnsibleModule
|
|
256
|
+
from ansible.module_utils.basic import AnsibleModule
|
|
244
257
|
from ansible.module_utils.common.locale import get_best_parsable_locale
|
|
245
|
-
from ansible.module_utils.
|
|
246
|
-
from ansible.module_utils.common.respawn import has_respawned, probe_interpreters_for_module, respawn_module
|
|
247
|
-
from ansible.module_utils.facts.packages import LibMgr, CLIMgr, get_all_pkg_managers
|
|
258
|
+
from ansible.module_utils.facts.packages import CLIMgr, RespawningLibMgr, get_all_pkg_managers
|
|
248
259
|
|
|
249
260
|
|
|
250
|
-
|
|
261
|
+
ALIASES = {
|
|
262
|
+
'rpm': ['dnf', 'dnf5', 'yum' , 'zypper'],
|
|
263
|
+
'pkg': ['pkg5', 'pkgng'],
|
|
264
|
+
'pkg_info': ['openbsd_pkg'],
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
|
|
268
|
+
class RPM(RespawningLibMgr):
|
|
251
269
|
|
|
252
270
|
LIB = 'rpm'
|
|
271
|
+
CLI_BINARIES = ['rpm']
|
|
272
|
+
INTERPRETERS = [
|
|
273
|
+
'/usr/libexec/platform-python',
|
|
274
|
+
'/usr/bin/python3',
|
|
275
|
+
]
|
|
253
276
|
|
|
254
277
|
def list_installed(self):
|
|
255
278
|
return self._lib.TransactionSet().dbMatch()
|
|
@@ -261,34 +284,11 @@ class RPM(LibMgr):
|
|
|
261
284
|
epoch=package[self._lib.RPMTAG_EPOCH],
|
|
262
285
|
arch=package[self._lib.RPMTAG_ARCH],)
|
|
263
286
|
|
|
264
|
-
def is_available(self):
|
|
265
|
-
''' we expect the python bindings installed, but this gives warning if they are missing and we have rpm cli'''
|
|
266
|
-
we_have_lib = super(RPM, self).is_available()
|
|
267
|
-
|
|
268
|
-
try:
|
|
269
|
-
get_bin_path('rpm')
|
|
270
|
-
|
|
271
|
-
if not we_have_lib and not has_respawned():
|
|
272
|
-
# try to locate an interpreter with the necessary lib
|
|
273
|
-
interpreters = ['/usr/libexec/platform-python',
|
|
274
|
-
'/usr/bin/python3',
|
|
275
|
-
'/usr/bin/python2']
|
|
276
|
-
interpreter_path = probe_interpreters_for_module(interpreters, self.LIB)
|
|
277
|
-
if interpreter_path:
|
|
278
|
-
respawn_module(interpreter_path)
|
|
279
|
-
# end of the line for this process; this module will exit when the respawned copy completes
|
|
280
287
|
|
|
281
|
-
|
|
282
|
-
module.warn('Found "rpm" but %s' % (missing_required_lib(self.LIB)))
|
|
283
|
-
except ValueError:
|
|
284
|
-
pass
|
|
285
|
-
|
|
286
|
-
return we_have_lib
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
class APT(LibMgr):
|
|
288
|
+
class APT(RespawningLibMgr):
|
|
290
289
|
|
|
291
290
|
LIB = 'apt'
|
|
291
|
+
CLI_BINARIES = ['apt', 'apt-get', 'aptitude']
|
|
292
292
|
|
|
293
293
|
def __init__(self):
|
|
294
294
|
self._cache = None
|
|
@@ -302,30 +302,6 @@ class APT(LibMgr):
|
|
|
302
302
|
self._cache = self._lib.Cache()
|
|
303
303
|
return self._cache
|
|
304
304
|
|
|
305
|
-
def is_available(self):
|
|
306
|
-
''' we expect the python bindings installed, but if there is apt/apt-get give warning about missing bindings'''
|
|
307
|
-
we_have_lib = super(APT, self).is_available()
|
|
308
|
-
if not we_have_lib:
|
|
309
|
-
for exe in ('apt', 'apt-get', 'aptitude'):
|
|
310
|
-
try:
|
|
311
|
-
get_bin_path(exe)
|
|
312
|
-
except ValueError:
|
|
313
|
-
continue
|
|
314
|
-
else:
|
|
315
|
-
if not has_respawned():
|
|
316
|
-
# try to locate an interpreter with the necessary lib
|
|
317
|
-
interpreters = ['/usr/bin/python3',
|
|
318
|
-
'/usr/bin/python2']
|
|
319
|
-
interpreter_path = probe_interpreters_for_module(interpreters, self.LIB)
|
|
320
|
-
if interpreter_path:
|
|
321
|
-
respawn_module(interpreter_path)
|
|
322
|
-
# end of the line for this process; this module will exit here when respawned copy completes
|
|
323
|
-
|
|
324
|
-
module.warn('Found "%s" but %s' % (exe, missing_required_lib('apt')))
|
|
325
|
-
break
|
|
326
|
-
|
|
327
|
-
return we_have_lib
|
|
328
|
-
|
|
329
305
|
def list_installed(self):
|
|
330
306
|
# Store the cache to avoid running pkg_cache() for each item in the comprehension, which is very slow
|
|
331
307
|
cache = self.pkg_cache
|
|
@@ -485,9 +461,13 @@ def main():
|
|
|
485
461
|
# get supported pkg managers
|
|
486
462
|
PKG_MANAGERS = get_all_pkg_managers()
|
|
487
463
|
PKG_MANAGER_NAMES = [x.lower() for x in PKG_MANAGERS.keys()]
|
|
464
|
+
# add aliases
|
|
465
|
+
PKG_MANAGER_NAMES.extend([alias for alist in ALIASES.values() for alias in alist])
|
|
488
466
|
|
|
489
467
|
# start work
|
|
490
468
|
global module
|
|
469
|
+
|
|
470
|
+
# choices are not set for 'manager' as they are computed dynamically and validated below instead of in argspec
|
|
491
471
|
module = AnsibleModule(argument_spec=dict(manager={'type': 'list', 'elements': 'str', 'default': ['auto']},
|
|
492
472
|
strategy={'choices': ['first', 'all'], 'default': 'first'}),
|
|
493
473
|
supports_check_mode=True)
|
|
@@ -513,29 +493,32 @@ def main():
|
|
|
513
493
|
seen = set()
|
|
514
494
|
for pkgmgr in managers:
|
|
515
495
|
|
|
516
|
-
if
|
|
496
|
+
if strategy == 'first' and found:
|
|
517
497
|
break
|
|
518
498
|
|
|
499
|
+
# substitute aliases for aliased
|
|
500
|
+
for aliased in ALIASES.keys():
|
|
501
|
+
if pkgmgr in ALIASES[aliased]:
|
|
502
|
+
pkgmgr = aliased
|
|
503
|
+
break
|
|
504
|
+
|
|
519
505
|
# dedupe as per above
|
|
520
506
|
if pkgmgr in seen:
|
|
521
507
|
continue
|
|
508
|
+
|
|
522
509
|
seen.add(pkgmgr)
|
|
510
|
+
|
|
511
|
+
manager = PKG_MANAGERS[pkgmgr]()
|
|
523
512
|
try:
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
if manager.is_available():
|
|
528
|
-
found += 1
|
|
513
|
+
if manager.is_available(handle_exceptions=False):
|
|
514
|
+
found += 1
|
|
515
|
+
try:
|
|
529
516
|
packages.update(manager.get_packages())
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
if pkgmgr in module.params['manager']:
|
|
533
|
-
module.warn('Requested package manager %s was not usable by this module: %s' % (pkgmgr, to_text(e)))
|
|
534
|
-
continue
|
|
535
|
-
|
|
517
|
+
except Exception as e:
|
|
518
|
+
module.warn('Failed to retrieve packages with %s: %s' % (pkgmgr, to_text(e)))
|
|
536
519
|
except Exception as e:
|
|
537
520
|
if pkgmgr in module.params['manager']:
|
|
538
|
-
module.warn('
|
|
521
|
+
module.warn('Requested package manager %s was not usable by this module: %s' % (pkgmgr, to_text(e)))
|
|
539
522
|
|
|
540
523
|
if found == 0:
|
|
541
524
|
msg = ('Could not detect a supported package manager from the following list: %s, '
|
ansible/modules/pause.py
CHANGED
|
@@ -29,11 +29,12 @@ options:
|
|
|
29
29
|
prompt:
|
|
30
30
|
description:
|
|
31
31
|
- Optional text to use for the prompt message.
|
|
32
|
-
- User input is only returned if O(seconds
|
|
32
|
+
- User input is only returned if O(seconds) and O(minutes) are both not specified,
|
|
33
|
+
otherwise this is just a custom message before playbook execution is paused.
|
|
33
34
|
echo:
|
|
34
35
|
description:
|
|
35
36
|
- Controls whether or not keyboard input is shown when typing.
|
|
36
|
-
- Only has effect if O(seconds
|
|
37
|
+
- Only has effect if neither O(seconds) nor O(minutes) are set.
|
|
37
38
|
type: bool
|
|
38
39
|
default: 'yes'
|
|
39
40
|
version_added: 2.5
|
|
@@ -62,7 +63,7 @@ attributes:
|
|
|
62
63
|
platform:
|
|
63
64
|
platforms: all
|
|
64
65
|
notes:
|
|
65
|
-
- Starting in 2.2,
|
|
66
|
+
- Starting in 2.2, if you specify 0 or negative for minutes or seconds, it will wait for 1 second, previously it would wait indefinitely.
|
|
66
67
|
- User input is not captured or echoed, regardless of echo setting, when minutes or seconds is specified.
|
|
67
68
|
'''
|
|
68
69
|
|
ansible/modules/pip.py
CHANGED
|
@@ -28,21 +28,21 @@ options:
|
|
|
28
28
|
requirements:
|
|
29
29
|
description:
|
|
30
30
|
- The path to a pip requirements file, which should be local to the remote system.
|
|
31
|
-
File can be specified as a relative path if using the chdir option.
|
|
31
|
+
File can be specified as a relative path if using the O(chdir) option.
|
|
32
32
|
type: str
|
|
33
33
|
virtualenv:
|
|
34
34
|
description:
|
|
35
35
|
- An optional path to a I(virtualenv) directory to install into.
|
|
36
|
-
It cannot be specified together with the
|
|
36
|
+
It cannot be specified together with the O(executable) parameter
|
|
37
37
|
(added in 2.1).
|
|
38
38
|
If the virtualenv does not exist, it will be created before installing
|
|
39
|
-
packages. The optional virtualenv_site_packages, virtualenv_command,
|
|
40
|
-
and virtualenv_python options affect the creation of the virtualenv.
|
|
39
|
+
packages. The optional O(virtualenv_site_packages), O(virtualenv_command),
|
|
40
|
+
and O(virtualenv_python) options affect the creation of the virtualenv.
|
|
41
41
|
type: path
|
|
42
42
|
virtualenv_site_packages:
|
|
43
43
|
description:
|
|
44
44
|
- Whether the virtual environment will inherit packages from the
|
|
45
|
-
global site-packages directory.
|
|
45
|
+
global C(site-packages) directory. Note that if this setting is
|
|
46
46
|
changed on an already existing virtual environment it will not
|
|
47
47
|
have any effect, the environment must be deleted and newly
|
|
48
48
|
created.
|
|
@@ -68,14 +68,14 @@ options:
|
|
|
68
68
|
version_added: "2.0"
|
|
69
69
|
state:
|
|
70
70
|
description:
|
|
71
|
-
- The state of module
|
|
72
|
-
- The
|
|
71
|
+
- The state of module.
|
|
72
|
+
- The V(forcereinstall) option is only available in Ansible 2.1 and above.
|
|
73
73
|
type: str
|
|
74
74
|
choices: [ absent, forcereinstall, latest, present ]
|
|
75
75
|
default: present
|
|
76
76
|
extra_args:
|
|
77
77
|
description:
|
|
78
|
-
- Extra arguments passed to pip.
|
|
78
|
+
- Extra arguments passed to C(pip).
|
|
79
79
|
type: str
|
|
80
80
|
version_added: "1.0"
|
|
81
81
|
editable:
|
|
@@ -86,18 +86,18 @@ options:
|
|
|
86
86
|
version_added: "2.0"
|
|
87
87
|
chdir:
|
|
88
88
|
description:
|
|
89
|
-
- cd into this directory before running the command
|
|
89
|
+
- cd into this directory before running the command.
|
|
90
90
|
type: path
|
|
91
91
|
version_added: "1.3"
|
|
92
92
|
executable:
|
|
93
93
|
description:
|
|
94
|
-
- The explicit executable or pathname for the pip executable,
|
|
94
|
+
- The explicit executable or pathname for the C(pip) executable,
|
|
95
95
|
if different from the Ansible Python interpreter. For
|
|
96
96
|
example V(pip3.3), if there are both Python 2.7 and 3.3 installations
|
|
97
97
|
in the system and you want to run pip for the Python 3.3 installation.
|
|
98
98
|
- Mutually exclusive with O(virtualenv) (added in 2.1).
|
|
99
99
|
- Does not affect the Ansible Python interpreter.
|
|
100
|
-
- The setuptools package must be installed for both the Ansible Python interpreter
|
|
100
|
+
- The C(setuptools) package must be installed for both the Ansible Python interpreter
|
|
101
101
|
and for the version of Python specified by this option.
|
|
102
102
|
type: path
|
|
103
103
|
version_added: "1.3"
|
|
@@ -105,14 +105,14 @@ options:
|
|
|
105
105
|
description:
|
|
106
106
|
- The system umask to apply before installing the pip package. This is
|
|
107
107
|
useful, for example, when installing on systems that have a very
|
|
108
|
-
restrictive umask by default (e.g.,
|
|
108
|
+
restrictive umask by default (e.g., C(0077)) and you want to C(pip install)
|
|
109
109
|
packages which are to be used by all users. Note that this requires you
|
|
110
|
-
to specify desired umask mode as an octal string, (e.g.,
|
|
110
|
+
to specify desired umask mode as an octal string, (e.g., C(0022)).
|
|
111
111
|
type: str
|
|
112
112
|
version_added: "2.1"
|
|
113
113
|
break_system_packages:
|
|
114
114
|
description:
|
|
115
|
-
- Allow pip to modify an externally-managed Python installation as defined by PEP 668.
|
|
115
|
+
- Allow C(pip) to modify an externally-managed Python installation as defined by PEP 668.
|
|
116
116
|
- This is typically required when installing packages outside a virtual environment on modern systems.
|
|
117
117
|
type: bool
|
|
118
118
|
default: false
|
ansible/modules/replace.py
CHANGED
|
@@ -93,10 +93,6 @@ options:
|
|
|
93
93
|
get the original file back if you somehow clobbered it incorrectly.
|
|
94
94
|
type: bool
|
|
95
95
|
default: no
|
|
96
|
-
others:
|
|
97
|
-
description:
|
|
98
|
-
- All arguments accepted by the M(ansible.builtin.file) module also work here.
|
|
99
|
-
type: str
|
|
100
96
|
encoding:
|
|
101
97
|
description:
|
|
102
98
|
- The character encoding for reading and writing the file.
|
|
@@ -246,6 +242,7 @@ def main():
|
|
|
246
242
|
path = params['path']
|
|
247
243
|
encoding = params['encoding']
|
|
248
244
|
res_args = dict(rc=0)
|
|
245
|
+
contents = None
|
|
249
246
|
|
|
250
247
|
params['after'] = to_text(params['after'], errors='surrogate_or_strict', nonstring='passthru')
|
|
251
248
|
params['before'] = to_text(params['before'], errors='surrogate_or_strict', nonstring='passthru')
|
ansible/modules/rpm_key.py
CHANGED
|
@@ -15,7 +15,7 @@ author:
|
|
|
15
15
|
- Hector Acosta (@hacosta) <hector.acosta@gazzang.com>
|
|
16
16
|
short_description: Adds or removes a gpg key from the rpm db
|
|
17
17
|
description:
|
|
18
|
-
- Adds or removes (rpm --import) a gpg key to your rpm database.
|
|
18
|
+
- Adds or removes C(rpm --import) a gpg key to your rpm database.
|
|
19
19
|
version_added: "1.3"
|
|
20
20
|
options:
|
|
21
21
|
key:
|
|
@@ -40,7 +40,8 @@ options:
|
|
|
40
40
|
description:
|
|
41
41
|
- The long-form fingerprint of the key being imported.
|
|
42
42
|
- This will be used to verify the specified key.
|
|
43
|
-
type:
|
|
43
|
+
type: list
|
|
44
|
+
elements: str
|
|
44
45
|
version_added: 2.9
|
|
45
46
|
extends_documentation_fragment:
|
|
46
47
|
- action_common_attributes
|
|
@@ -73,6 +74,13 @@ EXAMPLES = '''
|
|
|
73
74
|
ansible.builtin.rpm_key:
|
|
74
75
|
key: /path/to/RPM-GPG-KEY.dag.txt
|
|
75
76
|
fingerprint: EBC6 E12C 62B1 C734 026B 2122 A20E 5214 6B8D 79E6
|
|
77
|
+
|
|
78
|
+
- name: Verify the key, using multiple fingerprints, before import
|
|
79
|
+
ansible.builtin.rpm_key:
|
|
80
|
+
key: /path/to/RPM-GPG-KEY.dag.txt
|
|
81
|
+
fingerprint:
|
|
82
|
+
- EBC6 E12C 62B1 C734 026B 2122 A20E 5214 6B8D 79E6
|
|
83
|
+
- 19B7 913E 6284 8E3F 4D78 D6B4 ECD9 1AB2 2EB6 8D86
|
|
76
84
|
'''
|
|
77
85
|
|
|
78
86
|
RETURN = r'''#'''
|
|
@@ -105,8 +113,12 @@ class RpmKey(object):
|
|
|
105
113
|
state = module.params['state']
|
|
106
114
|
key = module.params['key']
|
|
107
115
|
fingerprint = module.params['fingerprint']
|
|
116
|
+
fingerprints = set()
|
|
117
|
+
|
|
108
118
|
if fingerprint:
|
|
109
|
-
|
|
119
|
+
if not isinstance(fingerprint, list):
|
|
120
|
+
fingerprint = [fingerprint]
|
|
121
|
+
fingerprints = set(f.replace(' ', '').upper() for f in fingerprint)
|
|
110
122
|
|
|
111
123
|
self.gpg = self.module.get_bin_path('gpg')
|
|
112
124
|
if not self.gpg:
|
|
@@ -131,11 +143,12 @@ class RpmKey(object):
|
|
|
131
143
|
else:
|
|
132
144
|
if not keyfile:
|
|
133
145
|
self.module.fail_json(msg="When importing a key, a valid file must be given")
|
|
134
|
-
if
|
|
135
|
-
|
|
136
|
-
if
|
|
146
|
+
if fingerprints:
|
|
147
|
+
keyfile_fingerprints = self.getfingerprints(keyfile)
|
|
148
|
+
if not fingerprints.issubset(keyfile_fingerprints):
|
|
137
149
|
self.module.fail_json(
|
|
138
|
-
msg="The specified fingerprint, '%s',
|
|
150
|
+
msg=("The specified fingerprint, '%s', "
|
|
151
|
+
"does not match any key fingerprints in '%s'") % (fingerprints, keyfile_fingerprints)
|
|
139
152
|
)
|
|
140
153
|
self.import_key(keyfile)
|
|
141
154
|
if should_cleanup_keyfile:
|
|
@@ -183,11 +196,15 @@ class RpmKey(object):
|
|
|
183
196
|
|
|
184
197
|
self.module.fail_json(msg="Unexpected gpg output")
|
|
185
198
|
|
|
186
|
-
def
|
|
199
|
+
def getfingerprints(self, keyfile):
|
|
187
200
|
stdout, stderr = self.execute_command([
|
|
188
201
|
self.gpg, '--no-tty', '--batch', '--with-colons',
|
|
189
|
-
'--fixed-list-mode', '--
|
|
202
|
+
'--fixed-list-mode', '--import', '--import-options', 'show-only',
|
|
203
|
+
'--dry-run', keyfile
|
|
190
204
|
])
|
|
205
|
+
|
|
206
|
+
fingerprints = set()
|
|
207
|
+
|
|
191
208
|
for line in stdout.splitlines():
|
|
192
209
|
line = line.strip()
|
|
193
210
|
if line.startswith('fpr:'):
|
|
@@ -199,7 +216,10 @@ class RpmKey(object):
|
|
|
199
216
|
#
|
|
200
217
|
# "fpr :: Fingerprint (fingerprint is in field 10)"
|
|
201
218
|
#
|
|
202
|
-
|
|
219
|
+
fingerprints.add(line.split(':')[9])
|
|
220
|
+
|
|
221
|
+
if fingerprints:
|
|
222
|
+
return fingerprints
|
|
203
223
|
|
|
204
224
|
self.module.fail_json(msg="Unexpected gpg output")
|
|
205
225
|
|
|
@@ -239,7 +259,7 @@ def main():
|
|
|
239
259
|
argument_spec=dict(
|
|
240
260
|
state=dict(type='str', default='present', choices=['absent', 'present']),
|
|
241
261
|
key=dict(type='str', required=True, no_log=False),
|
|
242
|
-
fingerprint=dict(type='str'),
|
|
262
|
+
fingerprint=dict(type='list', elements='str'),
|
|
243
263
|
validate_certs=dict(type='bool', default=True),
|
|
244
264
|
),
|
|
245
265
|
supports_check_mode=True,
|
ansible/modules/service.py
CHANGED
|
@@ -35,8 +35,8 @@ options:
|
|
|
35
35
|
commands unless necessary.
|
|
36
36
|
- V(restarted) will always bounce the service.
|
|
37
37
|
- V(reloaded) will always reload.
|
|
38
|
-
-
|
|
39
|
-
- Note that reloaded will start the service if it is not already started,
|
|
38
|
+
- At least one of O(state) and O(enabled) are required.
|
|
39
|
+
- Note that V(reloaded) will start the service if it is not already started,
|
|
40
40
|
even if your chosen init system wouldn't normally.
|
|
41
41
|
type: str
|
|
42
42
|
choices: [ reloaded, restarted, started, stopped ]
|
|
@@ -52,7 +52,7 @@ options:
|
|
|
52
52
|
pattern:
|
|
53
53
|
description:
|
|
54
54
|
- If the service does not respond to the status command, name a
|
|
55
|
-
substring to look for as would be found in the output of the
|
|
55
|
+
substring to look for as would be found in the output of the C(ps)
|
|
56
56
|
command as a stand-in for a status result.
|
|
57
57
|
- If the string is found, the service will be assumed to be started.
|
|
58
58
|
- While using remote hosts with systemd this setting will be ignored.
|
|
@@ -61,7 +61,7 @@ options:
|
|
|
61
61
|
enabled:
|
|
62
62
|
description:
|
|
63
63
|
- Whether the service should start on boot.
|
|
64
|
-
-
|
|
64
|
+
- At least one of O(state) and O(enabled) are required.
|
|
65
65
|
type: bool
|
|
66
66
|
runlevel:
|
|
67
67
|
description:
|
|
@@ -80,7 +80,7 @@ options:
|
|
|
80
80
|
use:
|
|
81
81
|
description:
|
|
82
82
|
- The service module actually uses system specific modules, normally through auto detection, this setting can force a specific module.
|
|
83
|
-
- Normally it uses the value of the
|
|
83
|
+
- Normally it uses the value of the C(ansible_service_mgr) fact and falls back to the C(ansible.legacy.service) module when none matching is found.
|
|
84
84
|
- The 'old service module' still uses autodetection and in no way does it correspond to the C(service) command.
|
|
85
85
|
type: str
|
|
86
86
|
default: auto
|
|
@@ -1012,7 +1012,7 @@ class FreeBsdService(Service):
|
|
|
1012
1012
|
self.sysrc_cmd = self.module.get_bin_path('sysrc')
|
|
1013
1013
|
|
|
1014
1014
|
def get_service_status(self):
|
|
1015
|
-
rc, stdout, stderr = self.execute_command("%s %s %s %s" % (self.svc_cmd, self.name, 'onestatus'
|
|
1015
|
+
rc, stdout, stderr = self.execute_command("%s %s %s %s" % (self.svc_cmd, self.arguments, self.name, 'onestatus'))
|
|
1016
1016
|
if self.name == "pf":
|
|
1017
1017
|
self.running = "Enabled" in stdout
|
|
1018
1018
|
else:
|
|
@@ -1032,7 +1032,7 @@ class FreeBsdService(Service):
|
|
|
1032
1032
|
if os.path.isfile(rcfile):
|
|
1033
1033
|
self.rcconf_file = rcfile
|
|
1034
1034
|
|
|
1035
|
-
rc, stdout, stderr = self.execute_command("%s %s %s %s" % (self.svc_cmd, self.name, 'rcvar'
|
|
1035
|
+
rc, stdout, stderr = self.execute_command("%s %s %s %s" % (self.svc_cmd, self.arguments, self.name, 'rcvar'))
|
|
1036
1036
|
try:
|
|
1037
1037
|
rcvars = shlex.split(stdout, comments=True)
|
|
1038
1038
|
except Exception:
|
|
@@ -1097,7 +1097,7 @@ class FreeBsdService(Service):
|
|
|
1097
1097
|
if self.action == "reload":
|
|
1098
1098
|
self.action = "onereload"
|
|
1099
1099
|
|
|
1100
|
-
ret = self.execute_command("%s %s %s %s" % (self.svc_cmd, self.
|
|
1100
|
+
ret = self.execute_command("%s %s %s %s" % (self.svc_cmd, self.arguments, self.name, self.action))
|
|
1101
1101
|
|
|
1102
1102
|
if self.sleep:
|
|
1103
1103
|
time.sleep(self.sleep)
|
ansible/modules/service_facts.py
CHANGED
|
@@ -45,6 +45,19 @@ EXAMPLES = r'''
|
|
|
45
45
|
- name: Print service facts
|
|
46
46
|
ansible.builtin.debug:
|
|
47
47
|
var: ansible_facts.services
|
|
48
|
+
|
|
49
|
+
- name: show names of existing systemd services, sometimes systemd knows about services that were never installed
|
|
50
|
+
debug: msg={{ existing_systemd_services | map(attribute='name') }}
|
|
51
|
+
vars:
|
|
52
|
+
known_systemd_services: "{{ ansible_facts['services'].values() | selectattr('source', 'equalto', 'systemd') }}"
|
|
53
|
+
existing_systemd_services: "{{ known_systemd_services | rejectattr('status', 'equalto', 'not-found') }}"
|
|
54
|
+
|
|
55
|
+
- name: restart systemd service if it exists
|
|
56
|
+
service:
|
|
57
|
+
state: restarted
|
|
58
|
+
name: ntpd.service
|
|
59
|
+
when: ansible_facts['services']['ntpd.service']['status'] | default('not-found') != 'not-found'
|
|
60
|
+
|
|
48
61
|
'''
|
|
49
62
|
|
|
50
63
|
RETURN = r'''
|
|
@@ -250,7 +263,7 @@ class SystemctlScanService(BaseService):
|
|
|
250
263
|
def _list_from_units(self, systemctl_path, services):
|
|
251
264
|
|
|
252
265
|
# list units as systemd sees them
|
|
253
|
-
rc, stdout, stderr = self.module.run_command("%s list-units --no-pager --type service --all" % systemctl_path, use_unsafe_shell=True)
|
|
266
|
+
rc, stdout, stderr = self.module.run_command("%s list-units --no-pager --type service --all --plain" % systemctl_path, use_unsafe_shell=True)
|
|
254
267
|
if rc != 0:
|
|
255
268
|
self.module.warn("Could not list units from systemd: %s" % stderr)
|
|
256
269
|
else:
|
|
@@ -259,16 +272,18 @@ class SystemctlScanService(BaseService):
|
|
|
259
272
|
state_val = "stopped"
|
|
260
273
|
status_val = "unknown"
|
|
261
274
|
fields = line.split()
|
|
275
|
+
|
|
276
|
+
# systemd sometimes gives misleading status
|
|
277
|
+
# check all fields for bad states
|
|
262
278
|
for bad in self.BAD_STATES:
|
|
263
|
-
|
|
279
|
+
# except description
|
|
280
|
+
if bad in fields[:-1]:
|
|
264
281
|
status_val = bad
|
|
265
|
-
fields = fields[1:]
|
|
266
282
|
break
|
|
267
283
|
else:
|
|
268
284
|
# active/inactive
|
|
269
285
|
status_val = fields[2]
|
|
270
286
|
|
|
271
|
-
# array is normalize so predictable now
|
|
272
287
|
service_name = fields[0]
|
|
273
288
|
if fields[3] == "running":
|
|
274
289
|
state_val = "running"
|
|
@@ -364,7 +379,7 @@ class OpenBSDScanService(BaseService):
|
|
|
364
379
|
if variable == '' or '=' not in variable:
|
|
365
380
|
continue
|
|
366
381
|
else:
|
|
367
|
-
k, v = variable.replace(undy, '', 1).split('=')
|
|
382
|
+
k, v = variable.replace(undy, '', 1).split('=', 1)
|
|
368
383
|
info[k] = v
|
|
369
384
|
return info
|
|
370
385
|
|
ansible/modules/set_stats.py
CHANGED
ansible/modules/setup.py
CHANGED
|
@@ -25,10 +25,10 @@ options:
|
|
|
25
25
|
V(processor_count), V(python), V(python_version), V(real_user_id), V(selinux), V(service_mgr),
|
|
26
26
|
V(ssh_host_key_dsa_public), V(ssh_host_key_ecdsa_public), V(ssh_host_key_ed25519_public),
|
|
27
27
|
V(ssh_host_key_rsa_public), V(ssh_host_pub_keys), V(ssh_pub_keys), V(system), V(system_capabilities),
|
|
28
|
-
V(system_capabilities_enforced), V(user), V(user_dir), V(user_gecos), V(user_gid), V(user_id),
|
|
28
|
+
V(system_capabilities_enforced), V(systemd), V(user), V(user_dir), V(user_gecos), V(user_gid), V(user_id),
|
|
29
29
|
V(user_shell), V(user_uid), V(virtual), V(virtualization_role), V(virtualization_type).
|
|
30
|
-
|
|
31
|
-
|
|
30
|
+
Can specify a list of values to specify a larger subset.
|
|
31
|
+
Values can also be used with an initial C(!) to specify that
|
|
32
32
|
that specific subset should not be collected. For instance:
|
|
33
33
|
V(!hardware,!network,!virtual,!ohai,!facter). If V(!all) is specified
|
|
34
34
|
then only the min subset is collected. To avoid collecting even the
|
ansible/modules/stat.py
CHANGED
|
@@ -11,7 +11,7 @@ module: stat
|
|
|
11
11
|
version_added: "1.3"
|
|
12
12
|
short_description: Retrieve file or file system status
|
|
13
13
|
description:
|
|
14
|
-
- Retrieves facts for a file similar to the Linux/Unix
|
|
14
|
+
- Retrieves facts for a file similar to the Linux/Unix C(stat) command.
|
|
15
15
|
- For Windows targets, use the M(ansible.windows.win_stat) module instead.
|
|
16
16
|
options:
|
|
17
17
|
path:
|
|
@@ -44,8 +44,8 @@ options:
|
|
|
44
44
|
version_added: "2.0"
|
|
45
45
|
get_mime:
|
|
46
46
|
description:
|
|
47
|
-
- Use file magic and return data about the nature of the file.
|
|
48
|
-
the
|
|
47
|
+
- Use file magic and return data about the nature of the file. This uses
|
|
48
|
+
the C(file) utility found on most Linux/Unix systems.
|
|
49
49
|
- This will add both RV(stat.mimetype) and RV(stat.charset) fields to the return, if possible.
|
|
50
50
|
- In Ansible 2.3 this option changed from O(mime) to O(get_mime) and the default changed to V(true).
|
|
51
51
|
type: bool
|
ansible/modules/subversion.py
CHANGED
|
@@ -42,7 +42,7 @@ options:
|
|
|
42
42
|
in_place:
|
|
43
43
|
description:
|
|
44
44
|
- If the directory exists, then the working copy will be checked-out over-the-top using
|
|
45
|
-
svn checkout --force; if force is specified then existing files with different content are reverted.
|
|
45
|
+
C(svn checkout --force); if force is specified then existing files with different content are reverted.
|
|
46
46
|
type: bool
|
|
47
47
|
default: "no"
|
|
48
48
|
version_added: "2.6"
|