mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-08-12 00:54:22 -07:00
Merge branch 'devel' of github.com:ansible/ansible into devel
This commit is contained in:
commit
87f004c503
6 changed files with 43 additions and 15 deletions
2
changelogs/fragments/43024-nclu-empty-net-commands.yaml
Normal file
2
changelogs/fragments/43024-nclu-empty-net-commands.yaml
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
bugfixes:
|
||||||
|
- nclu - no longer runs net on empty lines in templates (https://github.com/ansible/ansible/pull/43024)
|
3
changelogs/fragments/docker-default-ssl.yml
Normal file
3
changelogs/fragments/docker-default-ssl.yml
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
---
|
||||||
|
bugfixes:
|
||||||
|
- fix default SSL version for docker modules https://github.com/ansible/ansible/issues/42897
|
|
@ -80,7 +80,6 @@ DEFAULT_TLS = False
|
||||||
DEFAULT_TLS_VERIFY = False
|
DEFAULT_TLS_VERIFY = False
|
||||||
DEFAULT_TLS_HOSTNAME = 'localhost'
|
DEFAULT_TLS_HOSTNAME = 'localhost'
|
||||||
MIN_DOCKER_VERSION = "1.7.0"
|
MIN_DOCKER_VERSION = "1.7.0"
|
||||||
DEFAULT_SSL_VERSION = "1.0"
|
|
||||||
DEFAULT_TIMEOUT_SECONDS = 60
|
DEFAULT_TIMEOUT_SECONDS = 60
|
||||||
|
|
||||||
DOCKER_COMMON_ARGS = dict(
|
DOCKER_COMMON_ARGS = dict(
|
||||||
|
@ -91,7 +90,7 @@ DOCKER_COMMON_ARGS = dict(
|
||||||
cacert_path=dict(type='str', aliases=['tls_ca_cert']),
|
cacert_path=dict(type='str', aliases=['tls_ca_cert']),
|
||||||
cert_path=dict(type='str', aliases=['tls_client_cert']),
|
cert_path=dict(type='str', aliases=['tls_client_cert']),
|
||||||
key_path=dict(type='str', aliases=['tls_client_key']),
|
key_path=dict(type='str', aliases=['tls_client_key']),
|
||||||
ssl_version=dict(type='str', default=DEFAULT_SSL_VERSION),
|
ssl_version=dict(type='str'),
|
||||||
tls=dict(type='bool', default=DEFAULT_TLS),
|
tls=dict(type='bool', default=DEFAULT_TLS),
|
||||||
tls_verify=dict(type='bool', default=DEFAULT_TLS_VERIFY),
|
tls_verify=dict(type='bool', default=DEFAULT_TLS_VERIFY),
|
||||||
debug=dict(type='bool', default=False)
|
debug=dict(type='bool', default=False)
|
||||||
|
|
|
@ -28,16 +28,30 @@ author:
|
||||||
options:
|
options:
|
||||||
name:
|
name:
|
||||||
description:
|
description:
|
||||||
- Name of the plugin to install. In Eleasticsearch >= 2.0, the name can be an URL or file location.
|
- Name of the plugin to install.
|
||||||
required: True
|
required: True
|
||||||
state:
|
state:
|
||||||
description:
|
description:
|
||||||
- Desired state of a plugin.
|
- Desired state of a plugin.
|
||||||
choices: ["present", "absent"]
|
choices: ["present", "absent"]
|
||||||
default: present
|
default: present
|
||||||
|
src:
|
||||||
|
description:
|
||||||
|
- Optionally set the source location to retrieve the plugin from. This can be a file://
|
||||||
|
URL to install from a local file, or a remote URL. If this is not set, the plugin
|
||||||
|
location is just based on the name.
|
||||||
|
- The name parameter must match the descriptor in the plugin ZIP specified.
|
||||||
|
- Is only used if the state would change, which is solely checked based on the name
|
||||||
|
parameter. If, for example, the plugin is already installed, changing this has no
|
||||||
|
effect.
|
||||||
|
- For ES 1.x use url.
|
||||||
|
required: False
|
||||||
|
version_added: "2.7"
|
||||||
url:
|
url:
|
||||||
description:
|
description:
|
||||||
- Set exact URL to download the plugin from (Only works for ES 1.x)
|
- Set exact URL to download the plugin from (Only works for ES 1.x).
|
||||||
|
- For ES 2.x and higher, use src.
|
||||||
|
required: False
|
||||||
timeout:
|
timeout:
|
||||||
description:
|
description:
|
||||||
- "Timeout setting: 30s, 1m, 1h..."
|
- "Timeout setting: 30s, 1m, 1h..."
|
||||||
|
@ -133,8 +147,8 @@ def parse_plugin_repo(string):
|
||||||
return repo
|
return repo
|
||||||
|
|
||||||
|
|
||||||
def is_plugin_present(plugin_dir, working_dir):
|
def is_plugin_present(plugin_name, plugin_dir):
|
||||||
return os.path.isdir(os.path.join(working_dir, plugin_dir))
|
return os.path.isdir(os.path.join(plugin_dir, plugin_name))
|
||||||
|
|
||||||
|
|
||||||
def parse_error(string):
|
def parse_error(string):
|
||||||
|
@ -145,11 +159,12 @@ def parse_error(string):
|
||||||
return string
|
return string
|
||||||
|
|
||||||
|
|
||||||
def install_plugin(module, plugin_bin, plugin_name, version, url, proxy_host, proxy_port, timeout, force):
|
def install_plugin(module, plugin_bin, plugin_name, version, src, url, proxy_host, proxy_port, timeout, force):
|
||||||
cmd_args = [plugin_bin, PACKAGE_STATE_MAP["present"], plugin_name]
|
cmd_args = [plugin_bin, PACKAGE_STATE_MAP["present"]]
|
||||||
|
is_old_command = (os.path.basename(plugin_bin) == 'plugin')
|
||||||
|
|
||||||
# Timeout and version are only valid for plugin, not elasticsearch-plugin
|
# Timeout and version are only valid for plugin, not elasticsearch-plugin
|
||||||
if os.path.basename(plugin_bin) == 'plugin':
|
if is_old_command:
|
||||||
if timeout:
|
if timeout:
|
||||||
cmd_args.append("--timeout %s" % timeout)
|
cmd_args.append("--timeout %s" % timeout)
|
||||||
|
|
||||||
|
@ -160,11 +175,16 @@ def install_plugin(module, plugin_bin, plugin_name, version, url, proxy_host, pr
|
||||||
if proxy_host and proxy_port:
|
if proxy_host and proxy_port:
|
||||||
cmd_args.append("-DproxyHost=%s -DproxyPort=%s" % (proxy_host, proxy_port))
|
cmd_args.append("-DproxyHost=%s -DproxyPort=%s" % (proxy_host, proxy_port))
|
||||||
|
|
||||||
|
# Legacy ES 1.x
|
||||||
if url:
|
if url:
|
||||||
cmd_args.append("--url %s" % url)
|
cmd_args.append("--url %s" % url)
|
||||||
|
|
||||||
if force:
|
if force:
|
||||||
cmd_args.append("--batch")
|
cmd_args.append("--batch")
|
||||||
|
if src:
|
||||||
|
cmd_args.append(src)
|
||||||
|
else:
|
||||||
|
cmd_args.append(plugin_name)
|
||||||
|
|
||||||
cmd = " ".join(cmd_args)
|
cmd = " ".join(cmd_args)
|
||||||
|
|
||||||
|
@ -233,6 +253,7 @@ def main():
|
||||||
argument_spec=dict(
|
argument_spec=dict(
|
||||||
name=dict(required=True),
|
name=dict(required=True),
|
||||||
state=dict(default="present", choices=PACKAGE_STATE_MAP.keys()),
|
state=dict(default="present", choices=PACKAGE_STATE_MAP.keys()),
|
||||||
|
src=dict(default=None),
|
||||||
url=dict(default=None),
|
url=dict(default=None),
|
||||||
timeout=dict(default="1m"),
|
timeout=dict(default="1m"),
|
||||||
force=dict(default=False),
|
force=dict(default=False),
|
||||||
|
@ -242,12 +263,14 @@ def main():
|
||||||
proxy_port=dict(default=None),
|
proxy_port=dict(default=None),
|
||||||
version=dict(default=None)
|
version=dict(default=None)
|
||||||
),
|
),
|
||||||
|
mutually_exclusive=[("src", "url")],
|
||||||
supports_check_mode=True
|
supports_check_mode=True
|
||||||
)
|
)
|
||||||
|
|
||||||
name = module.params["name"]
|
name = module.params["name"]
|
||||||
state = module.params["state"]
|
state = module.params["state"]
|
||||||
url = module.params["url"]
|
url = module.params["url"]
|
||||||
|
src = module.params["src"]
|
||||||
timeout = module.params["timeout"]
|
timeout = module.params["timeout"]
|
||||||
force = module.params["force"]
|
force = module.params["force"]
|
||||||
plugin_bin = module.params["plugin_bin"]
|
plugin_bin = module.params["plugin_bin"]
|
||||||
|
@ -259,14 +282,15 @@ def main():
|
||||||
# Search provided path and system paths for valid binary
|
# Search provided path and system paths for valid binary
|
||||||
plugin_bin = get_plugin_bin(module, plugin_bin)
|
plugin_bin = get_plugin_bin(module, plugin_bin)
|
||||||
|
|
||||||
present = is_plugin_present(parse_plugin_repo(name), plugin_dir)
|
repo = parse_plugin_repo(name)
|
||||||
|
present = is_plugin_present(repo, plugin_dir)
|
||||||
|
|
||||||
# skip if the state is correct
|
# skip if the state is correct
|
||||||
if (present and state == "present") or (state == "absent" and not present):
|
if (present and state == "present") or (state == "absent" and not present):
|
||||||
module.exit_json(changed=False, name=name, state=state)
|
module.exit_json(changed=False, name=name, state=state)
|
||||||
|
|
||||||
if state == "present":
|
if state == "present":
|
||||||
changed, cmd, out, err = install_plugin(module, plugin_bin, name, version, url, proxy_host, proxy_port, timeout, force)
|
changed, cmd, out, err = install_plugin(module, plugin_bin, name, version, src, url, proxy_host, proxy_port, timeout, force)
|
||||||
|
|
||||||
elif state == "absent":
|
elif state == "absent":
|
||||||
changed, cmd, out, err = remove_plugin(module, plugin_bin, name)
|
changed, cmd, out, err = remove_plugin(module, plugin_bin, name)
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
#!/usr/bin/python
|
#!/usr/bin/python
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
# (c) 2016-2017, Cumulus Networks <ce-ceng@cumulusnetworks.com>
|
# (c) 2016-2018, Cumulus Networks <ce-ceng@cumulusnetworks.com>
|
||||||
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||||
|
|
||||||
from __future__ import absolute_import, division, print_function
|
from __future__ import absolute_import, division, print_function
|
||||||
|
@ -185,6 +185,7 @@ def run_nclu(module, command_list, command_string, commit, atomic, abort, descri
|
||||||
# Run all of the net commands
|
# Run all of the net commands
|
||||||
output_lines = []
|
output_lines = []
|
||||||
for line in commands:
|
for line in commands:
|
||||||
|
if line.strip():
|
||||||
output_lines += [command_helper(module, line.strip(), "Failed on line %s" % line)]
|
output_lines += [command_helper(module, line.strip(), "Failed on line %s" % line)]
|
||||||
output = "\n".join(output_lines)
|
output = "\n".join(output_lines)
|
||||||
|
|
||||||
|
|
|
@ -61,8 +61,7 @@ options:
|
||||||
- tls_client_key
|
- tls_client_key
|
||||||
ssl_version:
|
ssl_version:
|
||||||
description:
|
description:
|
||||||
- Provide a valid SSL version number. Default value determined by docker-py, currently 1.0.
|
- Provide a valid SSL version number. Default value determined by ssl.py module.
|
||||||
default: "1.0"
|
|
||||||
tls:
|
tls:
|
||||||
description:
|
description:
|
||||||
- Secure the connection to the API by using TLS without verifying the authenticity of the Docker host
|
- Secure the connection to the API by using TLS without verifying the authenticity of the Docker host
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue