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
|
@@ -6,7 +6,6 @@
|
|
|
6
6
|
|
|
7
7
|
from __future__ import annotations
|
|
8
8
|
|
|
9
|
-
|
|
10
9
|
DOCUMENTATION = '''
|
|
11
10
|
---
|
|
12
11
|
module: yum_repository
|
|
@@ -23,9 +22,11 @@ options:
|
|
|
23
22
|
- If set to V(true) Yum will download packages and metadata from this
|
|
24
23
|
repo in parallel, if possible.
|
|
25
24
|
- In ansible-core 2.11, 2.12, and 2.13 the default value is V(true).
|
|
26
|
-
- This option has been
|
|
27
|
-
versions listed above, you can set this option to
|
|
25
|
+
- This option has been removed in RHEL 8. If you're using one of the
|
|
26
|
+
versions listed above, you can set this option to V(null) to avoid passing an
|
|
28
27
|
unknown configuration option.
|
|
28
|
+
- This parameter is deprecated as it has been removed on systems supported by ansible-core
|
|
29
|
+
and will be removed in ansible-core 2.22.
|
|
29
30
|
type: bool
|
|
30
31
|
bandwidth:
|
|
31
32
|
description:
|
|
@@ -50,6 +51,13 @@ options:
|
|
|
50
51
|
- Relative cost of accessing this repository. Useful for weighing one
|
|
51
52
|
repo's packages as greater/less than any other.
|
|
52
53
|
type: str
|
|
54
|
+
countme:
|
|
55
|
+
description:
|
|
56
|
+
- Whether a special flag should be added to a randomly chosen metalink/mirrorlist query each week.
|
|
57
|
+
This allows the repository owner to estimate the number of systems consuming it.
|
|
58
|
+
default: ~
|
|
59
|
+
type: bool
|
|
60
|
+
version_added: '2.18'
|
|
53
61
|
deltarpm_metadata_percentage:
|
|
54
62
|
description:
|
|
55
63
|
- When the relative size of deltarpm metadata vs pkgs is larger than
|
|
@@ -57,6 +65,8 @@ options:
|
|
|
57
65
|
can give values over V(100), so V(200) means that the metadata is
|
|
58
66
|
required to be half the size of the packages. Use V(0) to turn off
|
|
59
67
|
this check, and always download metadata.
|
|
68
|
+
- This parameter is deprecated as it has no effect with dnf as an underlying package manager
|
|
69
|
+
and will be removed in ansible-core 2.22.
|
|
60
70
|
type: str
|
|
61
71
|
deltarpm_percentage:
|
|
62
72
|
description:
|
|
@@ -66,8 +76,8 @@ options:
|
|
|
66
76
|
type: str
|
|
67
77
|
description:
|
|
68
78
|
description:
|
|
69
|
-
- A human-readable string describing the repository. This option corresponds to the
|
|
70
|
-
- This parameter is only required if O(state
|
|
79
|
+
- A human-readable string describing the repository. This option corresponds to the C(name) property in the repo file.
|
|
80
|
+
- This parameter is only required if O(state=present).
|
|
71
81
|
type: str
|
|
72
82
|
enabled:
|
|
73
83
|
description:
|
|
@@ -86,8 +96,11 @@ options:
|
|
|
86
96
|
space separated list. Shell globs using wildcards (for example V(*) and V(?))
|
|
87
97
|
are allowed.
|
|
88
98
|
- The list can also be a regular YAML array.
|
|
99
|
+
- O(excludepkgs) alias was added in ansible-core 2.18.
|
|
89
100
|
type: list
|
|
90
101
|
elements: str
|
|
102
|
+
aliases:
|
|
103
|
+
- excludepkgs
|
|
91
104
|
failovermethod:
|
|
92
105
|
choices: [roundrobin, priority]
|
|
93
106
|
description:
|
|
@@ -105,6 +118,8 @@ options:
|
|
|
105
118
|
gpgcakey:
|
|
106
119
|
description:
|
|
107
120
|
- A URL pointing to the ASCII-armored CA key file for the repository.
|
|
121
|
+
- This parameter is deprecated as it has no effect with dnf as an underlying package manager
|
|
122
|
+
and will be removed in ansible-core 2.22.
|
|
108
123
|
type: str
|
|
109
124
|
gpgcheck:
|
|
110
125
|
description:
|
|
@@ -122,7 +137,7 @@ options:
|
|
|
122
137
|
module_hotfixes:
|
|
123
138
|
description:
|
|
124
139
|
- Disable module RPM filtering and make all RPMs from the repository
|
|
125
|
-
available. The default is V(
|
|
140
|
+
available. The default is V(null).
|
|
126
141
|
version_added: '2.11'
|
|
127
142
|
type: bool
|
|
128
143
|
http_caching:
|
|
@@ -133,6 +148,8 @@ options:
|
|
|
133
148
|
- V(packages) means that only RPM package downloads should be cached (but
|
|
134
149
|
not repository metadata downloads).
|
|
135
150
|
- V(none) means that no HTTP downloads should be cached.
|
|
151
|
+
- This parameter is deprecated as it has no effect with dnf as an underlying package manager
|
|
152
|
+
and will be removed in ansible-core 2.22.
|
|
136
153
|
choices: [all, packages, none]
|
|
137
154
|
type: str
|
|
138
155
|
include:
|
|
@@ -163,12 +180,15 @@ options:
|
|
|
163
180
|
- This tells yum whether or not HTTP/1.1 keepalive should be used with
|
|
164
181
|
this repository. This can improve transfer speeds by using one
|
|
165
182
|
connection when downloading multiple files from a repository.
|
|
183
|
+
- This parameter is deprecated as it has no effect with dnf as an underlying package manager
|
|
184
|
+
and will be removed in ansible-core 2.22.
|
|
166
185
|
type: bool
|
|
167
186
|
keepcache:
|
|
168
187
|
description:
|
|
169
188
|
- Either V(1) or V(0). Determines whether or not yum keeps the cache of
|
|
170
189
|
headers and packages after successful installation.
|
|
171
|
-
- This parameter is deprecated
|
|
190
|
+
- This parameter is deprecated as it is only valid in the main configuration
|
|
191
|
+
and will be removed in ansible-core 2.20.
|
|
172
192
|
choices: ['0', '1']
|
|
173
193
|
type: str
|
|
174
194
|
metadata_expire:
|
|
@@ -193,7 +213,9 @@ options:
|
|
|
193
213
|
- V(read-only:future) - Commands that are likely to result in running
|
|
194
214
|
other commands which will require the latest metadata. Eg.
|
|
195
215
|
C(yum check-update).
|
|
196
|
-
- Note that this option does not override
|
|
216
|
+
- Note that this option does not override C(yum clean expire-cache).
|
|
217
|
+
- This parameter is deprecated as it has no effect with dnf as an underlying package manager
|
|
218
|
+
and will be removed in ansible-core 2.22.
|
|
197
219
|
choices: [never, 'read-only:past', 'read-only:present', 'read-only:future']
|
|
198
220
|
type: str
|
|
199
221
|
metalink:
|
|
@@ -215,6 +237,8 @@ options:
|
|
|
215
237
|
- Time (in seconds) after which the mirrorlist locally cached will
|
|
216
238
|
expire.
|
|
217
239
|
- Default value is 6 hours.
|
|
240
|
+
- This parameter is deprecated as it has no effect with dnf as an underlying package manager
|
|
241
|
+
and will be removed in ansible-core 2.22.
|
|
218
242
|
type: str
|
|
219
243
|
name:
|
|
220
244
|
description:
|
|
@@ -236,6 +260,8 @@ options:
|
|
|
236
260
|
protect:
|
|
237
261
|
description:
|
|
238
262
|
- Protect packages from updates from other repositories.
|
|
263
|
+
- This parameter is deprecated as it has no effect with dnf as an underlying package manager
|
|
264
|
+
and will be removed in ansible-core 2.22.
|
|
239
265
|
type: bool
|
|
240
266
|
proxy:
|
|
241
267
|
description:
|
|
@@ -284,6 +310,8 @@ options:
|
|
|
284
310
|
O(skip_if_unavailable) to be V(true). This is most useful for non-root
|
|
285
311
|
processes which use yum on repos that have client cert files which are
|
|
286
312
|
readable only by root.
|
|
313
|
+
- This parameter is deprecated as it has no effect with dnf as an underlying package manager
|
|
314
|
+
and will be removed in ansible-core 2.22.
|
|
287
315
|
type: bool
|
|
288
316
|
sslcacert:
|
|
289
317
|
description:
|
|
@@ -329,6 +357,8 @@ options:
|
|
|
329
357
|
- When a repository id is displayed, append these yum variables to the
|
|
330
358
|
string if they are used in the O(baseurl)/etc. Variables are appended
|
|
331
359
|
in the order listed (and found).
|
|
360
|
+
- This parameter is deprecated as it has no effect with dnf as an underlying package manager
|
|
361
|
+
and will be removed in ansible-core 2.22.
|
|
332
362
|
type: str
|
|
333
363
|
username:
|
|
334
364
|
description:
|
|
@@ -412,158 +442,86 @@ state:
|
|
|
412
442
|
sample: "present"
|
|
413
443
|
'''
|
|
414
444
|
|
|
445
|
+
import configparser
|
|
415
446
|
import os
|
|
416
447
|
|
|
417
|
-
from ansible.module_utils.basic import AnsibleModule
|
|
418
|
-
from ansible.module_utils.six.moves import configparser
|
|
448
|
+
from ansible.module_utils.basic import AnsibleModule, FILE_COMMON_ARGUMENTS
|
|
419
449
|
from ansible.module_utils.common.text.converters import to_native
|
|
420
450
|
|
|
421
451
|
|
|
422
|
-
class YumRepo
|
|
423
|
-
|
|
424
|
-
module = None
|
|
425
|
-
params = None
|
|
426
|
-
section = None
|
|
427
|
-
repofile = configparser.RawConfigParser()
|
|
428
|
-
|
|
429
|
-
# List of parameters which will be allowed in the repo file output
|
|
430
|
-
allowed_params = [
|
|
431
|
-
'async',
|
|
432
|
-
'bandwidth',
|
|
433
|
-
'baseurl',
|
|
434
|
-
'cost',
|
|
435
|
-
'deltarpm_metadata_percentage',
|
|
436
|
-
'deltarpm_percentage',
|
|
437
|
-
'enabled',
|
|
438
|
-
'enablegroups',
|
|
439
|
-
'exclude',
|
|
440
|
-
'failovermethod',
|
|
441
|
-
'gpgcakey',
|
|
442
|
-
'gpgcheck',
|
|
443
|
-
'gpgkey',
|
|
444
|
-
'module_hotfixes',
|
|
445
|
-
'http_caching',
|
|
446
|
-
'include',
|
|
447
|
-
'includepkgs',
|
|
448
|
-
'ip_resolve',
|
|
449
|
-
'keepalive',
|
|
450
|
-
'keepcache',
|
|
451
|
-
'metadata_expire',
|
|
452
|
-
'metadata_expire_filter',
|
|
453
|
-
'metalink',
|
|
454
|
-
'mirrorlist',
|
|
455
|
-
'mirrorlist_expire',
|
|
456
|
-
'name',
|
|
457
|
-
'password',
|
|
458
|
-
'priority',
|
|
459
|
-
'protect',
|
|
460
|
-
'proxy',
|
|
461
|
-
'proxy_password',
|
|
462
|
-
'proxy_username',
|
|
463
|
-
'repo_gpgcheck',
|
|
464
|
-
'retries',
|
|
465
|
-
's3_enabled',
|
|
466
|
-
'skip_if_unavailable',
|
|
467
|
-
'sslcacert',
|
|
468
|
-
'ssl_check_cert_permissions',
|
|
469
|
-
'sslclientcert',
|
|
470
|
-
'sslclientkey',
|
|
471
|
-
'sslverify',
|
|
472
|
-
'throttle',
|
|
473
|
-
'timeout',
|
|
474
|
-
'ui_repoid_vars',
|
|
475
|
-
'username']
|
|
476
|
-
|
|
477
|
-
# List of parameters which can be a list
|
|
478
|
-
list_params = ['exclude', 'includepkgs']
|
|
479
|
-
|
|
480
|
-
def __init__(self, module):
|
|
481
|
-
# To be able to use fail_json
|
|
452
|
+
class YumRepo:
|
|
453
|
+
def __init__(self, module, params, repoid, dest):
|
|
482
454
|
self.module = module
|
|
483
|
-
|
|
484
|
-
self.
|
|
485
|
-
|
|
486
|
-
self.
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
repos_dir = self.params['reposdir']
|
|
490
|
-
if not os.path.isdir(repos_dir):
|
|
491
|
-
self.module.fail_json(
|
|
492
|
-
msg="Repo directory '%s' does not exist." % repos_dir)
|
|
493
|
-
|
|
494
|
-
# Set dest; also used to set dest parameter for the FS attributes
|
|
495
|
-
self.params['dest'] = os.path.join(
|
|
496
|
-
repos_dir, "%s.repo" % self.params['file'])
|
|
497
|
-
|
|
498
|
-
# Read the repo file if it exists
|
|
499
|
-
if os.path.isfile(self.params['dest']):
|
|
500
|
-
self.repofile.read(self.params['dest'])
|
|
455
|
+
self.params = params
|
|
456
|
+
self.section = repoid
|
|
457
|
+
self.repofile = configparser.RawConfigParser()
|
|
458
|
+
self.dest = dest
|
|
459
|
+
if os.path.isfile(dest):
|
|
460
|
+
self.repofile.read(dest)
|
|
501
461
|
|
|
502
462
|
def add(self):
|
|
503
|
-
|
|
504
|
-
if self.repofile.has_section(self.section):
|
|
505
|
-
self.repofile.remove_section(self.section)
|
|
506
|
-
|
|
507
|
-
# Add section
|
|
463
|
+
self.remove()
|
|
508
464
|
self.repofile.add_section(self.section)
|
|
509
465
|
|
|
510
|
-
# Baseurl/mirrorlist is not required because for removal we need only
|
|
511
|
-
# the repo name. This is why we check if the baseurl/mirrorlist is
|
|
512
|
-
# defined.
|
|
513
|
-
req_params = (self.params['baseurl'], self.params['metalink'], self.params['mirrorlist'])
|
|
514
|
-
if req_params == (None, None, None):
|
|
515
|
-
self.module.fail_json(
|
|
516
|
-
msg="Parameter 'baseurl', 'metalink' or 'mirrorlist' is required for "
|
|
517
|
-
"adding a new repo.")
|
|
518
|
-
|
|
519
|
-
# Set options
|
|
520
466
|
for key, value in sorted(self.params.items()):
|
|
521
|
-
if
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
467
|
+
if value is None:
|
|
468
|
+
continue
|
|
469
|
+
if key == 'keepcache':
|
|
470
|
+
self.module.deprecate(
|
|
471
|
+
"'keepcache' parameter is deprecated as it is only valid in "
|
|
472
|
+
"the main configuration.",
|
|
473
|
+
version='2.20'
|
|
474
|
+
)
|
|
475
|
+
elif key == 'async':
|
|
476
|
+
self.module.deprecate(
|
|
477
|
+
"'async' parameter is deprecated as it has been removed on systems supported by ansible-core",
|
|
478
|
+
version='2.22',
|
|
479
|
+
)
|
|
480
|
+
elif key in {
|
|
481
|
+
"deltarpm_metadata_percentage",
|
|
482
|
+
"gpgcakey",
|
|
483
|
+
"http_caching",
|
|
484
|
+
"keepalive",
|
|
485
|
+
"metadata_expire_filter",
|
|
486
|
+
"mirrorlist_expire",
|
|
487
|
+
"protect",
|
|
488
|
+
"ssl_check_cert_permissions",
|
|
489
|
+
"ui_repoid_vars",
|
|
490
|
+
}:
|
|
491
|
+
self.module.deprecate(
|
|
492
|
+
f"'{key}' parameter is deprecated as it has no effect with dnf "
|
|
493
|
+
"as an underlying package manager.",
|
|
494
|
+
version='2.22'
|
|
495
|
+
)
|
|
496
|
+
if isinstance(value, bool):
|
|
497
|
+
value = str(int(value))
|
|
498
|
+
self.repofile.set(self.section, key, value)
|
|
536
499
|
|
|
537
500
|
def save(self):
|
|
538
|
-
if
|
|
539
|
-
# Write data into the file
|
|
501
|
+
if self.repofile.sections():
|
|
540
502
|
try:
|
|
541
|
-
with open(self.
|
|
503
|
+
with open(self.dest, 'w') as fd:
|
|
542
504
|
self.repofile.write(fd)
|
|
543
505
|
except IOError as e:
|
|
544
506
|
self.module.fail_json(
|
|
545
|
-
msg="Problems handling file
|
|
546
|
-
details=to_native(e)
|
|
507
|
+
msg=f"Problems handling file {self.dest}.",
|
|
508
|
+
details=to_native(e),
|
|
509
|
+
)
|
|
547
510
|
else:
|
|
548
|
-
# Remove the file if there are not repos
|
|
549
511
|
try:
|
|
550
|
-
os.remove(self.
|
|
512
|
+
os.remove(self.dest)
|
|
551
513
|
except OSError as e:
|
|
552
514
|
self.module.fail_json(
|
|
553
|
-
msg=
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
details=to_native(e))
|
|
515
|
+
msg=f"Cannot remove empty repo file {self.dest}.",
|
|
516
|
+
details=to_native(e),
|
|
517
|
+
)
|
|
557
518
|
|
|
558
519
|
def remove(self):
|
|
559
|
-
|
|
560
|
-
if self.repofile.has_section(self.section):
|
|
561
|
-
self.repofile.remove_section(self.section)
|
|
520
|
+
self.repofile.remove_section(self.section)
|
|
562
521
|
|
|
563
522
|
def dump(self):
|
|
564
523
|
repo_string = ""
|
|
565
524
|
|
|
566
|
-
# Compose the repo file
|
|
567
525
|
for section in sorted(self.repofile.sections()):
|
|
568
526
|
repo_string += "[%s]\n" % section
|
|
569
527
|
|
|
@@ -576,17 +534,17 @@ class YumRepo(object):
|
|
|
576
534
|
|
|
577
535
|
|
|
578
536
|
def main():
|
|
579
|
-
# Module settings
|
|
580
537
|
argument_spec = dict(
|
|
581
538
|
bandwidth=dict(),
|
|
582
539
|
baseurl=dict(type='list', elements='str'),
|
|
583
540
|
cost=dict(),
|
|
541
|
+
countme=dict(type='bool'),
|
|
584
542
|
deltarpm_metadata_percentage=dict(),
|
|
585
543
|
deltarpm_percentage=dict(),
|
|
586
544
|
description=dict(),
|
|
587
545
|
enabled=dict(type='bool'),
|
|
588
546
|
enablegroups=dict(type='bool'),
|
|
589
|
-
exclude=dict(type='list', elements='str'),
|
|
547
|
+
exclude=dict(type='list', elements='str', aliases=['excludepkgs']),
|
|
590
548
|
failovermethod=dict(choices=['roundrobin', 'priority']),
|
|
591
549
|
file=dict(),
|
|
592
550
|
gpgcakey=dict(no_log=False),
|
|
@@ -633,78 +591,77 @@ def main():
|
|
|
633
591
|
username=dict(),
|
|
634
592
|
)
|
|
635
593
|
|
|
594
|
+
# async is a Python keyword
|
|
636
595
|
argument_spec['async'] = dict(type='bool')
|
|
637
596
|
|
|
638
597
|
module = AnsibleModule(
|
|
598
|
+
required_if=[
|
|
599
|
+
["state", "present", ["baseurl", "mirrorlist", "metalink"], True],
|
|
600
|
+
["state", "present", ["description"]],
|
|
601
|
+
],
|
|
639
602
|
argument_spec=argument_spec,
|
|
640
603
|
add_file_common_args=True,
|
|
641
604
|
supports_check_mode=True,
|
|
642
605
|
)
|
|
643
606
|
|
|
644
|
-
|
|
645
|
-
|
|
607
|
+
# make copy of params as we need to split them into yum repo only and file params
|
|
608
|
+
yum_repo_params = module.params.copy()
|
|
609
|
+
for alias in module.aliases:
|
|
610
|
+
yum_repo_params.pop(alias, None)
|
|
611
|
+
|
|
612
|
+
file_common_params = {}
|
|
613
|
+
for param in FILE_COMMON_ARGUMENTS:
|
|
614
|
+
file_common_params[param] = yum_repo_params.pop(param)
|
|
615
|
+
|
|
616
|
+
state = yum_repo_params.pop("state")
|
|
617
|
+
name = yum_repo_params['name']
|
|
618
|
+
yum_repo_params['name'] = yum_repo_params.pop('description')
|
|
619
|
+
|
|
620
|
+
for list_param in ('baseurl', 'gpgkey'):
|
|
621
|
+
v = yum_repo_params[list_param]
|
|
622
|
+
if v is not None:
|
|
623
|
+
yum_repo_params[list_param] = '\n'.join(v)
|
|
624
|
+
|
|
625
|
+
for list_param in ('exclude', 'includepkgs'):
|
|
626
|
+
v = yum_repo_params[list_param]
|
|
627
|
+
if v is not None:
|
|
628
|
+
yum_repo_params[list_param] = ' '.join(v)
|
|
629
|
+
|
|
630
|
+
repos_dir = yum_repo_params.pop("reposdir")
|
|
631
|
+
if not os.path.isdir(repos_dir):
|
|
632
|
+
module.fail_json(
|
|
633
|
+
msg="Repo directory '%s' does not exist." % repos_dir
|
|
634
|
+
)
|
|
635
|
+
|
|
636
|
+
if (file := yum_repo_params.pop("file")) is None:
|
|
637
|
+
file = name
|
|
638
|
+
file_common_params["dest"] = os.path.join(repos_dir, f"{file}.repo")
|
|
639
|
+
|
|
640
|
+
yumrepo = YumRepo(module, yum_repo_params, name, file_common_params["dest"])
|
|
646
641
|
|
|
647
|
-
# Check if required parameters are present
|
|
648
|
-
if state == 'present':
|
|
649
|
-
if (
|
|
650
|
-
module.params['baseurl'] is None and
|
|
651
|
-
module.params['metalink'] is None and
|
|
652
|
-
module.params['mirrorlist'] is None):
|
|
653
|
-
module.fail_json(
|
|
654
|
-
msg="Parameter 'baseurl', 'metalink' or 'mirrorlist' is required.")
|
|
655
|
-
if module.params['description'] is None:
|
|
656
|
-
module.fail_json(
|
|
657
|
-
msg="Parameter 'description' is required.")
|
|
658
|
-
|
|
659
|
-
# Rename "name" and "description" to ensure correct key sorting
|
|
660
|
-
module.params['repoid'] = module.params['name']
|
|
661
|
-
module.params['name'] = module.params['description']
|
|
662
|
-
del module.params['description']
|
|
663
|
-
|
|
664
|
-
# Change list type to string for baseurl and gpgkey
|
|
665
|
-
for list_param in ['baseurl', 'gpgkey']:
|
|
666
|
-
if (
|
|
667
|
-
list_param in module.params and
|
|
668
|
-
module.params[list_param] is not None):
|
|
669
|
-
module.params[list_param] = "\n".join(module.params[list_param])
|
|
670
|
-
|
|
671
|
-
# Define repo file name if it doesn't exist
|
|
672
|
-
if module.params['file'] is None:
|
|
673
|
-
module.params['file'] = module.params['repoid']
|
|
674
|
-
|
|
675
|
-
# Instantiate the YumRepo object
|
|
676
|
-
yumrepo = YumRepo(module)
|
|
677
|
-
|
|
678
|
-
# Get repo status before change
|
|
679
642
|
diff = {
|
|
680
|
-
'before_header':
|
|
643
|
+
'before_header': file_common_params["dest"],
|
|
681
644
|
'before': yumrepo.dump(),
|
|
682
|
-
'after_header':
|
|
645
|
+
'after_header': file_common_params["dest"],
|
|
683
646
|
'after': ''
|
|
684
647
|
}
|
|
685
648
|
|
|
686
|
-
# Perform action depending on the state
|
|
687
649
|
if state == 'present':
|
|
688
650
|
yumrepo.add()
|
|
689
651
|
elif state == 'absent':
|
|
690
652
|
yumrepo.remove()
|
|
691
653
|
|
|
692
|
-
# Get repo status after change
|
|
693
654
|
diff['after'] = yumrepo.dump()
|
|
694
655
|
|
|
695
|
-
# Compare repo states
|
|
696
656
|
changed = diff['before'] != diff['after']
|
|
697
657
|
|
|
698
|
-
# Save the file only if not in check mode and if there was a change
|
|
699
658
|
if not module.check_mode and changed:
|
|
700
659
|
yumrepo.save()
|
|
701
660
|
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
file_args = module.load_file_common_arguments(module.params)
|
|
661
|
+
if os.path.isfile(file_common_params["dest"]):
|
|
662
|
+
file_args = module.load_file_common_arguments(file_common_params)
|
|
705
663
|
changed = module.set_fs_attributes_if_different(file_args, changed)
|
|
706
664
|
|
|
707
|
-
# Print status of the change
|
|
708
665
|
module.exit_json(changed=changed, repo=name, state=state, diff=diff)
|
|
709
666
|
|
|
710
667
|
|
ansible/parsing/dataloader.py
CHANGED
|
@@ -18,7 +18,7 @@ from ansible.module_utils.six import binary_type, text_type
|
|
|
18
18
|
from ansible.module_utils.common.text.converters import to_bytes, to_native, to_text
|
|
19
19
|
from ansible.parsing.quoting import unquote
|
|
20
20
|
from ansible.parsing.utils.yaml import from_yaml
|
|
21
|
-
from ansible.parsing.vault import VaultLib,
|
|
21
|
+
from ansible.parsing.vault import VaultLib, is_encrypted, is_encrypted_file, parse_vaulttext_envelope, PromptVaultSecret
|
|
22
22
|
from ansible.utils.path import unfrackpath
|
|
23
23
|
from ansible.utils.display import Display
|
|
24
24
|
|
|
@@ -388,7 +388,7 @@ class DataLoader:
|
|
|
388
388
|
# Limit how much of the file is read since we do not know
|
|
389
389
|
# whether this is a vault file and therefore it could be very
|
|
390
390
|
# large.
|
|
391
|
-
if is_encrypted_file(f
|
|
391
|
+
if is_encrypted_file(f):
|
|
392
392
|
# if the file is encrypted and no password was specified,
|
|
393
393
|
# the decrypt call would throw an error, but we check first
|
|
394
394
|
# since the decrypt function doesn't know the file name
|
ansible/parsing/mod_args.py
CHANGED
|
@@ -28,11 +28,8 @@ from ansible.utils.fqcn import add_internal_fqcns
|
|
|
28
28
|
from ansible.utils.sentinel import Sentinel
|
|
29
29
|
|
|
30
30
|
|
|
31
|
-
#
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
RAW_PARAM_MODULES = FREEFORM_ACTIONS.union(add_internal_fqcns((
|
|
35
|
-
'include',
|
|
31
|
+
# modules formated for user msg
|
|
32
|
+
_BUILTIN_RAW_PARAM_MODULES_SIMPLE = set([
|
|
36
33
|
'include_vars',
|
|
37
34
|
'include_tasks',
|
|
38
35
|
'include_role',
|
|
@@ -42,8 +39,12 @@ RAW_PARAM_MODULES = FREEFORM_ACTIONS.union(add_internal_fqcns((
|
|
|
42
39
|
'group_by',
|
|
43
40
|
'set_fact',
|
|
44
41
|
'meta',
|
|
45
|
-
)
|
|
46
|
-
|
|
42
|
+
])
|
|
43
|
+
FREEFORM_ACTIONS_SIMPLE = set(C.MODULE_REQUIRE_ARGS_SIMPLE)
|
|
44
|
+
FREEFORM_ACTIONS = frozenset(C.MODULE_REQUIRE_ARGS)
|
|
45
|
+
RAW_PARAM_MODULES_SIMPLE = _BUILTIN_RAW_PARAM_MODULES_SIMPLE.union(FREEFORM_ACTIONS_SIMPLE)
|
|
46
|
+
# For filtering out modules correctly below, use all permutations
|
|
47
|
+
RAW_PARAM_MODULES = frozenset(add_internal_fqcns(RAW_PARAM_MODULES_SIMPLE)).union(FREEFORM_ACTIONS)
|
|
47
48
|
BUILTIN_TASKS = frozenset(add_internal_fqcns((
|
|
48
49
|
'meta',
|
|
49
50
|
'include_tasks',
|
|
@@ -358,8 +359,8 @@ class ModuleArgsParser:
|
|
|
358
359
|
if templar.is_template(raw_params):
|
|
359
360
|
args['_variable_params'] = raw_params
|
|
360
361
|
else:
|
|
361
|
-
raise AnsibleParserError(
|
|
362
|
-
|
|
363
|
-
|
|
362
|
+
raise AnsibleParserError(
|
|
363
|
+
"this task '%s' has extra params, which is only allowed in the following modules: %s" % (action, ", ".join(RAW_PARAM_MODULES_SIMPLE)),
|
|
364
|
+
obj=self._task_ds)
|
|
364
365
|
|
|
365
366
|
return (action, args, delegate_to)
|
|
@@ -103,15 +103,17 @@ def is_encrypted(data):
|
|
|
103
103
|
return False
|
|
104
104
|
|
|
105
105
|
|
|
106
|
-
def is_encrypted_file(file_obj, start_pos=0, count
|
|
106
|
+
def is_encrypted_file(file_obj, start_pos=0, count=len(b_HEADER)):
|
|
107
107
|
"""Test if the contents of a file obj are a vault encrypted data blob.
|
|
108
108
|
|
|
109
109
|
:arg file_obj: A file object that will be read from.
|
|
110
110
|
:kwarg start_pos: A byte offset in the file to start reading the header
|
|
111
111
|
from. Defaults to 0, the beginning of the file.
|
|
112
112
|
:kwarg count: Read up to this number of bytes from the file to determine
|
|
113
|
-
if it looks like encrypted vault data.
|
|
114
|
-
|
|
113
|
+
if it looks like encrypted vault data. The default is the size of the
|
|
114
|
+
the vault header, which is what is needed most times.
|
|
115
|
+
For some IO classes, or files that don't begin with the vault itself,
|
|
116
|
+
set to -1 to read to the end of file.
|
|
115
117
|
:returns: True if the file looks like a vault file. Otherwise, False.
|
|
116
118
|
"""
|
|
117
119
|
# read the header and reset the file stream to where it started
|
|
@@ -357,6 +359,9 @@ def get_file_vault_secret(filename=None, vault_id=None, encoding=None, loader=No
|
|
|
357
359
|
if not os.path.exists(this_path):
|
|
358
360
|
raise AnsibleError("The vault password file %s was not found" % this_path)
|
|
359
361
|
|
|
362
|
+
if os.path.isdir(this_path):
|
|
363
|
+
raise AnsibleError(f"The vault password file provided '{this_path}' can not be a directory")
|
|
364
|
+
|
|
360
365
|
# it is a script?
|
|
361
366
|
if loader.is_executable(this_path):
|
|
362
367
|
|
|
@@ -147,30 +147,32 @@ class AnsibleConstructor(SafeConstructor):
|
|
|
147
147
|
|
|
148
148
|
AnsibleConstructor.add_constructor(
|
|
149
149
|
u'tag:yaml.org,2002:map',
|
|
150
|
-
AnsibleConstructor.construct_yaml_map)
|
|
150
|
+
AnsibleConstructor.construct_yaml_map) # type: ignore[type-var]
|
|
151
151
|
|
|
152
152
|
AnsibleConstructor.add_constructor(
|
|
153
153
|
u'tag:yaml.org,2002:python/dict',
|
|
154
|
-
AnsibleConstructor.construct_yaml_map)
|
|
154
|
+
AnsibleConstructor.construct_yaml_map) # type: ignore[type-var]
|
|
155
155
|
|
|
156
156
|
AnsibleConstructor.add_constructor(
|
|
157
157
|
u'tag:yaml.org,2002:str',
|
|
158
|
-
AnsibleConstructor.construct_yaml_str)
|
|
158
|
+
AnsibleConstructor.construct_yaml_str) # type: ignore[type-var]
|
|
159
159
|
|
|
160
160
|
AnsibleConstructor.add_constructor(
|
|
161
161
|
u'tag:yaml.org,2002:python/unicode',
|
|
162
|
-
AnsibleConstructor.construct_yaml_str)
|
|
162
|
+
AnsibleConstructor.construct_yaml_str) # type: ignore[type-var]
|
|
163
163
|
|
|
164
164
|
AnsibleConstructor.add_constructor(
|
|
165
165
|
u'tag:yaml.org,2002:seq',
|
|
166
|
-
AnsibleConstructor.construct_yaml_seq)
|
|
166
|
+
AnsibleConstructor.construct_yaml_seq) # type: ignore[type-var]
|
|
167
167
|
|
|
168
168
|
AnsibleConstructor.add_constructor(
|
|
169
169
|
u'!unsafe',
|
|
170
|
-
AnsibleConstructor.construct_yaml_unsafe)
|
|
170
|
+
AnsibleConstructor.construct_yaml_unsafe) # type: ignore[type-var]
|
|
171
171
|
|
|
172
172
|
AnsibleConstructor.add_constructor(
|
|
173
173
|
u'!vault',
|
|
174
|
-
AnsibleConstructor.construct_vault_encrypted_unicode)
|
|
174
|
+
AnsibleConstructor.construct_vault_encrypted_unicode) # type: ignore[type-var]
|
|
175
175
|
|
|
176
|
-
AnsibleConstructor.add_constructor(
|
|
176
|
+
AnsibleConstructor.add_constructor(
|
|
177
|
+
u'!vault-encrypted',
|
|
178
|
+
AnsibleConstructor.construct_vault_encrypted_unicode) # type: ignore[type-var]
|
ansible/parsing/yaml/objects.py
CHANGED
|
@@ -122,7 +122,7 @@ class AnsibleVaultEncryptedUnicode(Sequence, AnsibleBaseYAMLObject):
|
|
|
122
122
|
return True
|
|
123
123
|
|
|
124
124
|
def __reversed__(self):
|
|
125
|
-
# This gets
|
|
125
|
+
# This gets inherited from ``collections.Sequence`` which returns a generator
|
|
126
126
|
# make this act more like the string implementation
|
|
127
127
|
return to_text(self[::-1], errors='surrogate_or_strict')
|
|
128
128
|
|