ansible-core 2.15.4rc1__py3-none-any.whl → 2.16.0b2__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of ansible-core might be problematic. Click here for more details.
- ansible/cli/__init__.py +3 -3
- ansible/cli/adhoc.py +1 -1
- ansible/cli/arguments/option_helpers.py +15 -5
- ansible/cli/config.py +2 -2
- ansible/cli/console.py +21 -17
- ansible/cli/doc.py +8 -9
- ansible/cli/galaxy.py +60 -27
- ansible/cli/inventory.py +1 -1
- ansible/cli/playbook.py +1 -1
- ansible/cli/pull.py +2 -2
- ansible/cli/scripts/ansible_connection_cli_stub.py +1 -1
- ansible/cli/vault.py +11 -6
- ansible/collections/__init__.py +0 -29
- ansible/collections/list.py +23 -44
- ansible/config/ansible_builtin_runtime.yml +8 -4
- ansible/config/base.yml +34 -22
- ansible/config/manager.py +1 -1
- ansible/constants.py +3 -5
- ansible/errors/__init__.py +1 -1
- ansible/executor/interpreter_discovery.py +1 -1
- ansible/executor/module_common.py +39 -32
- ansible/executor/play_iterator.py +0 -15
- ansible/executor/playbook_executor.py +3 -3
- ansible/executor/powershell/module_manifest.py +1 -1
- ansible/executor/powershell/module_wrapper.ps1 +4 -1
- ansible/executor/process/worker.py +22 -7
- ansible/executor/task_executor.py +39 -40
- ansible/executor/task_queue_manager.py +8 -11
- ansible/galaxy/__init__.py +1 -1
- ansible/galaxy/api.py +8 -11
- ansible/galaxy/collection/__init__.py +17 -4
- ansible/galaxy/collection/concrete_artifact_manager.py +7 -2
- ansible/galaxy/collection/galaxy_api_proxy.py +1 -1
- ansible/galaxy/data/container/README.md +3 -5
- ansible/galaxy/dependency_resolution/__init__.py +1 -6
- ansible/galaxy/dependency_resolution/dataclasses.py +22 -1
- ansible/galaxy/dependency_resolution/providers.py +61 -69
- ansible/galaxy/role.py +31 -13
- ansible/galaxy/token.py +2 -2
- ansible/inventory/group.py +1 -1
- ansible/inventory/manager.py +1 -1
- ansible/module_utils/ansible_release.py +2 -2
- ansible/module_utils/basic.py +11 -41
- ansible/module_utils/common/file.py +0 -100
- ansible/module_utils/common/json.py +1 -1
- ansible/module_utils/common/locale.py +1 -1
- ansible/module_utils/common/text/converters.py +2 -2
- ansible/module_utils/common/validation.py +1 -1
- ansible/module_utils/compat/_selectors2.py +4 -4
- ansible/module_utils/compat/datetime.py +40 -0
- ansible/module_utils/compat/selinux.py +1 -1
- ansible/module_utils/compat/typing.py +1 -1
- ansible/module_utils/connection.py +1 -1
- ansible/module_utils/facts/hardware/linux.py +2 -2
- ansible/module_utils/facts/hardware/openbsd.py +1 -1
- ansible/module_utils/facts/network/linux.py +3 -3
- ansible/module_utils/facts/other/facter.py +8 -15
- ansible/module_utils/facts/sysctl.py +1 -1
- ansible/module_utils/facts/system/date_time.py +2 -2
- ansible/module_utils/facts/system/distribution.py +1 -1
- ansible/module_utils/facts/system/local.py +6 -2
- ansible/module_utils/facts/system/pkg_mgr.py +6 -1
- ansible/module_utils/facts/system/service_mgr.py +4 -2
- ansible/module_utils/parsing/convert_bool.py +1 -1
- ansible/module_utils/service.py +9 -6
- ansible/module_utils/urls.py +40 -22
- ansible/modules/add_host.py +2 -2
- ansible/modules/apt.py +48 -31
- ansible/modules/apt_key.py +4 -4
- ansible/modules/apt_repository.py +5 -5
- ansible/modules/assemble.py +7 -7
- ansible/modules/assert.py +1 -1
- ansible/modules/async_status.py +11 -7
- ansible/modules/async_wrapper.py +1 -1
- ansible/modules/blockinfile.py +60 -17
- ansible/modules/command.py +37 -15
- ansible/modules/copy.py +35 -30
- ansible/modules/cron.py +14 -14
- ansible/modules/deb822_repository.py +4 -3
- ansible/modules/debconf.py +35 -14
- ansible/modules/debug.py +1 -1
- ansible/modules/dnf.py +29 -27
- ansible/modules/dnf5.py +22 -22
- ansible/modules/dpkg_selections.py +9 -2
- ansible/modules/expect.py +4 -4
- ansible/modules/fetch.py +7 -7
- ansible/modules/file.py +30 -30
- ansible/modules/find.py +82 -22
- ansible/modules/gather_facts.py +6 -2
- ansible/modules/get_url.py +29 -29
- ansible/modules/getent.py +4 -4
- ansible/modules/git.py +27 -27
- ansible/modules/group.py +5 -12
- ansible/modules/hostname.py +21 -2
- ansible/modules/include_role.py +5 -5
- ansible/modules/include_tasks.py +2 -2
- ansible/modules/include_vars.py +5 -5
- ansible/modules/iptables.py +70 -65
- ansible/modules/known_hosts.py +7 -7
- ansible/modules/lineinfile.py +33 -33
- ansible/modules/meta.py +13 -13
- ansible/modules/package.py +8 -8
- ansible/modules/package_facts.py +3 -3
- ansible/modules/pause.py +2 -2
- ansible/modules/ping.py +5 -5
- ansible/modules/pip.py +80 -46
- ansible/modules/reboot.py +8 -4
- ansible/modules/replace.py +20 -15
- ansible/modules/rpm_key.py +2 -2
- ansible/modules/script.py +16 -10
- ansible/modules/service.py +26 -98
- ansible/modules/service_facts.py +36 -12
- ansible/modules/set_fact.py +2 -2
- ansible/modules/set_stats.py +2 -2
- ansible/modules/setup.py +18 -18
- ansible/modules/shell.py +3 -3
- ansible/modules/stat.py +9 -30
- ansible/modules/subversion.py +9 -9
- ansible/modules/systemd.py +20 -19
- ansible/modules/systemd_service.py +20 -19
- ansible/modules/sysvinit.py +26 -21
- ansible/modules/tempfile.py +5 -4
- ansible/modules/template.py +60 -6
- ansible/modules/unarchive.py +21 -18
- ansible/modules/uri.py +39 -39
- ansible/modules/user.py +81 -53
- ansible/modules/wait_for.py +22 -21
- ansible/modules/wait_for_connection.py +4 -4
- ansible/modules/yum.py +38 -38
- ansible/modules/yum_repository.py +58 -80
- ansible/parsing/dataloader.py +27 -27
- ansible/parsing/mod_args.py +1 -1
- ansible/parsing/plugin_docs.py +3 -3
- ansible/parsing/splitter.py +14 -16
- ansible/parsing/utils/yaml.py +1 -1
- ansible/parsing/vault/__init__.py +8 -6
- ansible/parsing/yaml/constructor.py +1 -1
- ansible/parsing/yaml/objects.py +1 -1
- ansible/playbook/__init__.py +1 -1
- ansible/playbook/base.py +2 -2
- ansible/playbook/block.py +0 -1
- ansible/playbook/conditional.py +40 -114
- ansible/playbook/helpers.py +5 -28
- ansible/playbook/included_file.py +8 -7
- ansible/playbook/play.py +1 -1
- ansible/playbook/play_context.py +2 -2
- ansible/playbook/playbook_include.py +2 -2
- ansible/playbook/role/__init__.py +1 -1
- ansible/playbook/role/include.py +1 -1
- ansible/playbook/role/metadata.py +1 -1
- ansible/playbook/role_include.py +1 -1
- ansible/playbook/task.py +2 -2
- ansible/playbook/task_include.py +1 -24
- ansible/plugins/__init__.py +13 -5
- ansible/plugins/action/__init__.py +17 -43
- ansible/plugins/action/add_host.py +2 -3
- ansible/plugins/action/assemble.py +1 -1
- ansible/plugins/action/assert.py +2 -1
- ansible/plugins/action/copy.py +2 -2
- ansible/plugins/action/debug.py +2 -1
- ansible/plugins/action/fail.py +1 -0
- ansible/plugins/action/fetch.py +3 -1
- ansible/plugins/action/gather_facts.py +37 -13
- ansible/plugins/action/group_by.py +1 -0
- ansible/plugins/action/include_vars.py +3 -2
- ansible/plugins/action/normal.py +3 -3
- ansible/plugins/action/pause.py +1 -1
- ansible/plugins/action/reboot.py +21 -16
- ansible/plugins/action/script.py +23 -8
- ansible/plugins/action/set_fact.py +1 -0
- ansible/plugins/action/set_stats.py +1 -0
- ansible/plugins/action/shell.py +6 -0
- ansible/plugins/action/template.py +1 -1
- ansible/plugins/action/unarchive.py +1 -1
- ansible/plugins/action/uri.py +1 -1
- ansible/plugins/action/validate_argument_spec.py +1 -0
- ansible/plugins/action/wait_for_connection.py +4 -4
- ansible/plugins/become/__init__.py +1 -1
- ansible/plugins/become/su.py +1 -1
- ansible/plugins/cache/__init__.py +1 -1
- ansible/plugins/callback/junit.py +1 -1
- ansible/plugins/callback/oneline.py +1 -1
- ansible/plugins/callback/tree.py +1 -1
- ansible/plugins/cliconf/__init__.py +2 -2
- ansible/plugins/connection/__init__.py +65 -37
- ansible/plugins/connection/local.py +9 -8
- ansible/plugins/connection/paramiko_ssh.py +34 -28
- ansible/plugins/connection/psrp.py +56 -43
- ansible/plugins/connection/ssh.py +67 -43
- ansible/plugins/connection/winrm.py +77 -30
- ansible/plugins/doc_fragments/constructed.py +4 -4
- ansible/plugins/doc_fragments/files.py +12 -12
- ansible/plugins/doc_fragments/inventory_cache.py +0 -6
- ansible/plugins/doc_fragments/result_format_callback.py +5 -5
- ansible/plugins/doc_fragments/shell_common.py +2 -2
- ansible/plugins/doc_fragments/shell_windows.py +1 -1
- ansible/plugins/doc_fragments/template_common.py +6 -6
- ansible/plugins/doc_fragments/url.py +10 -10
- ansible/plugins/doc_fragments/url_windows.py +15 -15
- ansible/plugins/doc_fragments/vars_plugin_staging.py +4 -4
- ansible/plugins/filter/b64decode.yml +1 -1
- ansible/plugins/filter/b64encode.yml +2 -2
- ansible/plugins/filter/bool.yml +5 -5
- ansible/plugins/filter/combine.yml +1 -1
- ansible/plugins/filter/commonpath.yml +2 -1
- ansible/plugins/filter/core.py +6 -8
- ansible/plugins/filter/dict2items.yml +11 -1
- ansible/plugins/filter/difference.yml +1 -0
- ansible/plugins/filter/encryption.py +1 -1
- ansible/plugins/filter/extract.yml +1 -1
- ansible/plugins/filter/flatten.yml +1 -1
- ansible/plugins/filter/from_yaml.yml +1 -1
- ansible/plugins/filter/from_yaml_all.yml +2 -2
- ansible/plugins/filter/hash.yml +1 -1
- ansible/plugins/filter/human_readable.yml +1 -1
- ansible/plugins/filter/human_to_bytes.yml +2 -2
- ansible/plugins/filter/intersect.yml +1 -0
- ansible/plugins/filter/mandatory.yml +7 -0
- ansible/plugins/filter/mathstuff.py +15 -17
- ansible/plugins/filter/normpath.yml +1 -1
- ansible/plugins/filter/path_join.yml +8 -1
- ansible/plugins/filter/realpath.yml +3 -2
- ansible/plugins/filter/regex_findall.yml +8 -2
- ansible/plugins/filter/regex_replace.yml +9 -3
- ansible/plugins/filter/regex_search.yml +8 -2
- ansible/plugins/filter/relpath.yml +2 -2
- ansible/plugins/filter/root.yml +1 -1
- ansible/plugins/filter/splitext.yml +1 -1
- ansible/plugins/filter/subelements.yml +2 -2
- ansible/plugins/filter/symmetric_difference.yml +1 -0
- ansible/plugins/filter/ternary.yml +5 -5
- ansible/plugins/filter/to_json.yml +7 -7
- ansible/plugins/filter/to_nice_json.yml +5 -5
- ansible/plugins/filter/to_yaml.yml +2 -2
- ansible/plugins/filter/type_debug.yml +1 -1
- ansible/plugins/filter/union.yml +1 -0
- ansible/plugins/filter/unvault.yml +2 -2
- ansible/plugins/filter/urldecode.yml +13 -32
- ansible/plugins/filter/urlsplit.py +1 -1
- ansible/plugins/filter/vault.yml +1 -1
- ansible/plugins/filter/zip.yml +1 -1
- ansible/plugins/filter/zip_longest.yml +1 -1
- ansible/plugins/inventory/__init__.py +1 -1
- ansible/plugins/inventory/advanced_host_list.py +1 -1
- ansible/plugins/inventory/constructed.py +2 -2
- ansible/plugins/inventory/host_list.py +1 -1
- ansible/plugins/inventory/ini.py +6 -3
- ansible/plugins/inventory/script.py +8 -2
- ansible/plugins/inventory/toml.py +1 -1
- ansible/plugins/inventory/yaml.py +1 -1
- ansible/plugins/list.py +21 -17
- ansible/plugins/loader.py +66 -88
- ansible/plugins/lookup/__init__.py +1 -1
- ansible/plugins/lookup/config.py +16 -6
- ansible/plugins/lookup/csvfile.py +7 -4
- ansible/plugins/lookup/env.py +1 -1
- ansible/plugins/lookup/file.py +5 -2
- ansible/plugins/lookup/fileglob.py +5 -2
- ansible/plugins/lookup/first_found.py +20 -14
- ansible/plugins/lookup/ini.py +6 -3
- ansible/plugins/lookup/lines.py +2 -1
- ansible/plugins/lookup/password.py +7 -7
- ansible/plugins/lookup/pipe.py +1 -0
- ansible/plugins/lookup/random_choice.py +2 -2
- ansible/plugins/lookup/sequence.py +1 -1
- ansible/plugins/lookup/subelements.py +2 -2
- ansible/plugins/lookup/template.py +4 -1
- ansible/plugins/lookup/unvault.py +4 -1
- ansible/plugins/lookup/url.py +6 -6
- ansible/plugins/lookup/varnames.py +1 -1
- ansible/plugins/netconf/__init__.py +3 -3
- ansible/plugins/shell/__init__.py +1 -1
- ansible/plugins/shell/cmd.py +7 -7
- ansible/plugins/shell/powershell.py +1 -1
- ansible/plugins/strategy/__init__.py +8 -10
- ansible/plugins/strategy/free.py +1 -1
- ansible/plugins/strategy/linear.py +3 -3
- ansible/plugins/terminal/__init__.py +2 -2
- ansible/plugins/test/abs.yml +1 -1
- ansible/plugins/test/all.yml +1 -1
- ansible/plugins/test/any.yml +1 -1
- ansible/plugins/test/change.yml +2 -2
- ansible/plugins/test/changed.yml +2 -2
- ansible/plugins/test/contains.yml +1 -1
- ansible/plugins/test/core.py +1 -1
- ansible/plugins/test/directory.yml +1 -1
- ansible/plugins/test/exists.yml +3 -2
- ansible/plugins/test/failed.yml +2 -2
- ansible/plugins/test/failure.yml +2 -2
- ansible/plugins/test/falsy.yml +2 -2
- ansible/plugins/test/file.yml +1 -1
- ansible/plugins/test/finished.yml +2 -2
- ansible/plugins/test/is_abs.yml +1 -1
- ansible/plugins/test/is_dir.yml +1 -1
- ansible/plugins/test/is_file.yml +1 -1
- ansible/plugins/test/is_link.yml +1 -1
- ansible/plugins/test/is_mount.yml +1 -1
- ansible/plugins/test/is_same_file.yml +1 -1
- ansible/plugins/test/isnan.yml +1 -1
- ansible/plugins/test/issubset.yml +1 -2
- ansible/plugins/test/issuperset.yml +1 -2
- ansible/plugins/test/link.yml +1 -1
- ansible/plugins/test/link_exists.yml +1 -1
- ansible/plugins/test/match.yml +2 -2
- ansible/plugins/test/mount.yml +1 -1
- ansible/plugins/test/nan.yml +1 -1
- ansible/plugins/test/reachable.yml +2 -2
- ansible/plugins/test/regex.yml +1 -1
- ansible/plugins/test/same_file.yml +1 -1
- ansible/plugins/test/search.yml +2 -2
- ansible/plugins/test/skip.yml +3 -3
- ansible/plugins/test/skipped.yml +3 -3
- ansible/plugins/test/started.yml +2 -2
- ansible/plugins/test/subset.yml +1 -2
- ansible/plugins/test/succeeded.yml +2 -2
- ansible/plugins/test/success.yml +2 -2
- ansible/plugins/test/successful.yml +2 -2
- ansible/plugins/test/superset.yml +1 -2
- ansible/plugins/test/truthy.yml +3 -3
- ansible/plugins/test/unreachable.yml +2 -2
- ansible/plugins/test/uri.yml +1 -1
- ansible/plugins/test/url.yml +1 -1
- ansible/plugins/test/urn.yml +1 -1
- ansible/plugins/test/vault_encrypted.yml +1 -1
- ansible/plugins/test/version.yml +7 -7
- ansible/plugins/test/version_compare.yml +7 -7
- ansible/plugins/vars/host_group_vars.py +1 -1
- ansible/release.py +2 -2
- ansible/template/__init__.py +24 -26
- ansible/template/native_helpers.py +1 -1
- ansible/template/vars.py +1 -1
- ansible/utils/_junit_xml.py +1 -1
- ansible/utils/cmd_functions.py +1 -1
- ansible/utils/collection_loader/_collection_finder.py +12 -1
- ansible/utils/display.py +113 -62
- ansible/utils/encrypt.py +11 -14
- ansible/utils/hashing.py +1 -1
- ansible/utils/jsonrpc.py +1 -1
- ansible/utils/path.py +1 -1
- ansible/utils/plugin_docs.py +1 -1
- ansible/utils/py3compat.py +1 -1
- ansible/utils/shlex.py +2 -10
- ansible/utils/ssh_functions.py +5 -4
- ansible/utils/unicode.py +1 -1
- ansible/utils/unsafe_proxy.py +1 -1
- ansible/utils/vars.py +4 -29
- ansible/vars/hostvars.py +1 -2
- ansible/vars/manager.py +13 -9
- ansible/vars/plugins.py +2 -2
- {ansible_core-2.15.4rc1.dist-info → ansible_core-2.16.0b2.dist-info}/COPYING +4 -5
- {ansible_core-2.15.4rc1.dist-info → ansible_core-2.16.0b2.dist-info}/METADATA +2 -4
- {ansible_core-2.15.4rc1.dist-info → ansible_core-2.16.0b2.dist-info}/RECORD +424 -425
- ansible_test/_data/completion/docker.txt +9 -9
- ansible_test/_data/completion/remote.txt +4 -7
- ansible_test/_data/completion/windows.txt +0 -2
- ansible_test/_data/requirements/ansible-test.txt +2 -1
- ansible_test/_data/requirements/ansible.txt +0 -3
- ansible_test/_data/requirements/constraints.txt +0 -2
- ansible_test/_data/requirements/sanity.ansible-doc.txt +3 -5
- ansible_test/_data/requirements/sanity.changelog.in +1 -2
- ansible_test/_data/requirements/sanity.changelog.txt +4 -6
- ansible_test/_data/requirements/sanity.import.plugin.txt +2 -4
- ansible_test/_data/requirements/sanity.import.txt +1 -3
- ansible_test/_data/requirements/sanity.integration-aliases.txt +1 -3
- ansible_test/_data/requirements/sanity.mypy.txt +12 -12
- ansible_test/_data/requirements/sanity.pep8.txt +1 -1
- ansible_test/_data/requirements/sanity.pylint.txt +6 -12
- ansible_test/_data/requirements/sanity.runtime-metadata.txt +1 -3
- ansible_test/_data/requirements/sanity.validate-modules.in +1 -1
- ansible_test/_data/requirements/sanity.validate-modules.txt +3 -5
- ansible_test/_data/requirements/sanity.yamllint.txt +3 -5
- ansible_test/_data/requirements/units.txt +0 -1
- ansible_test/_internal/ci/azp.py +4 -4
- ansible_test/_internal/cli/environments.py +0 -13
- ansible_test/_internal/commands/coverage/analyze/targets/__init__.py +4 -4
- ansible_test/_internal/commands/coverage/combine.py +1 -1
- ansible_test/_internal/commands/integration/cloud/acme.py +6 -8
- ansible_test/_internal/commands/integration/cloud/cs.py +4 -9
- ansible_test/_internal/commands/integration/cloud/galaxy.py +103 -96
- ansible_test/_internal/commands/integration/cloud/httptester.py +0 -3
- ansible_test/_internal/commands/integration/cloud/nios.py +7 -9
- ansible_test/_internal/commands/integration/cloud/openshift.py +2 -7
- ansible_test/_internal/commands/integration/cloud/vcenter.py +11 -95
- ansible_test/_internal/commands/sanity/__init__.py +10 -0
- ansible_test/_internal/commands/sanity/import.py +8 -2
- ansible_test/_internal/commands/sanity/pylint.py +27 -1
- ansible_test/_internal/commands/units/__init__.py +2 -1
- ansible_test/_internal/config.py +0 -7
- ansible_test/_internal/containers.py +11 -56
- ansible_test/_internal/core_ci.py +0 -7
- ansible_test/_internal/coverage_util.py +8 -3
- ansible_test/_internal/delegation.py +0 -1
- ansible_test/_internal/diff.py +1 -1
- ansible_test/_internal/docker_util.py +9 -2
- ansible_test/_internal/host_profiles.py +6 -6
- ansible_test/_internal/http.py +1 -1
- ansible_test/_internal/junit_xml.py +1 -1
- ansible_test/_internal/pypi_proxy.py +1 -1
- ansible_test/_internal/python_requirements.py +3 -8
- ansible_test/_internal/util.py +1 -6
- ansible_test/_util/controller/sanity/code-smell/no-get-exception.json +4 -0
- ansible_test/_util/controller/sanity/code-smell/replace-urlopen.json +4 -0
- ansible_test/_util/controller/sanity/code-smell/use-compat-six.json +4 -0
- ansible_test/_util/controller/sanity/mypy/ansible-core.ini +3 -0
- ansible_test/_util/controller/sanity/pylint/config/ansible-test-target.cfg +2 -0
- ansible_test/_util/controller/sanity/pylint/config/ansible-test.cfg +0 -1
- ansible_test/_util/controller/sanity/pylint/config/collection.cfg +1 -0
- ansible_test/_util/controller/sanity/pylint/plugins/deprecated.py +172 -10
- ansible_test/_util/controller/sanity/pylint/plugins/string_format.py +13 -2
- ansible_test/_util/controller/sanity/pylint/plugins/unwanted.py +7 -1
- ansible_test/_util/controller/sanity/validate-modules/validate_modules/main.py +6 -6
- ansible_test/_util/controller/sanity/validate-modules/validate_modules/module_args.py +1 -1
- ansible_test/_util/controller/sanity/validate-modules/validate_modules/utils.py +1 -1
- ansible_test/_util/controller/sanity/yamllint/yamllinter.py +3 -3
- ansible_test/_util/controller/tools/collection_detail.py +2 -2
- ansible_test/_util/target/common/constants.py +2 -2
- ansible_test/_util/target/pytest/plugins/ansible_forked.py +103 -0
- ansible_test/_util/target/sanity/import/importer.py +0 -8
- ansible_test/_util/target/setup/bootstrap.sh +36 -16
- ansible_test/_util/target/setup/quiet_pip.py +0 -4
- ansible/modules/_include.py +0 -80
- ansible_test/_internal/commands/integration/cloud/foreman.py +0 -102
- ansible_test/_util/target/setup/ConfigureRemotingForAnsible.ps1 +0 -435
- {ansible_core-2.15.4rc1.data → ansible_core-2.16.0b2.data}/scripts/ansible-test +0 -0
- {ansible_core-2.15.4rc1.dist-info → ansible_core-2.16.0b2.dist-info}/WHEEL +0 -0
- {ansible_core-2.15.4rc1.dist-info → ansible_core-2.16.0b2.dist-info}/entry_points.txt +0 -0
- {ansible_core-2.15.4rc1.dist-info → ansible_core-2.16.0b2.dist-info}/top_level.txt +0 -0
ansible/modules/_include.py
DELETED
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
# -*- coding: utf-8 -*-
|
|
2
|
-
|
|
3
|
-
# Copyright: Ansible Project
|
|
4
|
-
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
|
5
|
-
|
|
6
|
-
from __future__ import absolute_import, division, print_function
|
|
7
|
-
__metaclass__ = type
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
DOCUMENTATION = r'''
|
|
11
|
-
---
|
|
12
|
-
author: Ansible Core Team (@ansible)
|
|
13
|
-
module: include
|
|
14
|
-
short_description: Include a task list
|
|
15
|
-
description:
|
|
16
|
-
- Includes a file with a list of tasks to be executed in the current playbook.
|
|
17
|
-
- Lists of tasks can only be included where tasks
|
|
18
|
-
normally run (in play).
|
|
19
|
-
- Before Ansible 2.0, all includes were 'static' and were executed when the play was compiled.
|
|
20
|
-
- Static includes are not subject to most directives. For example, loops or conditionals are applied instead to each
|
|
21
|
-
inherited task.
|
|
22
|
-
- Since Ansible 2.0, task includes are dynamic and behave more like real tasks. This means they can be looped,
|
|
23
|
-
skipped and use variables from any source. Ansible tries to auto detect this, but you can use the C(static)
|
|
24
|
-
directive (which was added in Ansible 2.1) to bypass autodetection.
|
|
25
|
-
- This module is also supported for Windows targets.
|
|
26
|
-
version_added: "0.6"
|
|
27
|
-
deprecated:
|
|
28
|
-
why: it has too many conflicting behaviours depending on keyword combinations and it was unclear how it should behave in each case.
|
|
29
|
-
new actions were developed that were specific about each case and related behaviours.
|
|
30
|
-
alternative: include_tasks, import_tasks, import_playbook
|
|
31
|
-
removed_in: "2.16"
|
|
32
|
-
removed_from_collection: 'ansible.builtin'
|
|
33
|
-
options:
|
|
34
|
-
free-form:
|
|
35
|
-
description:
|
|
36
|
-
- This module allows you to specify the name of the file directly without any other options.
|
|
37
|
-
notes:
|
|
38
|
-
- This is a core feature of Ansible, rather than a module, and cannot be overridden like a module.
|
|
39
|
-
- Include has some unintuitive behaviours depending on if it is running in a static or dynamic in play or in playbook context,
|
|
40
|
-
in an effort to clarify behaviours we are moving to a new set modules (M(ansible.builtin.include_tasks),
|
|
41
|
-
M(ansible.builtin.include_role), M(ansible.builtin.import_playbook), M(ansible.builtin.import_tasks))
|
|
42
|
-
that have well established and clear behaviours.
|
|
43
|
-
- This module no longer supporst including plays. Use M(ansible.builtin.import_playbook) instead.
|
|
44
|
-
seealso:
|
|
45
|
-
- module: ansible.builtin.import_playbook
|
|
46
|
-
- module: ansible.builtin.import_role
|
|
47
|
-
- module: ansible.builtin.import_tasks
|
|
48
|
-
- module: ansible.builtin.include_role
|
|
49
|
-
- module: ansible.builtin.include_tasks
|
|
50
|
-
- ref: playbooks_reuse_includes
|
|
51
|
-
description: More information related to including and importing playbooks, roles and tasks.
|
|
52
|
-
'''
|
|
53
|
-
|
|
54
|
-
EXAMPLES = r'''
|
|
55
|
-
|
|
56
|
-
- hosts: all
|
|
57
|
-
tasks:
|
|
58
|
-
- ansible.builtin.debug:
|
|
59
|
-
msg: task1
|
|
60
|
-
|
|
61
|
-
- name: Include task list in play
|
|
62
|
-
ansible.builtin.include: stuff.yaml
|
|
63
|
-
|
|
64
|
-
- ansible.builtin.debug:
|
|
65
|
-
msg: task10
|
|
66
|
-
|
|
67
|
-
- hosts: all
|
|
68
|
-
tasks:
|
|
69
|
-
- ansible.builtin.debug:
|
|
70
|
-
msg: task1
|
|
71
|
-
|
|
72
|
-
- name: Include task list in play only if the condition is true
|
|
73
|
-
ansible.builtin.include: "{{ hostvar }}.yaml"
|
|
74
|
-
static: no
|
|
75
|
-
when: hostvar is defined
|
|
76
|
-
'''
|
|
77
|
-
|
|
78
|
-
RETURN = r'''
|
|
79
|
-
# This module does not return anything except tasks to execute.
|
|
80
|
-
'''
|
|
@@ -1,102 +0,0 @@
|
|
|
1
|
-
"""Foreman plugin for integration tests."""
|
|
2
|
-
from __future__ import annotations
|
|
3
|
-
|
|
4
|
-
import os
|
|
5
|
-
|
|
6
|
-
from ....config import (
|
|
7
|
-
IntegrationConfig,
|
|
8
|
-
)
|
|
9
|
-
|
|
10
|
-
from ....containers import (
|
|
11
|
-
CleanupMode,
|
|
12
|
-
run_support_container,
|
|
13
|
-
)
|
|
14
|
-
|
|
15
|
-
from ....util import (
|
|
16
|
-
display,
|
|
17
|
-
)
|
|
18
|
-
|
|
19
|
-
from . import (
|
|
20
|
-
CloudEnvironment,
|
|
21
|
-
CloudEnvironmentConfig,
|
|
22
|
-
CloudProvider,
|
|
23
|
-
)
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
class ForemanProvider(CloudProvider):
|
|
27
|
-
"""Foreman plugin. Sets up Foreman stub server for tests."""
|
|
28
|
-
|
|
29
|
-
DOCKER_SIMULATOR_NAME = 'foreman-stub'
|
|
30
|
-
|
|
31
|
-
# Default image to run Foreman stub from.
|
|
32
|
-
#
|
|
33
|
-
# The simulator must be pinned to a specific version
|
|
34
|
-
# to guarantee CI passes with the version used.
|
|
35
|
-
#
|
|
36
|
-
# It's source source itself resides at:
|
|
37
|
-
# https://github.com/ansible/foreman-test-container
|
|
38
|
-
DOCKER_IMAGE = 'quay.io/ansible/foreman-test-container:1.4.0'
|
|
39
|
-
|
|
40
|
-
def __init__(self, args: IntegrationConfig) -> None:
|
|
41
|
-
super().__init__(args)
|
|
42
|
-
|
|
43
|
-
self.__container_from_env = os.environ.get('ANSIBLE_FRMNSIM_CONTAINER')
|
|
44
|
-
"""
|
|
45
|
-
Overrides target container, might be used for development.
|
|
46
|
-
|
|
47
|
-
Use ANSIBLE_FRMNSIM_CONTAINER=whatever_you_want if you want
|
|
48
|
-
to use other image. Omit/empty otherwise.
|
|
49
|
-
"""
|
|
50
|
-
self.image = self.__container_from_env or self.DOCKER_IMAGE
|
|
51
|
-
|
|
52
|
-
self.uses_docker = True
|
|
53
|
-
|
|
54
|
-
def setup(self) -> None:
|
|
55
|
-
"""Setup cloud resource before delegation and reg cleanup callback."""
|
|
56
|
-
super().setup()
|
|
57
|
-
|
|
58
|
-
display.warning('The foreman test plugin is deprecated and will be removed in a future version of ansible-test.')
|
|
59
|
-
|
|
60
|
-
if self._use_static_config():
|
|
61
|
-
self._setup_static()
|
|
62
|
-
else:
|
|
63
|
-
self._setup_dynamic()
|
|
64
|
-
|
|
65
|
-
def _setup_dynamic(self) -> None:
|
|
66
|
-
"""Spawn a Foreman stub within docker container."""
|
|
67
|
-
foreman_port = 8080
|
|
68
|
-
|
|
69
|
-
ports = [
|
|
70
|
-
foreman_port,
|
|
71
|
-
]
|
|
72
|
-
|
|
73
|
-
run_support_container(
|
|
74
|
-
self.args,
|
|
75
|
-
self.platform,
|
|
76
|
-
self.image,
|
|
77
|
-
self.DOCKER_SIMULATOR_NAME,
|
|
78
|
-
ports,
|
|
79
|
-
allow_existing=True,
|
|
80
|
-
cleanup=CleanupMode.YES,
|
|
81
|
-
)
|
|
82
|
-
|
|
83
|
-
self._set_cloud_config('FOREMAN_HOST', self.DOCKER_SIMULATOR_NAME)
|
|
84
|
-
self._set_cloud_config('FOREMAN_PORT', str(foreman_port))
|
|
85
|
-
|
|
86
|
-
def _setup_static(self) -> None:
|
|
87
|
-
raise NotImplementedError()
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
class ForemanEnvironment(CloudEnvironment):
|
|
91
|
-
"""Foreman environment plugin. Updates integration test environment after delegation."""
|
|
92
|
-
|
|
93
|
-
def get_environment_config(self) -> CloudEnvironmentConfig:
|
|
94
|
-
"""Return environment configuration for use in the test environment after delegation."""
|
|
95
|
-
env_vars = dict(
|
|
96
|
-
FOREMAN_HOST=str(self._get_cloud_config('FOREMAN_HOST')),
|
|
97
|
-
FOREMAN_PORT=str(self._get_cloud_config('FOREMAN_PORT')),
|
|
98
|
-
)
|
|
99
|
-
|
|
100
|
-
return CloudEnvironmentConfig(
|
|
101
|
-
env_vars=env_vars,
|
|
102
|
-
)
|
|
@@ -1,435 +0,0 @@
|
|
|
1
|
-
#Requires -Version 3.0
|
|
2
|
-
|
|
3
|
-
# Configure a Windows host for remote management with Ansible
|
|
4
|
-
# -----------------------------------------------------------
|
|
5
|
-
#
|
|
6
|
-
# This script checks the current WinRM (PS Remoting) configuration and makes
|
|
7
|
-
# the necessary changes to allow Ansible to connect, authenticate and
|
|
8
|
-
# execute PowerShell commands.
|
|
9
|
-
#
|
|
10
|
-
# IMPORTANT: This script uses self-signed certificates and authentication mechanisms
|
|
11
|
-
# that are intended for development environments and evaluation purposes only.
|
|
12
|
-
# Production environments and deployments that are exposed on the network should
|
|
13
|
-
# use CA-signed certificates and secure authentication mechanisms such as Kerberos.
|
|
14
|
-
#
|
|
15
|
-
# To run this script in Powershell:
|
|
16
|
-
#
|
|
17
|
-
# [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
|
|
18
|
-
# $url = "https://raw.githubusercontent.com/ansible/ansible/devel/test/lib/ansible_test/_util/target/setup/ConfigureRemotingForAnsible.ps1"
|
|
19
|
-
# $file = "$env:temp\ConfigureRemotingForAnsible.ps1"
|
|
20
|
-
#
|
|
21
|
-
# (New-Object -TypeName System.Net.WebClient).DownloadFile($url, $file)
|
|
22
|
-
#
|
|
23
|
-
# powershell.exe -ExecutionPolicy ByPass -File $file
|
|
24
|
-
#
|
|
25
|
-
# All events are logged to the Windows EventLog, useful for unattended runs.
|
|
26
|
-
#
|
|
27
|
-
# Use option -Verbose in order to see the verbose output messages.
|
|
28
|
-
#
|
|
29
|
-
# Use option -CertValidityDays to specify how long this certificate is valid
|
|
30
|
-
# starting from today. So you would specify -CertValidityDays 3650 to get
|
|
31
|
-
# a 10-year valid certificate.
|
|
32
|
-
#
|
|
33
|
-
# Use option -ForceNewSSLCert if the system has been SysPreped and a new
|
|
34
|
-
# SSL Certificate must be forced on the WinRM Listener when re-running this
|
|
35
|
-
# script. This is necessary when a new SID and CN name is created.
|
|
36
|
-
#
|
|
37
|
-
# Use option -EnableCredSSP to enable CredSSP as an authentication option.
|
|
38
|
-
#
|
|
39
|
-
# Use option -DisableBasicAuth to disable basic authentication.
|
|
40
|
-
#
|
|
41
|
-
# Use option -SkipNetworkProfileCheck to skip the network profile check.
|
|
42
|
-
# Without specifying this the script will only run if the device's interfaces
|
|
43
|
-
# are in DOMAIN or PRIVATE zones. Provide this switch if you want to enable
|
|
44
|
-
# WinRM on a device with an interface in PUBLIC zone.
|
|
45
|
-
#
|
|
46
|
-
# Use option -SubjectName to specify the CN name of the certificate. This
|
|
47
|
-
# defaults to the system's hostname and generally should not be specified.
|
|
48
|
-
|
|
49
|
-
# Written by Trond Hindenes <trond@hindenes.com>
|
|
50
|
-
# Updated by Chris Church <cchurch@ansible.com>
|
|
51
|
-
# Updated by Michael Crilly <mike@autologic.cm>
|
|
52
|
-
# Updated by Anton Ouzounov <Anton.Ouzounov@careerbuilder.com>
|
|
53
|
-
# Updated by Nicolas Simond <contact@nicolas-simond.com>
|
|
54
|
-
# Updated by Dag Wieërs <dag@wieers.com>
|
|
55
|
-
# Updated by Jordan Borean <jborean93@gmail.com>
|
|
56
|
-
# Updated by Erwan Quélin <erwan.quelin@gmail.com>
|
|
57
|
-
# Updated by David Norman <david@dkn.email>
|
|
58
|
-
#
|
|
59
|
-
# Version 1.0 - 2014-07-06
|
|
60
|
-
# Version 1.1 - 2014-11-11
|
|
61
|
-
# Version 1.2 - 2015-05-15
|
|
62
|
-
# Version 1.3 - 2016-04-04
|
|
63
|
-
# Version 1.4 - 2017-01-05
|
|
64
|
-
# Version 1.5 - 2017-02-09
|
|
65
|
-
# Version 1.6 - 2017-04-18
|
|
66
|
-
# Version 1.7 - 2017-11-23
|
|
67
|
-
# Version 1.8 - 2018-02-23
|
|
68
|
-
# Version 1.9 - 2018-09-21
|
|
69
|
-
|
|
70
|
-
# Support -Verbose option
|
|
71
|
-
[CmdletBinding()]
|
|
72
|
-
|
|
73
|
-
Param (
|
|
74
|
-
[string]$SubjectName = $env:COMPUTERNAME,
|
|
75
|
-
[int]$CertValidityDays = 1095,
|
|
76
|
-
[switch]$SkipNetworkProfileCheck,
|
|
77
|
-
$CreateSelfSignedCert = $true,
|
|
78
|
-
[switch]$ForceNewSSLCert,
|
|
79
|
-
[switch]$GlobalHttpFirewallAccess,
|
|
80
|
-
[switch]$DisableBasicAuth = $false,
|
|
81
|
-
[switch]$EnableCredSSP
|
|
82
|
-
)
|
|
83
|
-
|
|
84
|
-
Function Write-ProgressLog {
|
|
85
|
-
$Message = $args[0]
|
|
86
|
-
Write-EventLog -LogName Application -Source $EventSource -EntryType Information -EventId 1 -Message $Message
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
Function Write-VerboseLog {
|
|
90
|
-
$Message = $args[0]
|
|
91
|
-
Write-Verbose $Message
|
|
92
|
-
Write-ProgressLog $Message
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
Function Write-HostLog {
|
|
96
|
-
$Message = $args[0]
|
|
97
|
-
Write-Output $Message
|
|
98
|
-
Write-ProgressLog $Message
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
Function New-LegacySelfSignedCert {
|
|
102
|
-
Param (
|
|
103
|
-
[string]$SubjectName,
|
|
104
|
-
[int]$ValidDays = 1095
|
|
105
|
-
)
|
|
106
|
-
|
|
107
|
-
$hostnonFQDN = $env:computerName
|
|
108
|
-
$hostFQDN = [System.Net.Dns]::GetHostByName(($env:computerName)).Hostname
|
|
109
|
-
$SignatureAlgorithm = "SHA256"
|
|
110
|
-
|
|
111
|
-
$name = New-Object -COM "X509Enrollment.CX500DistinguishedName.1"
|
|
112
|
-
$name.Encode("CN=$SubjectName", 0)
|
|
113
|
-
|
|
114
|
-
$key = New-Object -COM "X509Enrollment.CX509PrivateKey.1"
|
|
115
|
-
$key.ProviderName = "Microsoft Enhanced RSA and AES Cryptographic Provider"
|
|
116
|
-
$key.KeySpec = 1
|
|
117
|
-
$key.Length = 4096
|
|
118
|
-
$key.SecurityDescriptor = "D:PAI(A;;0xd01f01ff;;;SY)(A;;0xd01f01ff;;;BA)(A;;0x80120089;;;NS)"
|
|
119
|
-
$key.MachineContext = 1
|
|
120
|
-
$key.Create()
|
|
121
|
-
|
|
122
|
-
$serverauthoid = New-Object -COM "X509Enrollment.CObjectId.1"
|
|
123
|
-
$serverauthoid.InitializeFromValue("1.3.6.1.5.5.7.3.1")
|
|
124
|
-
$ekuoids = New-Object -COM "X509Enrollment.CObjectIds.1"
|
|
125
|
-
$ekuoids.Add($serverauthoid)
|
|
126
|
-
$ekuext = New-Object -COM "X509Enrollment.CX509ExtensionEnhancedKeyUsage.1"
|
|
127
|
-
$ekuext.InitializeEncode($ekuoids)
|
|
128
|
-
|
|
129
|
-
$cert = New-Object -COM "X509Enrollment.CX509CertificateRequestCertificate.1"
|
|
130
|
-
$cert.InitializeFromPrivateKey(2, $key, "")
|
|
131
|
-
$cert.Subject = $name
|
|
132
|
-
$cert.Issuer = $cert.Subject
|
|
133
|
-
$cert.NotBefore = (Get-Date).AddDays(-1)
|
|
134
|
-
$cert.NotAfter = $cert.NotBefore.AddDays($ValidDays)
|
|
135
|
-
|
|
136
|
-
$SigOID = New-Object -ComObject X509Enrollment.CObjectId
|
|
137
|
-
$SigOID.InitializeFromValue(([Security.Cryptography.Oid]$SignatureAlgorithm).Value)
|
|
138
|
-
|
|
139
|
-
[string[]] $AlternativeName += $hostnonFQDN
|
|
140
|
-
$AlternativeName += $hostFQDN
|
|
141
|
-
$IAlternativeNames = New-Object -ComObject X509Enrollment.CAlternativeNames
|
|
142
|
-
|
|
143
|
-
foreach ($AN in $AlternativeName) {
|
|
144
|
-
$AltName = New-Object -ComObject X509Enrollment.CAlternativeName
|
|
145
|
-
$AltName.InitializeFromString(0x3, $AN)
|
|
146
|
-
$IAlternativeNames.Add($AltName)
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
$SubjectAlternativeName = New-Object -ComObject X509Enrollment.CX509ExtensionAlternativeNames
|
|
150
|
-
$SubjectAlternativeName.InitializeEncode($IAlternativeNames)
|
|
151
|
-
|
|
152
|
-
[String[]]$KeyUsage = ("DigitalSignature", "KeyEncipherment")
|
|
153
|
-
$KeyUsageObj = New-Object -ComObject X509Enrollment.CX509ExtensionKeyUsage
|
|
154
|
-
$KeyUsageObj.InitializeEncode([int][Security.Cryptography.X509Certificates.X509KeyUsageFlags]($KeyUsage))
|
|
155
|
-
$KeyUsageObj.Critical = $true
|
|
156
|
-
|
|
157
|
-
$cert.X509Extensions.Add($KeyUsageObj)
|
|
158
|
-
$cert.X509Extensions.Add($ekuext)
|
|
159
|
-
$cert.SignatureInformation.HashAlgorithm = $SigOID
|
|
160
|
-
$CERT.X509Extensions.Add($SubjectAlternativeName)
|
|
161
|
-
$cert.Encode()
|
|
162
|
-
|
|
163
|
-
$enrollment = New-Object -COM "X509Enrollment.CX509Enrollment.1"
|
|
164
|
-
$enrollment.InitializeFromRequest($cert)
|
|
165
|
-
$certdata = $enrollment.CreateRequest(0)
|
|
166
|
-
$enrollment.InstallResponse(2, $certdata, 0, "")
|
|
167
|
-
|
|
168
|
-
# extract/return the thumbprint from the generated cert
|
|
169
|
-
$parsed_cert = New-Object System.Security.Cryptography.X509Certificates.X509Certificate2
|
|
170
|
-
$parsed_cert.Import([System.Text.Encoding]::UTF8.GetBytes($certdata))
|
|
171
|
-
|
|
172
|
-
return $parsed_cert.Thumbprint
|
|
173
|
-
}
|
|
174
|
-
|
|
175
|
-
Function Enable-GlobalHttpFirewallAccess {
|
|
176
|
-
Write-Verbose "Forcing global HTTP firewall access"
|
|
177
|
-
# this is a fairly naive implementation; could be more sophisticated about rule matching/collapsing
|
|
178
|
-
$fw = New-Object -ComObject HNetCfg.FWPolicy2
|
|
179
|
-
|
|
180
|
-
# try to find/enable the default rule first
|
|
181
|
-
$add_rule = $false
|
|
182
|
-
$matching_rules = $fw.Rules | Where-Object { $_.Name -eq "Windows Remote Management (HTTP-In)" }
|
|
183
|
-
$rule = $null
|
|
184
|
-
If ($matching_rules) {
|
|
185
|
-
If ($matching_rules -isnot [Array]) {
|
|
186
|
-
Write-Verbose "Editing existing single HTTP firewall rule"
|
|
187
|
-
$rule = $matching_rules
|
|
188
|
-
}
|
|
189
|
-
Else {
|
|
190
|
-
# try to find one with the All or Public profile first
|
|
191
|
-
Write-Verbose "Found multiple existing HTTP firewall rules..."
|
|
192
|
-
$rule = $matching_rules | ForEach-Object { $_.Profiles -band 4 }[0]
|
|
193
|
-
|
|
194
|
-
If (-not $rule -or $rule -is [Array]) {
|
|
195
|
-
Write-Verbose "Editing an arbitrary single HTTP firewall rule (multiple existed)"
|
|
196
|
-
# oh well, just pick the first one
|
|
197
|
-
$rule = $matching_rules[0]
|
|
198
|
-
}
|
|
199
|
-
}
|
|
200
|
-
}
|
|
201
|
-
|
|
202
|
-
If (-not $rule) {
|
|
203
|
-
Write-Verbose "Creating a new HTTP firewall rule"
|
|
204
|
-
$rule = New-Object -ComObject HNetCfg.FWRule
|
|
205
|
-
$rule.Name = "Windows Remote Management (HTTP-In)"
|
|
206
|
-
$rule.Description = "Inbound rule for Windows Remote Management via WS-Management. [TCP 5985]"
|
|
207
|
-
$add_rule = $true
|
|
208
|
-
}
|
|
209
|
-
|
|
210
|
-
$rule.Profiles = 0x7FFFFFFF
|
|
211
|
-
$rule.Protocol = 6
|
|
212
|
-
$rule.LocalPorts = 5985
|
|
213
|
-
$rule.RemotePorts = "*"
|
|
214
|
-
$rule.LocalAddresses = "*"
|
|
215
|
-
$rule.RemoteAddresses = "*"
|
|
216
|
-
$rule.Enabled = $true
|
|
217
|
-
$rule.Direction = 1
|
|
218
|
-
$rule.Action = 1
|
|
219
|
-
$rule.Grouping = "Windows Remote Management"
|
|
220
|
-
|
|
221
|
-
If ($add_rule) {
|
|
222
|
-
$fw.Rules.Add($rule)
|
|
223
|
-
}
|
|
224
|
-
|
|
225
|
-
Write-Verbose "HTTP firewall rule $($rule.Name) updated"
|
|
226
|
-
}
|
|
227
|
-
|
|
228
|
-
# Setup error handling.
|
|
229
|
-
Trap {
|
|
230
|
-
$_
|
|
231
|
-
Exit 1
|
|
232
|
-
}
|
|
233
|
-
$ErrorActionPreference = "Stop"
|
|
234
|
-
|
|
235
|
-
# Get the ID and security principal of the current user account
|
|
236
|
-
$myWindowsID = [System.Security.Principal.WindowsIdentity]::GetCurrent()
|
|
237
|
-
$myWindowsPrincipal = new-object System.Security.Principal.WindowsPrincipal($myWindowsID)
|
|
238
|
-
|
|
239
|
-
# Get the security principal for the Administrator role
|
|
240
|
-
$adminRole = [System.Security.Principal.WindowsBuiltInRole]::Administrator
|
|
241
|
-
|
|
242
|
-
# Check to see if we are currently running "as Administrator"
|
|
243
|
-
if (-Not $myWindowsPrincipal.IsInRole($adminRole)) {
|
|
244
|
-
Write-Output "ERROR: You need elevated Administrator privileges in order to run this script."
|
|
245
|
-
Write-Output " Start Windows PowerShell by using the Run as Administrator option."
|
|
246
|
-
Exit 2
|
|
247
|
-
}
|
|
248
|
-
|
|
249
|
-
$EventSource = $MyInvocation.MyCommand.Name
|
|
250
|
-
If (-Not $EventSource) {
|
|
251
|
-
$EventSource = "Powershell CLI"
|
|
252
|
-
}
|
|
253
|
-
|
|
254
|
-
If ([System.Diagnostics.EventLog]::Exists('Application') -eq $False -or [System.Diagnostics.EventLog]::SourceExists($EventSource) -eq $False) {
|
|
255
|
-
New-EventLog -LogName Application -Source $EventSource
|
|
256
|
-
}
|
|
257
|
-
|
|
258
|
-
# Detect PowerShell version.
|
|
259
|
-
If ($PSVersionTable.PSVersion.Major -lt 3) {
|
|
260
|
-
Write-ProgressLog "PowerShell version 3 or higher is required."
|
|
261
|
-
Throw "PowerShell version 3 or higher is required."
|
|
262
|
-
}
|
|
263
|
-
|
|
264
|
-
# Find and start the WinRM service.
|
|
265
|
-
Write-Verbose "Verifying WinRM service."
|
|
266
|
-
If (!(Get-Service "WinRM")) {
|
|
267
|
-
Write-ProgressLog "Unable to find the WinRM service."
|
|
268
|
-
Throw "Unable to find the WinRM service."
|
|
269
|
-
}
|
|
270
|
-
ElseIf ((Get-Service "WinRM").Status -ne "Running") {
|
|
271
|
-
Write-Verbose "Setting WinRM service to start automatically on boot."
|
|
272
|
-
Set-Service -Name "WinRM" -StartupType Automatic
|
|
273
|
-
Write-ProgressLog "Set WinRM service to start automatically on boot."
|
|
274
|
-
Write-Verbose "Starting WinRM service."
|
|
275
|
-
Start-Service -Name "WinRM" -ErrorAction Stop
|
|
276
|
-
Write-ProgressLog "Started WinRM service."
|
|
277
|
-
|
|
278
|
-
}
|
|
279
|
-
|
|
280
|
-
# WinRM should be running; check that we have a PS session config.
|
|
281
|
-
If (!(Get-PSSessionConfiguration -Verbose:$false) -or (!(Get-ChildItem WSMan:\localhost\Listener))) {
|
|
282
|
-
If ($SkipNetworkProfileCheck) {
|
|
283
|
-
Write-Verbose "Enabling PS Remoting without checking Network profile."
|
|
284
|
-
Enable-PSRemoting -SkipNetworkProfileCheck -Force -ErrorAction Stop
|
|
285
|
-
Write-ProgressLog "Enabled PS Remoting without checking Network profile."
|
|
286
|
-
}
|
|
287
|
-
Else {
|
|
288
|
-
Write-Verbose "Enabling PS Remoting."
|
|
289
|
-
Enable-PSRemoting -Force -ErrorAction Stop
|
|
290
|
-
Write-ProgressLog "Enabled PS Remoting."
|
|
291
|
-
}
|
|
292
|
-
}
|
|
293
|
-
Else {
|
|
294
|
-
Write-Verbose "PS Remoting is already enabled."
|
|
295
|
-
}
|
|
296
|
-
|
|
297
|
-
# Ensure LocalAccountTokenFilterPolicy is set to 1
|
|
298
|
-
# https://github.com/ansible/ansible/issues/42978
|
|
299
|
-
$token_path = "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System"
|
|
300
|
-
$token_prop_name = "LocalAccountTokenFilterPolicy"
|
|
301
|
-
$token_key = Get-Item -Path $token_path
|
|
302
|
-
$token_value = $token_key.GetValue($token_prop_name, $null)
|
|
303
|
-
if ($token_value -ne 1) {
|
|
304
|
-
Write-Verbose "Setting LocalAccountTOkenFilterPolicy to 1"
|
|
305
|
-
if ($null -ne $token_value) {
|
|
306
|
-
Remove-ItemProperty -Path $token_path -Name $token_prop_name
|
|
307
|
-
}
|
|
308
|
-
New-ItemProperty -Path $token_path -Name $token_prop_name -Value 1 -PropertyType DWORD > $null
|
|
309
|
-
}
|
|
310
|
-
|
|
311
|
-
# Make sure there is a SSL listener.
|
|
312
|
-
$listeners = Get-ChildItem WSMan:\localhost\Listener
|
|
313
|
-
If (!($listeners | Where-Object { $_.Keys -like "TRANSPORT=HTTPS" })) {
|
|
314
|
-
# We cannot use New-SelfSignedCertificate on 2012R2 and earlier
|
|
315
|
-
$thumbprint = New-LegacySelfSignedCert -SubjectName $SubjectName -ValidDays $CertValidityDays
|
|
316
|
-
Write-HostLog "Self-signed SSL certificate generated; thumbprint: $thumbprint"
|
|
317
|
-
|
|
318
|
-
# Create the hashtables of settings to be used.
|
|
319
|
-
$valueset = @{
|
|
320
|
-
Hostname = $SubjectName
|
|
321
|
-
CertificateThumbprint = $thumbprint
|
|
322
|
-
}
|
|
323
|
-
|
|
324
|
-
$selectorset = @{
|
|
325
|
-
Transport = "HTTPS"
|
|
326
|
-
Address = "*"
|
|
327
|
-
}
|
|
328
|
-
|
|
329
|
-
Write-Verbose "Enabling SSL listener."
|
|
330
|
-
New-WSManInstance -ResourceURI 'winrm/config/Listener' -SelectorSet $selectorset -ValueSet $valueset
|
|
331
|
-
Write-ProgressLog "Enabled SSL listener."
|
|
332
|
-
}
|
|
333
|
-
Else {
|
|
334
|
-
Write-Verbose "SSL listener is already active."
|
|
335
|
-
|
|
336
|
-
# Force a new SSL cert on Listener if the $ForceNewSSLCert
|
|
337
|
-
If ($ForceNewSSLCert) {
|
|
338
|
-
|
|
339
|
-
# We cannot use New-SelfSignedCertificate on 2012R2 and earlier
|
|
340
|
-
$thumbprint = New-LegacySelfSignedCert -SubjectName $SubjectName -ValidDays $CertValidityDays
|
|
341
|
-
Write-HostLog "Self-signed SSL certificate generated; thumbprint: $thumbprint"
|
|
342
|
-
|
|
343
|
-
$valueset = @{
|
|
344
|
-
CertificateThumbprint = $thumbprint
|
|
345
|
-
Hostname = $SubjectName
|
|
346
|
-
}
|
|
347
|
-
|
|
348
|
-
# Delete the listener for SSL
|
|
349
|
-
$selectorset = @{
|
|
350
|
-
Address = "*"
|
|
351
|
-
Transport = "HTTPS"
|
|
352
|
-
}
|
|
353
|
-
Remove-WSManInstance -ResourceURI 'winrm/config/Listener' -SelectorSet $selectorset
|
|
354
|
-
|
|
355
|
-
# Add new Listener with new SSL cert
|
|
356
|
-
New-WSManInstance -ResourceURI 'winrm/config/Listener' -SelectorSet $selectorset -ValueSet $valueset
|
|
357
|
-
}
|
|
358
|
-
}
|
|
359
|
-
|
|
360
|
-
# Check for basic authentication.
|
|
361
|
-
$basicAuthSetting = Get-ChildItem WSMan:\localhost\Service\Auth | Where-Object { $_.Name -eq "Basic" }
|
|
362
|
-
|
|
363
|
-
If ($DisableBasicAuth) {
|
|
364
|
-
If (($basicAuthSetting.Value) -eq $true) {
|
|
365
|
-
Write-Verbose "Disabling basic auth support."
|
|
366
|
-
Set-Item -Path "WSMan:\localhost\Service\Auth\Basic" -Value $false
|
|
367
|
-
Write-ProgressLog "Disabled basic auth support."
|
|
368
|
-
}
|
|
369
|
-
Else {
|
|
370
|
-
Write-Verbose "Basic auth is already disabled."
|
|
371
|
-
}
|
|
372
|
-
}
|
|
373
|
-
Else {
|
|
374
|
-
If (($basicAuthSetting.Value) -eq $false) {
|
|
375
|
-
Write-Verbose "Enabling basic auth support."
|
|
376
|
-
Set-Item -Path "WSMan:\localhost\Service\Auth\Basic" -Value $true
|
|
377
|
-
Write-ProgressLog "Enabled basic auth support."
|
|
378
|
-
}
|
|
379
|
-
Else {
|
|
380
|
-
Write-Verbose "Basic auth is already enabled."
|
|
381
|
-
}
|
|
382
|
-
}
|
|
383
|
-
|
|
384
|
-
# If EnableCredSSP if set to true
|
|
385
|
-
If ($EnableCredSSP) {
|
|
386
|
-
# Check for CredSSP authentication
|
|
387
|
-
$credsspAuthSetting = Get-ChildItem WSMan:\localhost\Service\Auth | Where-Object { $_.Name -eq "CredSSP" }
|
|
388
|
-
If (($credsspAuthSetting.Value) -eq $false) {
|
|
389
|
-
Write-Verbose "Enabling CredSSP auth support."
|
|
390
|
-
Enable-WSManCredSSP -role server -Force
|
|
391
|
-
Write-ProgressLog "Enabled CredSSP auth support."
|
|
392
|
-
}
|
|
393
|
-
}
|
|
394
|
-
|
|
395
|
-
If ($GlobalHttpFirewallAccess) {
|
|
396
|
-
Enable-GlobalHttpFirewallAccess
|
|
397
|
-
}
|
|
398
|
-
|
|
399
|
-
# Configure firewall to allow WinRM HTTPS connections.
|
|
400
|
-
$fwtest1 = netsh advfirewall firewall show rule name="Allow WinRM HTTPS"
|
|
401
|
-
$fwtest2 = netsh advfirewall firewall show rule name="Allow WinRM HTTPS" profile=any
|
|
402
|
-
If ($fwtest1.count -lt 5) {
|
|
403
|
-
Write-Verbose "Adding firewall rule to allow WinRM HTTPS."
|
|
404
|
-
netsh advfirewall firewall add rule profile=any name="Allow WinRM HTTPS" dir=in localport=5986 protocol=TCP action=allow
|
|
405
|
-
Write-ProgressLog "Added firewall rule to allow WinRM HTTPS."
|
|
406
|
-
}
|
|
407
|
-
ElseIf (($fwtest1.count -ge 5) -and ($fwtest2.count -lt 5)) {
|
|
408
|
-
Write-Verbose "Updating firewall rule to allow WinRM HTTPS for any profile."
|
|
409
|
-
netsh advfirewall firewall set rule name="Allow WinRM HTTPS" new profile=any
|
|
410
|
-
Write-ProgressLog "Updated firewall rule to allow WinRM HTTPS for any profile."
|
|
411
|
-
}
|
|
412
|
-
Else {
|
|
413
|
-
Write-Verbose "Firewall rule already exists to allow WinRM HTTPS."
|
|
414
|
-
}
|
|
415
|
-
|
|
416
|
-
# Test a remoting connection to localhost, which should work.
|
|
417
|
-
$httpResult = Invoke-Command -ComputerName "localhost" -ScriptBlock { $using:env:COMPUTERNAME } -ErrorVariable httpError -ErrorAction SilentlyContinue
|
|
418
|
-
$httpsOptions = New-PSSessionOption -SkipCACheck -SkipCNCheck -SkipRevocationCheck
|
|
419
|
-
|
|
420
|
-
$httpsResult = New-PSSession -UseSSL -ComputerName "localhost" -SessionOption $httpsOptions -ErrorVariable httpsError -ErrorAction SilentlyContinue
|
|
421
|
-
|
|
422
|
-
If ($httpResult -and $httpsResult) {
|
|
423
|
-
Write-Verbose "HTTP: Enabled | HTTPS: Enabled"
|
|
424
|
-
}
|
|
425
|
-
ElseIf ($httpsResult -and !$httpResult) {
|
|
426
|
-
Write-Verbose "HTTP: Disabled | HTTPS: Enabled"
|
|
427
|
-
}
|
|
428
|
-
ElseIf ($httpResult -and !$httpsResult) {
|
|
429
|
-
Write-Verbose "HTTP: Enabled | HTTPS: Disabled"
|
|
430
|
-
}
|
|
431
|
-
Else {
|
|
432
|
-
Write-ProgressLog "Unable to establish an HTTP or HTTPS remoting session."
|
|
433
|
-
Throw "Unable to establish an HTTP or HTTPS remoting session."
|
|
434
|
-
}
|
|
435
|
-
Write-VerboseLog "PS Remoting has been successfully configured for Ansible."
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|