ansible-core 2.15.0__py3-none-any.whl → 2.15.2__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/config/manager.py +1 -1
- ansible/galaxy/collection/__init__.py +17 -30
- ansible/galaxy/collection/concrete_artifact_manager.py +12 -6
- ansible/galaxy/dependency_resolution/dataclasses.py +6 -3
- ansible/module_utils/ansible_release.py +1 -1
- ansible/modules/apt_key.py +8 -5
- ansible/modules/apt_repository.py +2 -0
- ansible/modules/deb822_repository.py +1 -1
- ansible/modules/dnf5.py +8 -8
- ansible/modules/find.py +3 -0
- ansible/modules/uri.py +9 -1
- ansible/modules/validate_argument_spec.py +1 -1
- ansible/plugins/action/template.py +26 -15
- ansible/plugins/connection/paramiko_ssh.py +8 -0
- ansible/plugins/connection/psrp.py +3 -3
- ansible/plugins/connection/ssh.py +19 -2
- ansible/plugins/filter/comment.yml +1 -1
- ansible/plugins/filter/split.yml +1 -1
- ansible/plugins/filter/to_yaml.yml +1 -1
- ansible/plugins/lookup/template.py +11 -6
- ansible/plugins/strategy/__init__.py +20 -12
- ansible/plugins/test/change.yml +1 -1
- ansible/plugins/test/changed.yml +1 -1
- ansible/plugins/test/reachable.yml +1 -1
- ansible/plugins/test/succeeded.yml +1 -1
- ansible/plugins/test/success.yml +1 -1
- ansible/plugins/test/successful.yml +1 -1
- ansible/plugins/test/unreachable.yml +1 -1
- ansible/release.py +1 -1
- ansible/template/__init__.py +42 -28
- ansible/utils/_junit_xml.py +5 -1
- {ansible_core-2.15.0.dist-info → ansible_core-2.15.2.dist-info}/METADATA +1 -1
- {ansible_core-2.15.0.dist-info → ansible_core-2.15.2.dist-info}/RECORD +61 -61
- ansible_test/_data/completion/remote.txt +2 -1
- ansible_test/_internal/__init__.py +11 -0
- ansible_test/_internal/cli/commands/env.py +1 -1
- ansible_test/_internal/commands/env/__init__.py +14 -17
- ansible_test/_internal/commands/integration/__init__.py +1 -1
- ansible_test/_internal/commands/integration/cloud/__init__.py +3 -3
- ansible_test/_internal/commands/sanity/pylint.py +4 -4
- ansible_test/_internal/commands/sanity/validate_modules.py +2 -2
- ansible_test/_internal/containers.py +2 -2
- ansible_test/_internal/coverage_util.py +2 -2
- ansible_test/_internal/data.py +2 -7
- ansible_test/_internal/git.py +1 -1
- ansible_test/_internal/junit_xml.py +5 -1
- ansible_test/_internal/payload.py +2 -2
- ansible_test/_internal/provider/layout/__init__.py +1 -1
- ansible_test/_internal/provider/layout/ansible.py +15 -0
- ansible_test/_internal/provider/layout/collection.py +9 -1
- ansible_test/_internal/provisioning.py +5 -2
- ansible_test/_internal/pypi_proxy.py +4 -4
- ansible_test/_internal/test.py +3 -5
- ansible_test/_internal/timeout.py +56 -19
- ansible_test/_internal/util.py +4 -0
- ansible_test/_internal/util_common.py +38 -6
- {ansible_core-2.15.0.data → ansible_core-2.15.2.data}/scripts/ansible-test +0 -0
- {ansible_core-2.15.0.dist-info → ansible_core-2.15.2.dist-info}/COPYING +0 -0
- {ansible_core-2.15.0.dist-info → ansible_core-2.15.2.dist-info}/WHEEL +0 -0
- {ansible_core-2.15.0.dist-info → ansible_core-2.15.2.dist-info}/entry_points.txt +0 -0
- {ansible_core-2.15.0.dist-info → ansible_core-2.15.2.dist-info}/top_level.txt +0 -0
ansible/config/manager.py
CHANGED
|
@@ -63,7 +63,7 @@ def ensure_type(value, value_type, origin=None):
|
|
|
63
63
|
:temppath: Same as 'tmppath'
|
|
64
64
|
:tmp: Same as 'tmppath'
|
|
65
65
|
:pathlist: Treat the value as a typical PATH string. (On POSIX, this
|
|
66
|
-
means
|
|
66
|
+
means comma separated strings.) Split the value and then expand
|
|
67
67
|
each part for environment variables and tildes.
|
|
68
68
|
:pathspec: Treat the value as a PATH string. Expands any environment variables
|
|
69
69
|
tildes's in the value.
|
|
@@ -283,11 +283,8 @@ def verify_local_collection(local_collection, remote_collection, artifacts_manag
|
|
|
283
283
|
manifest_hash = get_hash_from_validation_source(MANIFEST_FILENAME)
|
|
284
284
|
else:
|
|
285
285
|
# fetch remote
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
if remote_collection.is_concrete_artifact
|
|
289
|
-
else artifacts_manager.get_galaxy_artifact_path
|
|
290
|
-
)(remote_collection)
|
|
286
|
+
# NOTE: AnsibleError is raised on URLError
|
|
287
|
+
b_temp_tar_path = artifacts_manager.get_artifact_path_from_unknown(remote_collection)
|
|
291
288
|
|
|
292
289
|
display.vvv(
|
|
293
290
|
u"Remote collection cached as '{path!s}'".format(path=to_text(b_temp_tar_path))
|
|
@@ -557,11 +554,7 @@ def download_collections(
|
|
|
557
554
|
format(coll=to_text(concrete_coll_pin), path=to_text(b_output_path)),
|
|
558
555
|
)
|
|
559
556
|
|
|
560
|
-
b_src_path = (
|
|
561
|
-
artifacts_manager.get_artifact_path
|
|
562
|
-
if concrete_coll_pin.is_concrete_artifact
|
|
563
|
-
else artifacts_manager.get_galaxy_artifact_path
|
|
564
|
-
)(concrete_coll_pin)
|
|
557
|
+
b_src_path = artifacts_manager.get_artifact_path_from_unknown(concrete_coll_pin)
|
|
565
558
|
|
|
566
559
|
b_dest_path = os.path.join(
|
|
567
560
|
b_output_path,
|
|
@@ -681,7 +674,7 @@ def install_collections(
|
|
|
681
674
|
unsatisfied_requirements = set(
|
|
682
675
|
chain.from_iterable(
|
|
683
676
|
(
|
|
684
|
-
Requirement.from_dir_path(sub_coll, artifacts_manager)
|
|
677
|
+
Requirement.from_dir_path(to_bytes(sub_coll), artifacts_manager)
|
|
685
678
|
for sub_coll in (
|
|
686
679
|
artifacts_manager.
|
|
687
680
|
get_direct_collection_dependencies(install_req).
|
|
@@ -1485,10 +1478,7 @@ def install(collection, path, artifacts_manager): # FIXME: mv to dataclasses?
|
|
|
1485
1478
|
:param path: Collection dirs layout path.
|
|
1486
1479
|
:param artifacts_manager: Artifacts manager.
|
|
1487
1480
|
"""
|
|
1488
|
-
b_artifact_path = (
|
|
1489
|
-
artifacts_manager.get_artifact_path if collection.is_concrete_artifact
|
|
1490
|
-
else artifacts_manager.get_galaxy_artifact_path
|
|
1491
|
-
)(collection)
|
|
1481
|
+
b_artifact_path = artifacts_manager.get_artifact_path_from_unknown(collection)
|
|
1492
1482
|
|
|
1493
1483
|
collection_path = os.path.join(path, collection.namespace, collection.name)
|
|
1494
1484
|
b_collection_path = to_bytes(collection_path, errors='surrogate_or_strict')
|
|
@@ -1571,6 +1561,13 @@ def install_artifact(b_coll_targz_path, b_collection_path, b_temp_path, signatur
|
|
|
1571
1561
|
"""
|
|
1572
1562
|
try:
|
|
1573
1563
|
with tarfile.open(b_coll_targz_path, mode='r') as collection_tar:
|
|
1564
|
+
# Remove this once py3.11 is our controller minimum
|
|
1565
|
+
# Workaround for https://bugs.python.org/issue47231
|
|
1566
|
+
# See _extract_tar_dir
|
|
1567
|
+
collection_tar._ansible_normalized_cache = {
|
|
1568
|
+
m.name.removesuffix(os.path.sep): m for m in collection_tar.getmembers()
|
|
1569
|
+
} # deprecated: description='TarFile member index' core_version='2.18' python_version='3.11'
|
|
1570
|
+
|
|
1574
1571
|
# Verify the signature on the MANIFEST.json before extracting anything else
|
|
1575
1572
|
_extract_tar_file(collection_tar, MANIFEST_FILENAME, b_collection_path, b_temp_path)
|
|
1576
1573
|
|
|
@@ -1651,22 +1648,12 @@ def install_src(collection, b_collection_path, b_collection_output_path, artifac
|
|
|
1651
1648
|
|
|
1652
1649
|
def _extract_tar_dir(tar, dirname, b_dest):
|
|
1653
1650
|
""" Extracts a directory from a collection tar. """
|
|
1654
|
-
|
|
1655
|
-
|
|
1656
|
-
# Create list of members with and without trailing separator
|
|
1657
|
-
if not member_names[-1].endswith(os.path.sep):
|
|
1658
|
-
member_names.append(member_names[-1] + os.path.sep)
|
|
1651
|
+
dirname = to_native(dirname, errors='surrogate_or_strict').removesuffix(os.path.sep)
|
|
1659
1652
|
|
|
1660
|
-
|
|
1661
|
-
|
|
1662
|
-
|
|
1663
|
-
|
|
1664
|
-
except KeyError:
|
|
1665
|
-
continue
|
|
1666
|
-
break
|
|
1667
|
-
else:
|
|
1668
|
-
# If we still can't find the member, raise a nice error.
|
|
1669
|
-
raise AnsibleError("Unable to extract '%s' from collection" % to_native(member, errors='surrogate_or_strict'))
|
|
1653
|
+
try:
|
|
1654
|
+
tar_member = tar._ansible_normalized_cache[dirname]
|
|
1655
|
+
except KeyError:
|
|
1656
|
+
raise AnsibleError("Unable to extract '%s' from collection" % dirname)
|
|
1670
1657
|
|
|
1671
1658
|
b_dir_path = os.path.join(b_dest, to_bytes(dirname, errors='surrogate_or_strict'))
|
|
1672
1659
|
|
|
@@ -21,7 +21,7 @@ from tempfile import mkdtemp
|
|
|
21
21
|
|
|
22
22
|
if t.TYPE_CHECKING:
|
|
23
23
|
from ansible.galaxy.dependency_resolution.dataclasses import (
|
|
24
|
-
Candidate, Requirement,
|
|
24
|
+
Candidate, Collection, Requirement,
|
|
25
25
|
)
|
|
26
26
|
from ansible.galaxy.token import GalaxyToken
|
|
27
27
|
|
|
@@ -190,7 +190,7 @@ class ConcreteArtifactsManager:
|
|
|
190
190
|
return b_artifact_path
|
|
191
191
|
|
|
192
192
|
def get_artifact_path(self, collection):
|
|
193
|
-
# type: (
|
|
193
|
+
# type: (Collection) -> bytes
|
|
194
194
|
"""Given a concrete collection pointer, return a cached path.
|
|
195
195
|
|
|
196
196
|
If it's not yet on disk, this method downloads the artifact first.
|
|
@@ -251,16 +251,22 @@ class ConcreteArtifactsManager:
|
|
|
251
251
|
self._artifact_cache[collection.src] = b_artifact_path
|
|
252
252
|
return b_artifact_path
|
|
253
253
|
|
|
254
|
+
def get_artifact_path_from_unknown(self, collection):
|
|
255
|
+
# type: (Candidate) -> bytes
|
|
256
|
+
if collection.is_concrete_artifact:
|
|
257
|
+
return self.get_artifact_path(collection)
|
|
258
|
+
return self.get_galaxy_artifact_path(collection)
|
|
259
|
+
|
|
254
260
|
def _get_direct_collection_namespace(self, collection):
|
|
255
261
|
# type: (Candidate) -> t.Optional[str]
|
|
256
262
|
return self.get_direct_collection_meta(collection)['namespace'] # type: ignore[return-value]
|
|
257
263
|
|
|
258
264
|
def _get_direct_collection_name(self, collection):
|
|
259
|
-
# type: (
|
|
265
|
+
# type: (Collection) -> t.Optional[str]
|
|
260
266
|
return self.get_direct_collection_meta(collection)['name'] # type: ignore[return-value]
|
|
261
267
|
|
|
262
268
|
def get_direct_collection_fqcn(self, collection):
|
|
263
|
-
# type: (
|
|
269
|
+
# type: (Collection) -> t.Optional[str]
|
|
264
270
|
"""Extract FQCN from the given on-disk collection artifact.
|
|
265
271
|
|
|
266
272
|
If the collection is virtual, ``None`` is returned instead
|
|
@@ -276,7 +282,7 @@ class ConcreteArtifactsManager:
|
|
|
276
282
|
))
|
|
277
283
|
|
|
278
284
|
def get_direct_collection_version(self, collection):
|
|
279
|
-
# type: (
|
|
285
|
+
# type: (Collection) -> str
|
|
280
286
|
"""Extract version from the given on-disk collection artifact."""
|
|
281
287
|
return self.get_direct_collection_meta(collection)['version'] # type: ignore[return-value]
|
|
282
288
|
|
|
@@ -289,7 +295,7 @@ class ConcreteArtifactsManager:
|
|
|
289
295
|
return collection_dependencies # type: ignore[return-value]
|
|
290
296
|
|
|
291
297
|
def get_direct_collection_meta(self, collection):
|
|
292
|
-
# type: (
|
|
298
|
+
# type: (Collection) -> dict[str, t.Union[str, dict[str, str], list[str], None, t.Type[Sentinel]]]
|
|
293
299
|
"""Extract meta from the given on-disk collection artifact."""
|
|
294
300
|
try: # FIXME: use unique collection identifier as a cache key?
|
|
295
301
|
return self._artifact_meta_cache[collection.src]
|
|
@@ -216,12 +216,15 @@ class _ComputedReqKindsMixin:
|
|
|
216
216
|
return cls.from_dir_path_implicit(dir_path)
|
|
217
217
|
|
|
218
218
|
@classmethod
|
|
219
|
-
def from_dir_path(
|
|
219
|
+
def from_dir_path( # type: ignore[misc]
|
|
220
|
+
cls, # type: t.Type[Collection]
|
|
221
|
+
dir_path, # type: bytes
|
|
222
|
+
art_mgr, # type: ConcreteArtifactsManager
|
|
223
|
+
): # type: (...) -> Collection
|
|
220
224
|
"""Make collection from an directory with metadata."""
|
|
221
225
|
if dir_path.endswith(to_bytes(os.path.sep)):
|
|
222
226
|
dir_path = dir_path.rstrip(to_bytes(os.path.sep))
|
|
223
|
-
|
|
224
|
-
if not _is_collection_dir(b_dir_path):
|
|
227
|
+
if not _is_collection_dir(dir_path):
|
|
225
228
|
display.warning(
|
|
226
229
|
u"Collection at '{path!s}' does not have a {manifest_json!s} "
|
|
227
230
|
u'file, nor has it {galaxy_yml!s}: cannot detect version.'.
|
ansible/modules/apt_key.py
CHANGED
|
@@ -27,7 +27,7 @@ attributes:
|
|
|
27
27
|
platform:
|
|
28
28
|
platforms: debian
|
|
29
29
|
notes:
|
|
30
|
-
- The apt-key command
|
|
30
|
+
- The apt-key command used by this module has been deprecated. See the L(Debian wiki,https://wiki.debian.org/DebianRepository/UseThirdParty) for details.
|
|
31
31
|
This module is kept for backwards compatibility for systems that still use apt-key as the main way to manage apt repository keys.
|
|
32
32
|
- As a sanity check, downloaded key id must match the one specified.
|
|
33
33
|
- "Use full fingerprint (40 characters) key ids to avoid key collisions.
|
|
@@ -36,6 +36,8 @@ notes:
|
|
|
36
36
|
- Adding a new key requires an apt cache update (e.g. using the M(ansible.builtin.apt) module's update_cache option).
|
|
37
37
|
requirements:
|
|
38
38
|
- gpg
|
|
39
|
+
seealso:
|
|
40
|
+
- module: ansible.builtin.deb822_repository
|
|
39
41
|
options:
|
|
40
42
|
id:
|
|
41
43
|
description:
|
|
@@ -81,12 +83,13 @@ options:
|
|
|
81
83
|
'''
|
|
82
84
|
|
|
83
85
|
EXAMPLES = '''
|
|
84
|
-
- name: One way to avoid apt_key once it is removed from your distro
|
|
86
|
+
- name: One way to avoid apt_key once it is removed from your distro, armored keys should use .asc extension, binary should use .gpg
|
|
85
87
|
block:
|
|
86
|
-
- name: somerepo |no apt key
|
|
88
|
+
- name: somerepo | no apt key
|
|
87
89
|
ansible.builtin.get_url:
|
|
88
|
-
url: https://
|
|
89
|
-
dest: /etc/apt/keyrings/
|
|
90
|
+
url: https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x36a1d7869245c8950f966e92d8576a8ba88d21e9
|
|
91
|
+
dest: /etc/apt/keyrings/myrepo.asc
|
|
92
|
+
checksum: sha256:bb42f0db45d46bab5f9ec619e1a47360b94c27142e57aa71f7050d08672309e0
|
|
90
93
|
|
|
91
94
|
- name: somerepo | apt source
|
|
92
95
|
ansible.builtin.apt_repository:
|
|
@@ -325,7 +325,7 @@ def write_signed_by_key(module, v, slug):
|
|
|
325
325
|
parts = generic_urlparse(urlparse(v))
|
|
326
326
|
if parts.scheme:
|
|
327
327
|
try:
|
|
328
|
-
r = open_url(v)
|
|
328
|
+
r = open_url(v, http_agent='ansible-httpget')
|
|
329
329
|
except Exception as exc:
|
|
330
330
|
raise_from(RuntimeError(to_native(exc)), exc)
|
|
331
331
|
else:
|
ansible/modules/dnf5.py
CHANGED
|
@@ -215,7 +215,6 @@ options:
|
|
|
215
215
|
default: "no"
|
|
216
216
|
cacheonly:
|
|
217
217
|
description:
|
|
218
|
-
- This is currently no-op as dnf5 does not implement the feature.
|
|
219
218
|
- Tells dnf to run entirely from system cache; does not download or update metadata.
|
|
220
219
|
type: bool
|
|
221
220
|
default: "no"
|
|
@@ -512,7 +511,9 @@ class Dnf5Module(YumDnf):
|
|
|
512
511
|
conf.clean_requirements_on_remove = self.autoremove
|
|
513
512
|
conf.installroot = self.installroot
|
|
514
513
|
conf.use_host_config = True # needed for installroot
|
|
515
|
-
conf.cacheonly = self.cacheonly
|
|
514
|
+
conf.cacheonly = "all" if self.cacheonly else "none"
|
|
515
|
+
if self.download_dir:
|
|
516
|
+
conf.destdir = self.download_dir
|
|
516
517
|
|
|
517
518
|
base.setup()
|
|
518
519
|
|
|
@@ -667,18 +668,17 @@ class Dnf5Module(YumDnf):
|
|
|
667
668
|
if results:
|
|
668
669
|
msg = "Check mode: No changes made, but would have if not in check mode"
|
|
669
670
|
else:
|
|
670
|
-
transaction.download(
|
|
671
|
+
transaction.download()
|
|
671
672
|
if not self.download_only:
|
|
672
|
-
|
|
673
|
+
transaction.set_description("ansible dnf5 module")
|
|
674
|
+
result = transaction.run()
|
|
675
|
+
if result == libdnf5.base.Transaction.TransactionRunResult_ERROR_GPG_CHECK:
|
|
673
676
|
self.module.fail_json(
|
|
674
677
|
msg="Failed to validate GPG signatures: {}".format(",".join(transaction.get_gpg_signature_problems())),
|
|
675
678
|
failures=[],
|
|
676
679
|
rc=1,
|
|
677
680
|
)
|
|
678
|
-
|
|
679
|
-
transaction.set_description("ansible dnf5 module")
|
|
680
|
-
result = transaction.run()
|
|
681
|
-
if result != libdnf5.base.Transaction.TransactionRunResult_SUCCESS:
|
|
681
|
+
elif result != libdnf5.base.Transaction.TransactionRunResult_SUCCESS:
|
|
682
682
|
self.module.fail_json(
|
|
683
683
|
msg="Failed to install some of the specified packages",
|
|
684
684
|
failures=["{}: {}".format(transaction.transaction_result_to_string(result), log) for log in transaction.get_transaction_problems()],
|
ansible/modules/find.py
CHANGED
|
@@ -56,6 +56,9 @@ options:
|
|
|
56
56
|
contains:
|
|
57
57
|
description:
|
|
58
58
|
- A regular expression or pattern which should be matched against the file content.
|
|
59
|
+
- If I(read_whole_file) is C(true) it matches against the beginning of the line (uses
|
|
60
|
+
C(re.match())). If I(read_whole_file) is C(false), it searches anywhere for that pattern
|
|
61
|
+
(uses C(re.search())).
|
|
59
62
|
- Works only when I(file_type) is C(file).
|
|
60
63
|
type: str
|
|
61
64
|
read_whole_file:
|
ansible/modules/uri.py
CHANGED
|
@@ -707,7 +707,15 @@ def main():
|
|
|
707
707
|
sub_type = 'octet-stream'
|
|
708
708
|
content_encoding = 'utf-8'
|
|
709
709
|
|
|
710
|
-
|
|
710
|
+
if sub_type and '+' in sub_type:
|
|
711
|
+
# https://www.rfc-editor.org/rfc/rfc6839#section-3.1
|
|
712
|
+
sub_type_suffix = sub_type.partition('+')[2]
|
|
713
|
+
maybe_json = content_type and sub_type_suffix.lower() in JSON_CANDIDATES
|
|
714
|
+
elif sub_type:
|
|
715
|
+
maybe_json = content_type and sub_type.lower() in JSON_CANDIDATES
|
|
716
|
+
else:
|
|
717
|
+
maybe_json = False
|
|
718
|
+
|
|
711
719
|
maybe_output = maybe_json or return_content or info['status'] not in status_code
|
|
712
720
|
|
|
713
721
|
if maybe_output:
|
|
@@ -17,7 +17,7 @@ version_added: "2.11"
|
|
|
17
17
|
options:
|
|
18
18
|
argument_spec:
|
|
19
19
|
description:
|
|
20
|
-
- A dictionary like AnsibleModule argument_spec
|
|
20
|
+
- A dictionary like AnsibleModule argument_spec. See R(argument spec definition,argument_spec)
|
|
21
21
|
required: true
|
|
22
22
|
provided_arguments:
|
|
23
23
|
description:
|
|
@@ -10,6 +10,15 @@ import shutil
|
|
|
10
10
|
import stat
|
|
11
11
|
import tempfile
|
|
12
12
|
|
|
13
|
+
from jinja2.defaults import (
|
|
14
|
+
BLOCK_END_STRING,
|
|
15
|
+
BLOCK_START_STRING,
|
|
16
|
+
COMMENT_END_STRING,
|
|
17
|
+
COMMENT_START_STRING,
|
|
18
|
+
VARIABLE_END_STRING,
|
|
19
|
+
VARIABLE_START_STRING,
|
|
20
|
+
)
|
|
21
|
+
|
|
13
22
|
from ansible import constants as C
|
|
14
23
|
from ansible.config.manager import ensure_type
|
|
15
24
|
from ansible.errors import AnsibleError, AnsibleFileNotFound, AnsibleAction, AnsibleActionFail
|
|
@@ -57,12 +66,12 @@ class ActionModule(ActionBase):
|
|
|
57
66
|
dest = self._task.args.get('dest', None)
|
|
58
67
|
state = self._task.args.get('state', None)
|
|
59
68
|
newline_sequence = self._task.args.get('newline_sequence', self.DEFAULT_NEWLINE_SEQUENCE)
|
|
60
|
-
variable_start_string = self._task.args.get('variable_start_string',
|
|
61
|
-
variable_end_string = self._task.args.get('variable_end_string',
|
|
62
|
-
block_start_string = self._task.args.get('block_start_string',
|
|
63
|
-
block_end_string = self._task.args.get('block_end_string',
|
|
64
|
-
comment_start_string = self._task.args.get('comment_start_string',
|
|
65
|
-
comment_end_string = self._task.args.get('comment_end_string',
|
|
69
|
+
variable_start_string = self._task.args.get('variable_start_string', VARIABLE_START_STRING)
|
|
70
|
+
variable_end_string = self._task.args.get('variable_end_string', VARIABLE_END_STRING)
|
|
71
|
+
block_start_string = self._task.args.get('block_start_string', BLOCK_START_STRING)
|
|
72
|
+
block_end_string = self._task.args.get('block_end_string', BLOCK_END_STRING)
|
|
73
|
+
comment_start_string = self._task.args.get('comment_start_string', COMMENT_START_STRING)
|
|
74
|
+
comment_end_string = self._task.args.get('comment_end_string', COMMENT_END_STRING)
|
|
66
75
|
output_encoding = self._task.args.get('output_encoding', 'utf-8') or 'utf-8'
|
|
67
76
|
|
|
68
77
|
wrong_sequences = ["\\n", "\\r", "\\r\\n"]
|
|
@@ -129,16 +138,18 @@ class ActionModule(ActionBase):
|
|
|
129
138
|
templar = self._templar.copy_with_new_env(environment_class=AnsibleEnvironment,
|
|
130
139
|
searchpath=searchpath,
|
|
131
140
|
newline_sequence=newline_sequence,
|
|
132
|
-
block_start_string=block_start_string,
|
|
133
|
-
block_end_string=block_end_string,
|
|
134
|
-
variable_start_string=variable_start_string,
|
|
135
|
-
variable_end_string=variable_end_string,
|
|
136
|
-
comment_start_string=comment_start_string,
|
|
137
|
-
comment_end_string=comment_end_string,
|
|
138
|
-
trim_blocks=trim_blocks,
|
|
139
|
-
lstrip_blocks=lstrip_blocks,
|
|
140
141
|
available_variables=temp_vars)
|
|
141
|
-
|
|
142
|
+
overrides = dict(
|
|
143
|
+
block_start_string=block_start_string,
|
|
144
|
+
block_end_string=block_end_string,
|
|
145
|
+
variable_start_string=variable_start_string,
|
|
146
|
+
variable_end_string=variable_end_string,
|
|
147
|
+
comment_start_string=comment_start_string,
|
|
148
|
+
comment_end_string=comment_end_string,
|
|
149
|
+
trim_blocks=trim_blocks,
|
|
150
|
+
lstrip_blocks=lstrip_blocks
|
|
151
|
+
)
|
|
152
|
+
resultant = templar.do_template(template_data, preserve_trailing_newlines=True, escape_backslashes=False, overrides=overrides)
|
|
142
153
|
except AnsibleAction:
|
|
143
154
|
raise
|
|
144
155
|
except Exception as e:
|
|
@@ -22,6 +22,7 @@ DOCUMENTATION = """
|
|
|
22
22
|
description:
|
|
23
23
|
- Address of the remote target
|
|
24
24
|
default: inventory_hostname
|
|
25
|
+
type: string
|
|
25
26
|
vars:
|
|
26
27
|
- name: inventory_hostname
|
|
27
28
|
- name: ansible_host
|
|
@@ -52,6 +53,7 @@ DOCUMENTATION = """
|
|
|
52
53
|
description:
|
|
53
54
|
- User to login/authenticate as
|
|
54
55
|
- Can be set from the CLI via the C(--user) or C(-u) options.
|
|
56
|
+
type: string
|
|
55
57
|
vars:
|
|
56
58
|
- name: ansible_user
|
|
57
59
|
- name: ansible_ssh_user
|
|
@@ -72,6 +74,7 @@ DOCUMENTATION = """
|
|
|
72
74
|
description:
|
|
73
75
|
- Secret used to either login the ssh server or as a passphrase for ssh keys that require it
|
|
74
76
|
- Can be set from the CLI via the C(--ask-pass) option.
|
|
77
|
+
type: string
|
|
75
78
|
vars:
|
|
76
79
|
- name: ansible_password
|
|
77
80
|
- name: ansible_ssh_pass
|
|
@@ -111,6 +114,7 @@ DOCUMENTATION = """
|
|
|
111
114
|
description:
|
|
112
115
|
- Proxy information for running the connection via a jumphost
|
|
113
116
|
- Also this plugin will scan 'ssh_args', 'ssh_extra_args' and 'ssh_common_args' from the 'ssh' plugin settings for proxy information if set.
|
|
117
|
+
type: string
|
|
114
118
|
env: [{name: ANSIBLE_PARAMIKO_PROXY_COMMAND}]
|
|
115
119
|
ini:
|
|
116
120
|
- {key: proxy_command, section: paramiko_connection}
|
|
@@ -120,6 +124,7 @@ DOCUMENTATION = """
|
|
|
120
124
|
ssh_args:
|
|
121
125
|
description: Only used in parsing ProxyCommand for use in this plugin.
|
|
122
126
|
default: ''
|
|
127
|
+
type: string
|
|
123
128
|
ini:
|
|
124
129
|
- section: 'ssh_connection'
|
|
125
130
|
key: 'ssh_args'
|
|
@@ -134,6 +139,7 @@ DOCUMENTATION = """
|
|
|
134
139
|
alternatives: proxy_command
|
|
135
140
|
ssh_common_args:
|
|
136
141
|
description: Only used in parsing ProxyCommand for use in this plugin.
|
|
142
|
+
type: string
|
|
137
143
|
ini:
|
|
138
144
|
- section: 'ssh_connection'
|
|
139
145
|
key: 'ssh_common_args'
|
|
@@ -152,6 +158,7 @@ DOCUMENTATION = """
|
|
|
152
158
|
alternatives: proxy_command
|
|
153
159
|
ssh_extra_args:
|
|
154
160
|
description: Only used in parsing ProxyCommand for use in this plugin.
|
|
161
|
+
type: string
|
|
155
162
|
vars:
|
|
156
163
|
- name: ansible_ssh_extra_args
|
|
157
164
|
env:
|
|
@@ -259,6 +266,7 @@ DOCUMENTATION = """
|
|
|
259
266
|
private_key_file:
|
|
260
267
|
description:
|
|
261
268
|
- Path to private key file to use for authentication.
|
|
269
|
+
type: string
|
|
262
270
|
ini:
|
|
263
271
|
- section: defaults
|
|
264
272
|
key: private_key_file
|
|
@@ -188,7 +188,7 @@ options:
|
|
|
188
188
|
vars:
|
|
189
189
|
- name: ansible_psrp_ignore_proxy
|
|
190
190
|
type: bool
|
|
191
|
-
default:
|
|
191
|
+
default: false
|
|
192
192
|
|
|
193
193
|
# auth options
|
|
194
194
|
certificate_key_pem:
|
|
@@ -221,7 +221,7 @@ options:
|
|
|
221
221
|
- Disables the use of TLSv1.2 on the CredSSP authentication channel.
|
|
222
222
|
- This should not be set to C(yes) unless dealing with a host that does not
|
|
223
223
|
have TLSv1.2.
|
|
224
|
-
default:
|
|
224
|
+
default: false
|
|
225
225
|
type: bool
|
|
226
226
|
vars:
|
|
227
227
|
- name: ansible_psrp_credssp_disable_tlsv1_2
|
|
@@ -262,7 +262,7 @@ options:
|
|
|
262
262
|
- CBT is used to provide extra protection against Man in the Middle C(MitM)
|
|
263
263
|
attacks by binding the outer transport channel to the auth channel.
|
|
264
264
|
- CBT is not used when using just C(HTTP), only C(HTTPS).
|
|
265
|
-
default:
|
|
265
|
+
default: true
|
|
266
266
|
type: bool
|
|
267
267
|
vars:
|
|
268
268
|
- name: ansible_psrp_negotiate_send_cbt
|
|
@@ -28,6 +28,7 @@ DOCUMENTATION = '''
|
|
|
28
28
|
host:
|
|
29
29
|
description: Hostname/IP to connect to.
|
|
30
30
|
default: inventory_hostname
|
|
31
|
+
type: string
|
|
31
32
|
vars:
|
|
32
33
|
- name: inventory_hostname
|
|
33
34
|
- name: ansible_host
|
|
@@ -55,6 +56,7 @@ DOCUMENTATION = '''
|
|
|
55
56
|
version_added: '2.5'
|
|
56
57
|
password:
|
|
57
58
|
description: Authentication password for the C(remote_user). Can be supplied as CLI option.
|
|
59
|
+
type: string
|
|
58
60
|
vars:
|
|
59
61
|
- name: ansible_password
|
|
60
62
|
- name: ansible_ssh_pass
|
|
@@ -64,6 +66,7 @@ DOCUMENTATION = '''
|
|
|
64
66
|
- Password prompt that sshpass should search for. Supported by sshpass 1.06 and up.
|
|
65
67
|
- Defaults to C(Enter PIN for) when pkcs11_provider is set.
|
|
66
68
|
default: ''
|
|
69
|
+
type: string
|
|
67
70
|
ini:
|
|
68
71
|
- section: 'ssh_connection'
|
|
69
72
|
key: 'sshpass_prompt'
|
|
@@ -75,6 +78,7 @@ DOCUMENTATION = '''
|
|
|
75
78
|
ssh_args:
|
|
76
79
|
description: Arguments to pass to all SSH CLI tools.
|
|
77
80
|
default: '-C -o ControlMaster=auto -o ControlPersist=60s'
|
|
81
|
+
type: string
|
|
78
82
|
ini:
|
|
79
83
|
- section: 'ssh_connection'
|
|
80
84
|
key: 'ssh_args'
|
|
@@ -85,6 +89,7 @@ DOCUMENTATION = '''
|
|
|
85
89
|
version_added: '2.7'
|
|
86
90
|
ssh_common_args:
|
|
87
91
|
description: Common extra args for all SSH CLI tools.
|
|
92
|
+
type: string
|
|
88
93
|
ini:
|
|
89
94
|
- section: 'ssh_connection'
|
|
90
95
|
key: 'ssh_common_args'
|
|
@@ -103,6 +108,7 @@ DOCUMENTATION = '''
|
|
|
103
108
|
- This defines the location of the SSH binary. It defaults to C(ssh) which will use the first SSH binary available in $PATH.
|
|
104
109
|
- This option is usually not required, it might be useful when access to system SSH is restricted,
|
|
105
110
|
or when using SSH wrappers to connect to remote hosts.
|
|
111
|
+
type: string
|
|
106
112
|
env: [{name: ANSIBLE_SSH_EXECUTABLE}]
|
|
107
113
|
ini:
|
|
108
114
|
- {key: ssh_executable, section: ssh_connection}
|
|
@@ -115,6 +121,7 @@ DOCUMENTATION = '''
|
|
|
115
121
|
default: sftp
|
|
116
122
|
description:
|
|
117
123
|
- This defines the location of the sftp binary. It defaults to C(sftp) which will use the first binary available in $PATH.
|
|
124
|
+
type: string
|
|
118
125
|
env: [{name: ANSIBLE_SFTP_EXECUTABLE}]
|
|
119
126
|
ini:
|
|
120
127
|
- {key: sftp_executable, section: ssh_connection}
|
|
@@ -126,6 +133,7 @@ DOCUMENTATION = '''
|
|
|
126
133
|
default: scp
|
|
127
134
|
description:
|
|
128
135
|
- This defines the location of the scp binary. It defaults to C(scp) which will use the first binary available in $PATH.
|
|
136
|
+
type: string
|
|
129
137
|
env: [{name: ANSIBLE_SCP_EXECUTABLE}]
|
|
130
138
|
ini:
|
|
131
139
|
- {key: scp_executable, section: ssh_connection}
|
|
@@ -135,6 +143,7 @@ DOCUMENTATION = '''
|
|
|
135
143
|
version_added: '2.7'
|
|
136
144
|
scp_extra_args:
|
|
137
145
|
description: Extra exclusive to the C(scp) CLI
|
|
146
|
+
type: string
|
|
138
147
|
vars:
|
|
139
148
|
- name: ansible_scp_extra_args
|
|
140
149
|
env:
|
|
@@ -149,6 +158,7 @@ DOCUMENTATION = '''
|
|
|
149
158
|
default: ''
|
|
150
159
|
sftp_extra_args:
|
|
151
160
|
description: Extra exclusive to the C(sftp) CLI
|
|
161
|
+
type: string
|
|
152
162
|
vars:
|
|
153
163
|
- name: ansible_sftp_extra_args
|
|
154
164
|
env:
|
|
@@ -163,6 +173,7 @@ DOCUMENTATION = '''
|
|
|
163
173
|
default: ''
|
|
164
174
|
ssh_extra_args:
|
|
165
175
|
description: Extra exclusive to the SSH CLI.
|
|
176
|
+
type: string
|
|
166
177
|
vars:
|
|
167
178
|
- name: ansible_ssh_extra_args
|
|
168
179
|
env:
|
|
@@ -209,6 +220,7 @@ DOCUMENTATION = '''
|
|
|
209
220
|
description:
|
|
210
221
|
- User name with which to login to the remote server, normally set by the remote_user keyword.
|
|
211
222
|
- If no user is supplied, Ansible will let the SSH client binary choose the user as it normally.
|
|
223
|
+
type: string
|
|
212
224
|
ini:
|
|
213
225
|
- section: defaults
|
|
214
226
|
key: remote_user
|
|
@@ -239,6 +251,7 @@ DOCUMENTATION = '''
|
|
|
239
251
|
private_key_file:
|
|
240
252
|
description:
|
|
241
253
|
- Path to private key file to use for authentication.
|
|
254
|
+
type: string
|
|
242
255
|
ini:
|
|
243
256
|
- section: defaults
|
|
244
257
|
key: private_key_file
|
|
@@ -257,6 +270,7 @@ DOCUMENTATION = '''
|
|
|
257
270
|
- Since 2.3, if null (default), ansible will generate a unique hash. Use ``%(directory)s`` to indicate where to use the control dir path setting.
|
|
258
271
|
- Before 2.3 it defaulted to ``control_path=%(directory)s/ansible-ssh-%%h-%%p-%%r``.
|
|
259
272
|
- Be aware that this setting is ignored if C(-o ControlPath) is set in ssh args.
|
|
273
|
+
type: string
|
|
260
274
|
env:
|
|
261
275
|
- name: ANSIBLE_SSH_CONTROL_PATH
|
|
262
276
|
ini:
|
|
@@ -270,6 +284,7 @@ DOCUMENTATION = '''
|
|
|
270
284
|
description:
|
|
271
285
|
- This sets the directory to use for ssh control path if the control path setting is null.
|
|
272
286
|
- Also, provides the ``%(directory)s`` variable for the control path setting.
|
|
287
|
+
type: string
|
|
273
288
|
env:
|
|
274
289
|
- name: ANSIBLE_SSH_CONTROL_PATH_DIR
|
|
275
290
|
ini:
|
|
@@ -279,7 +294,7 @@ DOCUMENTATION = '''
|
|
|
279
294
|
- name: ansible_control_path_dir
|
|
280
295
|
version_added: '2.7'
|
|
281
296
|
sftp_batch_mode:
|
|
282
|
-
default:
|
|
297
|
+
default: true
|
|
283
298
|
description: 'TODO: write it'
|
|
284
299
|
env: [{name: ANSIBLE_SFTP_BATCH_MODE}]
|
|
285
300
|
ini:
|
|
@@ -295,6 +310,7 @@ DOCUMENTATION = '''
|
|
|
295
310
|
- For OpenSSH >=9.0 you must add an additional option to enable scp (scp_extra_args="-O")
|
|
296
311
|
- Using 'piped' creates an ssh pipe with C(dd) on either side to copy the data
|
|
297
312
|
choices: ['sftp', 'scp', 'piped', 'smart']
|
|
313
|
+
type: string
|
|
298
314
|
env: [{name: ANSIBLE_SSH_TRANSFER_METHOD}]
|
|
299
315
|
ini:
|
|
300
316
|
- {key: transfer_method, section: ssh_connection}
|
|
@@ -321,7 +337,7 @@ DOCUMENTATION = '''
|
|
|
321
337
|
version_added: '2.7'
|
|
322
338
|
use_tty:
|
|
323
339
|
version_added: '2.5'
|
|
324
|
-
default:
|
|
340
|
+
default: true
|
|
325
341
|
description: add -tt to ssh commands to force tty allocation.
|
|
326
342
|
env: [{name: ANSIBLE_SSH_USETTY}]
|
|
327
343
|
ini:
|
|
@@ -354,6 +370,7 @@ DOCUMENTATION = '''
|
|
|
354
370
|
pkcs11_provider:
|
|
355
371
|
version_added: '2.12'
|
|
356
372
|
default: ""
|
|
373
|
+
type: string
|
|
357
374
|
description:
|
|
358
375
|
- "PKCS11 SmartCard provider such as opensc, example: /usr/local/lib/opensc-pkcs11.so"
|
|
359
376
|
- Requires sshpass version 1.06+, sshpass must support the -P option.
|
|
@@ -38,7 +38,7 @@ DOCUMENTATION:
|
|
|
38
38
|
postfix:
|
|
39
39
|
description: Indicator of the end of each line inside a comment block, only available for styles that support multiline comments.
|
|
40
40
|
type: string
|
|
41
|
-
|
|
41
|
+
postfix_count:
|
|
42
42
|
description: Number of times to add a postfix at the end of a line, when a prefix exists and is usable.
|
|
43
43
|
type: int
|
|
44
44
|
default: 1
|
ansible/plugins/filter/split.yml
CHANGED
|
@@ -3,7 +3,7 @@ DOCUMENTATION:
|
|
|
3
3
|
version_added: "historical"
|
|
4
4
|
short_description: split a string into a list
|
|
5
5
|
description:
|
|
6
|
-
- Using Python's text object method C(split) we turn strings into lists via a '
|
|
6
|
+
- Using Python's text object method C(split) we turn strings into lists via a 'splitting character'.
|
|
7
7
|
notes:
|
|
8
8
|
- This is a passthrough to Python's C(str.split).
|
|
9
9
|
positional: _input, _split_string
|