Add use_ssh_client flag (#114)

* Add use_ssh_client option.

* Unrelated cleanup (unneeded imports).

* Add SSH connection tests.
This commit is contained in:
Felix Fontein
2021-04-02 10:14:09 +02:00
committed by GitHub
parent bc096a9ec9
commit e9b10ee0a4
11 changed files with 153 additions and 70 deletions
+1 -3
View File
@@ -134,9 +134,7 @@ import re
from ansible.errors import AnsibleError
from ansible.module_utils._text import to_native
from ansible_collections.community.docker.plugins.module_utils.common import update_tls_hostname, get_connect_params
from ansible.plugins.inventory import BaseInventoryPlugin, Constructable
from ansible.parsing.utils.addresses import parse_address
from ansible_collections.community.docker.plugins.module_utils.common import (
RequestException,
@@ -146,7 +144,7 @@ from ansible_collections.community.docker.plugins.plugin_utils.common import (
)
try:
from docker.errors import DockerException, APIError, NotFound
from docker.errors import DockerException, APIError
except Exception:
# missing Docker SDK for Python handled in ansible_collections.community.docker.plugins.module_utils.common
pass
+8
View File
@@ -86,6 +86,13 @@ DOCUMENTATION = '''
type: int
default: 60
aliases: [ time_out ]
use_ssh_client:
description:
- For SSH transports, use the C(ssh) CLI tool instead of paramiko.
- Requires Docker SDK for Python 4.4.0 or newer.
type: bool
default: no
version_added: 1.5.0
include_host_uri:
description: Toggle to return the additional attribute C(ansible_host_uri) which contains the URI of the
swarm leader in format of C(tcp://172.16.0.1:2376). This value may be used without additional
@@ -171,6 +178,7 @@ class InventoryModule(BaseInventoryPlugin, Constructable):
api_version=self.get_option('api_version'),
timeout=self.get_option('timeout'),
ssl_version=self.get_option('ssl_version'),
use_ssh_client=self.get_option('use_ssh_client'),
debug=None,
)
update_tls_hostname(raw_params)