mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-07-02 14:40:19 -07:00
Docker: mention Docker SDK for Python instead of docker/docker-py (#53917)
* Mention Docker SDK for Python instead of docker-py / docker. * Docs fixes. * Add myself as docker_container author. * Use array syntax for running command. * Break long lines. * Avoid failure when docker_version is None. * Improve docker-py vs. docker note in requirements. * Canonicalize Docker SDK for Python upgrade instructions. * Split long line. * Make it clearer which hostnames are meant.
This commit is contained in:
parent
a916b3606c
commit
4ced1c693c
24 changed files with 144 additions and 128 deletions
|
@ -153,7 +153,7 @@ extends_documentation_fragment:
|
|||
- docker.docker_py_1_documentation
|
||||
|
||||
requirements:
|
||||
- "docker-py >= 1.8.0"
|
||||
- "L(Docker SDK for Python,https://docker-py.readthedocs.io/en/stable/) >= 1.8.0 (use L(docker-py,https://pypi.org/project/docker-py/) for Python 2.6)"
|
||||
- "docker-compose >= 1.7.0"
|
||||
- "Docker API >= 1.20"
|
||||
- "PyYAML >= 3.11"
|
||||
|
|
|
@ -69,7 +69,7 @@ extends_documentation_fragment:
|
|||
- docker.docker_py_2_documentation
|
||||
|
||||
requirements:
|
||||
- "docker >= 2.6.0"
|
||||
- "L(Docker SDK for Python,https://docker-py.readthedocs.io/en/stable/) >= 2.6.0"
|
||||
- "Docker API >= 1.30"
|
||||
|
||||
author:
|
||||
|
@ -156,7 +156,7 @@ import hashlib
|
|||
try:
|
||||
from docker.errors import APIError
|
||||
except ImportError:
|
||||
# missing docker-py handled in ansible.module_utils.docker.common
|
||||
# missing Docker SDK for Python handled in ansible.module_utils.docker.common
|
||||
pass
|
||||
|
||||
from ansible.module_utils.docker.common import AnsibleDockerClient, DockerBaseClass, compare_generic
|
||||
|
|
|
@ -293,7 +293,7 @@ options:
|
|||
init:
|
||||
description:
|
||||
- Run an init inside the container that forwards signals and reaps processes.
|
||||
This option requires Docker API 1.25+.
|
||||
This option requires Docker API >= 1.25.
|
||||
type: bool
|
||||
default: no
|
||||
version_added: "2.6"
|
||||
|
@ -429,12 +429,14 @@ options:
|
|||
type: bool
|
||||
oom_score_adj:
|
||||
description:
|
||||
- An integer value containing the score given to the container in order to tune OOM killer preferences.
|
||||
- An integer value containing the score given to the container in order to tune
|
||||
OOM killer preferences.
|
||||
type: int
|
||||
version_added: "2.2"
|
||||
output_logs:
|
||||
description:
|
||||
- If set to true, output of the container command will be printed (only effective when log_driver is set to json-file or journald.
|
||||
- If set to true, output of the container command will be printed (only effective
|
||||
when log_driver is set to json-file or journald.
|
||||
type: bool
|
||||
default: no
|
||||
version_added: "2.7"
|
||||
|
@ -446,7 +448,8 @@ options:
|
|||
pid_mode:
|
||||
description:
|
||||
- Set the PID namespace mode for the container.
|
||||
- Note that docker-py < 2.0 only supports 'host'. Newer versions allow all values supported by the docker daemon.
|
||||
- Note that Docker SDK for Python < 2.0 only supports 'host'. Newer versions of the
|
||||
Docker SDK for Python (docker) allow all values supported by the docker daemon.
|
||||
type: str
|
||||
pids_limit:
|
||||
description:
|
||||
|
@ -579,9 +582,9 @@ options:
|
|||
will be set to this value.
|
||||
- When the container is stopped, will be used as a timeout for stopping the
|
||||
container. In case the container has a custom C(StopTimeout) configuration,
|
||||
the behavior depends on the version of docker. New versions of docker will
|
||||
always use the container's configured C(StopTimeout) value if it has been
|
||||
configured.
|
||||
the behavior depends on the version of the docker daemon. New versions of
|
||||
the docker daemon will always use the container's configured C(StopTimeout)
|
||||
value if it has been configured.
|
||||
type: int
|
||||
trust_image_content:
|
||||
description:
|
||||
|
@ -622,7 +625,7 @@ options:
|
|||
- "Use docker CLI-style syntax: C(/host:/container[:mode])"
|
||||
- "Mount modes can be a comma-separated list of various modes such as C(ro), C(rw), C(consistent),
|
||||
C(delegated), C(cached), C(rprivate), C(private), C(rshared), C(shared), C(rslave), C(slave).
|
||||
Note that docker might not support all modes and combinations of such modes."
|
||||
Note that the docker daemon might not support all modes and combinations of such modes."
|
||||
- SELinux hosts can additionally use C(z) or C(Z) to use a shared or
|
||||
private label for the volume.
|
||||
- "Note that Ansible 2.7 and earlier only supported one mode, which had to be one of C(ro), C(rw),
|
||||
|
@ -654,9 +657,10 @@ author:
|
|||
- "Daan Oosterveld (@dusdanig)"
|
||||
- "Chris Houseknecht (@chouseknecht)"
|
||||
- "Kassian Sun (@kassiansun)"
|
||||
- "Felix Fontein (@felixfontein)"
|
||||
|
||||
requirements:
|
||||
- "docker-py >= 1.8.0"
|
||||
- "L(Docker SDK for Python,https://docker-py.readthedocs.io/en/stable/) >= 1.8.0 (use L(docker-py,https://pypi.org/project/docker-py/) for Python 2.6)"
|
||||
- "Docker API >= 1.20"
|
||||
'''
|
||||
|
||||
|
@ -945,7 +949,7 @@ try:
|
|||
from docker.utils.types import Ulimit, LogConfig
|
||||
from docker.errors import APIError, NotFound
|
||||
except Exception:
|
||||
# missing docker-py handled in ansible.module_utils.docker.common
|
||||
# missing Docker SDK for Python handled in ansible.module_utils.docker.common
|
||||
pass
|
||||
|
||||
|
||||
|
@ -1351,7 +1355,7 @@ class TaskParameters(DockerBaseClass):
|
|||
|
||||
if self.client.docker_py_version >= LooseVersion('1.9') and self.client.docker_api_version >= LooseVersion('1.22'):
|
||||
# blkio_weight can always be updated, but can only be set on creation
|
||||
# when docker-py and docker API are new enough
|
||||
# when Docker SDK for Python and Docker API are new enough
|
||||
host_config_params['blkio_weight'] = 'blkio_weight'
|
||||
|
||||
if self.client.docker_py_version >= LooseVersion('3.0'):
|
||||
|
@ -1819,15 +1823,15 @@ class Container(DockerBaseClass):
|
|||
config_mapping['log_options'] = log_config.get('Config')
|
||||
|
||||
if self.parameters.client.option_minimal_versions['auto_remove']['supported']:
|
||||
# auto_remove is only supported in docker>=2; unfortunately it has a default
|
||||
# value, that's why we have to jump through the hoops here
|
||||
# auto_remove is only supported in Docker SDK for Python >= 2.0.0; unfortunately
|
||||
# it has a default value, that's why we have to jump through the hoops here
|
||||
config_mapping['auto_remove'] = host_config.get('AutoRemove')
|
||||
|
||||
if self.parameters.client.option_minimal_versions['stop_timeout']['supported']:
|
||||
# stop_timeout is only supported in docker>=2.1. Note that stop_timeout
|
||||
# has a hybrid role, in that it used to be something only used for stopping
|
||||
# containers, and is now also used as a container property. That's why
|
||||
# it needs special handling here.
|
||||
# stop_timeout is only supported in Docker SDK for Python >= 2.1. Note that
|
||||
# stop_timeout has a hybrid role, in that it used to be something only used
|
||||
# for stopping containers, and is now also used as a container property.
|
||||
# That's why it needs special handling here.
|
||||
config_mapping['stop_timeout'] = config.get('StopTimeout')
|
||||
|
||||
if self.parameters.client.docker_api_version < LooseVersion('1.22'):
|
||||
|
@ -2544,8 +2548,8 @@ class ContainerManager(DockerBaseClass):
|
|||
pass
|
||||
except APIError as exc:
|
||||
if 'Unpause the container before stopping or killing' in exc.explanation:
|
||||
# New docker versions do not allow containers to be removed if they are paused
|
||||
# Make sure we don't end up in an infinite loop
|
||||
# New docker daemon versions do not allow containers to be removed
|
||||
# if they are paused. Make sure we don't end up in an infinite loop.
|
||||
if count == 3:
|
||||
self.fail("Error removing container %s (tried to unpause three times): %s" % (container_id, str(exc)))
|
||||
count += 1
|
||||
|
@ -2611,8 +2615,8 @@ class ContainerManager(DockerBaseClass):
|
|||
response = self.client.stop(container_id)
|
||||
except APIError as exc:
|
||||
if 'Unpause the container before stopping or killing' in exc.explanation:
|
||||
# New docker versions do not allow containers to be removed if they are paused
|
||||
# Make sure we don't end up in an infinite loop
|
||||
# New docker daemon versions do not allow containers to be removed
|
||||
# if they are paused. Make sure we don't end up in an infinite loop.
|
||||
if count == 3:
|
||||
self.fail("Error removing container %s (tried to unpause three times): %s" % (container_id, str(exc)))
|
||||
count += 1
|
||||
|
@ -2754,14 +2758,14 @@ class AnsibleDockerClientContainer(AnsibleDockerClient):
|
|||
if stop_timeout_needed_for_update and not stop_timeout_supported:
|
||||
# We warn (instead of fail) since in older versions, stop_timeout was not used
|
||||
# to update the container's configuration, but only when stopping a container.
|
||||
self.module.warn("docker or docker-py version is %s. Minimum version required is 2.1 to update "
|
||||
self.module.warn("Docker SDK for Python's version is %s. Minimum version required is 2.1 to update "
|
||||
"the container's stop_timeout configuration. "
|
||||
"If you use the 'docker-py' module, you have to switch to the docker 'Python' package." % (docker_version,))
|
||||
"If you use the 'docker-py' module, you have to switch to the 'docker' Python package." % (docker_version,))
|
||||
else:
|
||||
if stop_timeout_needed_for_update and not stop_timeout_supported:
|
||||
# We warn (instead of fail) since in older versions, stop_timeout was not used
|
||||
# to update the container's configuration, but only when stopping a container.
|
||||
self.module.warn("docker API version is %s. Minimum version required is 1.25 to set or "
|
||||
self.module.warn("Docker API version is %s. Minimum version required is 1.25 to set or "
|
||||
"update the container's stop_timeout configuration." % (self.docker_api_version_str,))
|
||||
self.option_minimal_versions['stop_timeout']['supported'] = stop_timeout_supported
|
||||
|
||||
|
|
|
@ -40,7 +40,7 @@ author:
|
|||
- "Felix Fontein (@felixfontein)"
|
||||
|
||||
requirements:
|
||||
- "docker-py >= 1.8.0"
|
||||
- "L(Docker SDK for Python,https://docker-py.readthedocs.io/en/stable/) >= 1.8.0 (use L(docker-py,https://pypi.org/project/docker-py/) for Python 2.6)"
|
||||
- "Docker API >= 1.20"
|
||||
'''
|
||||
|
||||
|
|
|
@ -99,7 +99,7 @@ author:
|
|||
- Piotr Wojciechowski (@WojciechowskiPiotr)
|
||||
|
||||
requirements:
|
||||
- "docker-py >= 1.10.0"
|
||||
- "L(Docker SDK for Python,https://docker-py.readthedocs.io/en/stable/) >= 1.10.0 (use L(docker-py,https://pypi.org/project/docker-py/) for Python 2.6)"
|
||||
- "Docker API >= 1.21"
|
||||
'''
|
||||
|
||||
|
@ -191,7 +191,7 @@ from ansible.module_utils._text import to_native
|
|||
try:
|
||||
from docker.errors import APIError
|
||||
except ImportError:
|
||||
# missing docker-py handled in ansible.module_utils.docker.common
|
||||
# Missing Docker SDK for Python handled in ansible.module_utils.docker.common
|
||||
pass
|
||||
|
||||
from ansible.module_utils.docker.common import clean_dict_booleans_for_docker_api
|
||||
|
|
|
@ -241,11 +241,13 @@ options:
|
|||
- When C(absent) an image will be removed. Use the force option to un-tag and remove all images
|
||||
matching the provided name.
|
||||
- When C(present) check if an image exists using the provided name and tag. If the image is not found or the
|
||||
force option is used, the image will either be pulled, built or loaded. By default the image will be pulled
|
||||
from Docker Hub. To build the image, provide a path value set to a directory containing a context and
|
||||
Dockerfile. To load an image, specify load_path to provide a path to an archive file. To tag an image to a
|
||||
repository, provide a repository path. If the name contains a repository path, it will be pushed.
|
||||
- "NOTE: C(build) is DEPRECATED and will be removed in release 2.11. Specifying C(build) will behave the
|
||||
force option is used, the image will either be pulled, built or loaded, depending on the I(source) option.
|
||||
- By default the image will be pulled from Docker Hub, or the registry specified in the image's name. Note that
|
||||
this will change in Ansible 2.12, so to make sure that you are pulling, set I(source) to C(pull). To build
|
||||
the image, provide a I(path) value set to a directory containing a context and Dockerfile, and set I(source)
|
||||
to C(build). To load an image, specify I(load_path) to provide a path to an archive file. To tag an image to
|
||||
a repository, provide a I(repository) path. If the name contains a repository path, it will be pushed.
|
||||
- "NOTE: C(state=build) is DEPRECATED and will be removed in release 2.11. Specifying C(build) will behave the
|
||||
same as C(present)."
|
||||
type: str
|
||||
default: present
|
||||
|
@ -293,7 +295,7 @@ options:
|
|||
version_added: "2.1"
|
||||
use_tls:
|
||||
description:
|
||||
- "DEPRECATED. Whether to use tls to connect to the docker server. Set to
|
||||
- "DEPRECATED. Whether to use tls to connect to the docker daemon. Set to
|
||||
C(encrypt) to use TLS. And set to C(verify) to use TLS and verify that
|
||||
the server's certificate is valid for the server."
|
||||
- "NOTE: If you specify this option, it will set the value of the I(tls) or
|
||||
|
@ -311,7 +313,7 @@ extends_documentation_fragment:
|
|||
- docker.docker_py_1_documentation
|
||||
|
||||
requirements:
|
||||
- "docker-py >= 1.8.0"
|
||||
- "L(Docker SDK for Python,https://docker-py.readthedocs.io/en/stable/) >= 1.8.0 (use L(docker-py,https://pypi.org/project/docker-py/) for Python 2.6)"
|
||||
- "Docker API >= 1.20"
|
||||
|
||||
author:
|
||||
|
@ -412,20 +414,23 @@ image:
|
|||
import os
|
||||
import re
|
||||
|
||||
from distutils.version import LooseVersion
|
||||
|
||||
from ansible.module_utils.docker.common import (
|
||||
HAS_DOCKER_PY_2, HAS_DOCKER_PY_3, AnsibleDockerClient, DockerBaseClass, is_image_name_id,
|
||||
docker_version, AnsibleDockerClient, DockerBaseClass, is_image_name_id,
|
||||
)
|
||||
from ansible.module_utils._text import to_native
|
||||
|
||||
try:
|
||||
if HAS_DOCKER_PY_2 or HAS_DOCKER_PY_3:
|
||||
from docker.auth import resolve_repository_name
|
||||
else:
|
||||
from docker.auth.auth import resolve_repository_name
|
||||
from docker.utils.utils import parse_repository_tag
|
||||
except ImportError:
|
||||
# missing docker-py handled in docker_common
|
||||
pass
|
||||
if docker_version is not None:
|
||||
try:
|
||||
if LooseVersion(docker_version) >= LooseVersion('2.0.0'):
|
||||
from docker.auth import resolve_repository_name
|
||||
else:
|
||||
from docker.auth.auth import resolve_repository_name
|
||||
from docker.utils.utils import parse_repository_tag
|
||||
except ImportError:
|
||||
# missing Docker SDK for Python handled in module_utils.docker.common
|
||||
pass
|
||||
|
||||
|
||||
class ImageManager(DockerBaseClass):
|
||||
|
@ -587,7 +592,7 @@ class ImageManager(DockerBaseClass):
|
|||
|
||||
try:
|
||||
with open(self.archive_path, 'wb') as fd:
|
||||
if HAS_DOCKER_PY_3:
|
||||
if self.client.docker_py_version >= LooseVersion('3.0.0'):
|
||||
for chunk in image:
|
||||
fd.write(chunk)
|
||||
else:
|
||||
|
@ -704,7 +709,7 @@ class ImageManager(DockerBaseClass):
|
|||
dockerfile=self.dockerfile,
|
||||
decode=True,
|
||||
)
|
||||
if not HAS_DOCKER_PY_3:
|
||||
if self.client.docker_py_version < LooseVersion('3.0.0'):
|
||||
params['stream'] = True
|
||||
build_output = []
|
||||
if self.tag:
|
||||
|
|
|
@ -37,7 +37,7 @@ extends_documentation_fragment:
|
|||
- docker.docker_py_1_documentation
|
||||
|
||||
requirements:
|
||||
- "docker-py >= 1.8.0"
|
||||
- "L(Docker SDK for Python,https://docker-py.readthedocs.io/en/stable/) >= 1.8.0 (use L(docker-py,https://pypi.org/project/docker-py/) for Python 2.6)"
|
||||
- "Docker API >= 1.20"
|
||||
|
||||
author:
|
||||
|
@ -154,7 +154,7 @@ images:
|
|||
try:
|
||||
from docker import utils
|
||||
except ImportError:
|
||||
# missing docker-py handled in ansible.module_utils.docker.common
|
||||
# missing Docker SDK for Python handled in ansible.module_utils.docker.common
|
||||
pass
|
||||
|
||||
from ansible.module_utils.docker.common import AnsibleDockerClient, DockerBaseClass, is_image_name_id
|
||||
|
|
|
@ -24,7 +24,7 @@ description:
|
|||
- Provides functionality similar to the "docker login" command.
|
||||
- Authenticate with a docker registry and add the credentials to your local Docker config file. Adding the
|
||||
credentials to the config files allows future connections to the registry using tools such as Ansible's Docker
|
||||
modules, the Docker CLI and docker-py without needing to provide credentials.
|
||||
modules, the Docker CLI and Docker SDK for Python without needing to provide credentials.
|
||||
- Running in check mode will perform the authentication without updating the config file.
|
||||
options:
|
||||
registry_url:
|
||||
|
@ -71,7 +71,7 @@ options:
|
|||
- This controls the current state of the user. C(present) will login in a user, C(absent) will log them out.
|
||||
- To logout you only need the registry server, which defaults to DockerHub.
|
||||
- Before 2.1 you could ONLY log in.
|
||||
- docker does not support 'logout' with a custom config file.
|
||||
- Docker does not support 'logout' with a custom config file.
|
||||
type: str
|
||||
default: 'present'
|
||||
choices: ['present', 'absent']
|
||||
|
@ -80,7 +80,7 @@ extends_documentation_fragment:
|
|||
- docker
|
||||
- docker.docker_py_1_documentation
|
||||
requirements:
|
||||
- "docker-py >= 1.8.0"
|
||||
- "L(Docker SDK for Python,https://docker-py.readthedocs.io/en/stable/) >= 1.8.0 (use L(docker-py,https://pypi.org/project/docker-py/) for Python 2.6)"
|
||||
- "Docker API >= 1.20"
|
||||
- "Only to be able to logout, that is for I(state) = C(absent): the C(docker) command line utility"
|
||||
author:
|
||||
|
@ -203,11 +203,10 @@ class LoginManager(DockerBaseClass):
|
|||
:return: None
|
||||
'''
|
||||
|
||||
cmd = "%s logout " % self.client.module.get_bin_path('docker', True)
|
||||
cmd = [self.client.module.get_bin_path('docker', True), "logout", self.registry_url]
|
||||
# TODO: docker does not support config file in logout, restore this when they do
|
||||
# if self.config_path and self.config_file_exists(self.config_path):
|
||||
# cmd += "--config '%s' " % self.config_path
|
||||
cmd += "'%s'" % self.registry_url
|
||||
# cmd.extend(["--config", self.config_path])
|
||||
|
||||
(rc, out, err) = self.client.module.run_command(cmd)
|
||||
if rc != 0:
|
||||
|
|
|
@ -89,7 +89,7 @@ options:
|
|||
description:
|
||||
- List of IPAM config blocks. Consult
|
||||
L(Docker docs,https://docs.docker.com/compose/compose-file/compose-file-v2/#ipam) for valid options and values.
|
||||
Note that I(iprange) is spelled differently here (we use the notation from the Docker Python SDK).
|
||||
Note that I(iprange) is spelled differently here (we use the notation from the Docker SDK for Python).
|
||||
type: list
|
||||
suboptions:
|
||||
subnet:
|
||||
|
@ -165,7 +165,7 @@ author:
|
|||
- "Dave Bendit (@DBendit)"
|
||||
|
||||
requirements:
|
||||
- "docker-py >= 1.10.0"
|
||||
- "L(Docker SDK for Python,https://docker-py.readthedocs.io/en/stable/) >= 1.10.0 (use L(docker-py,https://pypi.org/project/docker-py/) for Python 2.6)"
|
||||
- "The docker server >= 1.10.0"
|
||||
'''
|
||||
|
||||
|
@ -268,7 +268,7 @@ try:
|
|||
if LooseVersion(docker_version) >= LooseVersion('2.0.0'):
|
||||
from docker.types import IPAMPool, IPAMConfig
|
||||
except Exception:
|
||||
# missing docker-py handled in ansible.module_utils.docker.common
|
||||
# missing Docker SDK for Python handled in ansible.module_utils.docker.common
|
||||
pass
|
||||
|
||||
|
||||
|
|
|
@ -40,7 +40,7 @@ author:
|
|||
- "Dave Bendit (@DBendit)"
|
||||
|
||||
requirements:
|
||||
- "docker-py >= 1.8.0"
|
||||
- "L(Docker SDK for Python,https://docker-py.readthedocs.io/en/stable/) >= 1.8.0 (use L(docker-py,https://pypi.org/project/docker-py/) for Python 2.6)"
|
||||
- "Docker API >= 1.21"
|
||||
'''
|
||||
|
||||
|
|
|
@ -76,7 +76,7 @@ extends_documentation_fragment:
|
|||
- docker
|
||||
- docker.docker_py_1_documentation
|
||||
requirements:
|
||||
- "docker-py >= 2.4.0"
|
||||
- "L(Docker SDK for Python,https://docker-py.readthedocs.io/en/stable/) >= 2.4.0"
|
||||
- Docker API >= 1.25
|
||||
author:
|
||||
- Piotr Wojciechowski (@WojciechowskiPiotr)
|
||||
|
@ -132,7 +132,7 @@ node_facts:
|
|||
try:
|
||||
from docker.errors import APIError
|
||||
except ImportError:
|
||||
# missing docker-py handled in ansible.module_utils.docker.common
|
||||
# missing Docker SDK for Python handled in ansible.module_utils.docker.common
|
||||
pass
|
||||
|
||||
from ansible.module_utils.docker.common import (
|
||||
|
|
|
@ -48,7 +48,7 @@ author:
|
|||
- Piotr Wojciechowski (@wojciechowskipiotr)
|
||||
|
||||
requirements:
|
||||
- "docker-py >= 2.4.0"
|
||||
- "L(Docker SDK for Python,https://docker-py.readthedocs.io/en/stable/) >= 2.4.0"
|
||||
- "Docker API >= 1.24"
|
||||
'''
|
||||
|
||||
|
@ -92,7 +92,7 @@ from ansible.module_utils.docker.swarm import AnsibleDockerSwarmClient
|
|||
try:
|
||||
from docker.errors import APIError, NotFound
|
||||
except ImportError:
|
||||
# missing docker-py handled in ansible.module_utils.docker.common
|
||||
# missing Docker SDK for Python handled in ansible.module_utils.docker.common
|
||||
pass
|
||||
|
||||
|
||||
|
|
|
@ -74,7 +74,7 @@ options:
|
|||
builder_cache:
|
||||
description:
|
||||
- Whether to prune the builder cache.
|
||||
- Requires version 3.3.0 of the Python Docker SDK or newer.
|
||||
- Requires version 3.3.0 of the Docker SDK for Python or newer.
|
||||
type: bool
|
||||
default: no
|
||||
|
||||
|
@ -86,7 +86,7 @@ author:
|
|||
- "Felix Fontein (@felixfontein)"
|
||||
|
||||
requirements:
|
||||
- "docker >= 2.1.0"
|
||||
- "L(Docker SDK for Python,https://docker-py.readthedocs.io/en/stable/) >= 2.1.0"
|
||||
- "Docker API >= 1.25"
|
||||
'''
|
||||
|
||||
|
@ -184,7 +184,7 @@ from ansible.module_utils.docker.common import AnsibleDockerClient
|
|||
try:
|
||||
from ansible.module_utils.docker.common import docker_version, clean_dict_booleans_for_docker_api
|
||||
except Exception as dummy:
|
||||
# missing docker-py handled in ansible.module_utils.docker.common
|
||||
# missing Docker SDK for Python handled in ansible.module_utils.docker.common
|
||||
pass
|
||||
|
||||
|
||||
|
@ -211,7 +211,7 @@ def main():
|
|||
# Version checks
|
||||
cache_min_version = '3.3.0'
|
||||
if client.module.params['builder_cache'] and client.docker_py_version < LooseVersion(cache_min_version):
|
||||
msg = "Error: docker version is %s. Minimum version required for builds option is %s. Use `pip install --upgrade docker` to upgrade."
|
||||
msg = "Error: Docker SDK for Python's version is %s. Minimum version required for builds option is %s. Use `pip install --upgrade docker` to upgrade."
|
||||
client.fail(msg % (docker_version, cache_min_version))
|
||||
|
||||
result = dict()
|
||||
|
|
|
@ -21,7 +21,7 @@ short_description: Manage docker secrets.
|
|||
version_added: "2.4"
|
||||
|
||||
description:
|
||||
- Create and remove Docker secrets in a Swarm environment. Similar to `docker secret create` and `docker secret rm`.
|
||||
- Create and remove Docker secrets in a Swarm environment. Similar to C(docker secret create) and C(docker secret rm).
|
||||
- Adds to the metadata of new secrets 'ansible_key', an encrypted hash representation of the data, which is then used
|
||||
in future runs to test if a secret has changed. If 'ansible_key is not present, then a secret will not be updated
|
||||
unless the C(force) option is set.
|
||||
|
@ -70,7 +70,7 @@ extends_documentation_fragment:
|
|||
- docker.docker_py_2_documentation
|
||||
|
||||
requirements:
|
||||
- "docker >= 2.1.0"
|
||||
- "L(Docker SDK for Python,https://docker-py.readthedocs.io/en/stable/) >= 2.1.0"
|
||||
- "Docker API >= 1.25"
|
||||
|
||||
author:
|
||||
|
@ -156,7 +156,7 @@ import hashlib
|
|||
try:
|
||||
from docker.errors import APIError
|
||||
except ImportError:
|
||||
# missing docker-py handled in ansible.module_utils.docker.common
|
||||
# missing Docker SDK for Python handled in ansible.module_utils.docker.common
|
||||
pass
|
||||
|
||||
from ansible.module_utils.docker.common import AnsibleDockerClient, DockerBaseClass, compare_generic
|
||||
|
|
|
@ -52,7 +52,7 @@ options:
|
|||
- Set to C(join), to join an existing cluster.
|
||||
- Set to C(absent), to leave an existing cluster.
|
||||
- Set to C(remove), to remove an absent node from the cluster.
|
||||
Note that removing requires docker-py >= 2.4.0.
|
||||
Note that removing requires Docker SDK for Python >= 2.4.0.
|
||||
- Set to C(inspect) to display swarm informations.
|
||||
type: str
|
||||
required: yes
|
||||
|
@ -164,7 +164,7 @@ extends_documentation_fragment:
|
|||
- docker
|
||||
- docker.docker_py_1_documentation
|
||||
requirements:
|
||||
- "docker-py >= 1.10.0"
|
||||
- "L(Docker SDK for Python,https://docker-py.readthedocs.io/en/stable/) >= 1.10.0 (use L(docker-py,https://pypi.org/project/docker-py/) for Python 2.6)"
|
||||
- Docker API >= 1.25
|
||||
author:
|
||||
- Thierry Bouvet (@tbouvet)
|
||||
|
@ -243,7 +243,7 @@ import json
|
|||
try:
|
||||
from docker.errors import APIError
|
||||
except ImportError:
|
||||
# missing docker-py handled in ansible.module_utils.docker.common
|
||||
# missing Docker SDK for Python handled in ansible.module_utils.docker.common
|
||||
pass
|
||||
|
||||
from ansible.module_utils.docker.common import (
|
||||
|
|
|
@ -82,7 +82,7 @@ extends_documentation_fragment:
|
|||
- docker.docker_py_1_documentation
|
||||
|
||||
requirements:
|
||||
- "docker-py >= 1.10.0"
|
||||
- "L(Docker SDK for Python,https://docker-py.readthedocs.io/en/stable/) >= 1.10.0 (use L(docker-py,https://pypi.org/project/docker-py/) for Python 2.6)"
|
||||
- "Docker API >= 1.24"
|
||||
'''
|
||||
|
||||
|
@ -177,7 +177,7 @@ tasks:
|
|||
try:
|
||||
from docker.errors import APIError, NotFound
|
||||
except ImportError:
|
||||
# missing docker-py handled in ansible.module_utils.docker_common
|
||||
# missing Docker SDK for Python handled in ansible.module_utils.docker_common
|
||||
pass
|
||||
|
||||
from ansible.module_utils._text import to_native
|
||||
|
|
|
@ -776,10 +776,10 @@ extends_documentation_fragment:
|
|||
- docker
|
||||
- docker.docker_py_2_documentation
|
||||
requirements:
|
||||
- "docker >= 2.0.2"
|
||||
- "L(Docker SDK for Python,https://docker-py.readthedocs.io/en/stable/) >= 2.0.2"
|
||||
- "Docker API >= 1.24"
|
||||
notes:
|
||||
- "Images will only resolve to the latest digest when using Docker API >= 1.30 and docker-py >= 3.2.0.
|
||||
- "Images will only resolve to the latest digest when using Docker API >= 1.30 and Docker SDK for Python >= 3.2.0.
|
||||
When using older versions use C(force_update: true) to trigger the swarm to resolve a new image."
|
||||
'''
|
||||
|
||||
|
@ -1078,7 +1078,7 @@ try:
|
|||
NotFound,
|
||||
)
|
||||
except ImportError:
|
||||
# missing docker-py handled in ansible.module_utils.docker.common
|
||||
# missing Docker SDK for Python handled in ansible.module_utils.docker.common
|
||||
pass
|
||||
|
||||
|
||||
|
@ -2257,6 +2257,7 @@ class DockerServiceManager(object):
|
|||
**service_data
|
||||
)
|
||||
# Prior to Docker SDK 4.0.0 no warnings were returned and will thus be ignored.
|
||||
# (see https://github.com/docker/docker-py/pull/2272)
|
||||
self.client.report_warnings(result, ['Warning'])
|
||||
|
||||
def create_service(self, name, service):
|
||||
|
|
|
@ -92,7 +92,7 @@ author:
|
|||
- Alex Grönholm (@agronholm)
|
||||
|
||||
requirements:
|
||||
- "docker-py >= 1.10.0"
|
||||
- "L(Docker SDK for Python,https://docker-py.readthedocs.io/en/stable/) >= 1.10.0 (use L(docker-py,https://pypi.org/project/docker-py/) for Python 2.6)"
|
||||
- "The docker server >= 1.9.0"
|
||||
'''
|
||||
|
||||
|
@ -128,7 +128,7 @@ volume:
|
|||
try:
|
||||
from docker.errors import APIError
|
||||
except ImportError:
|
||||
# missing docker-py handled in ansible.module_utils.docker.common
|
||||
# missing Docker SDK for Python handled in ansible.module_utils.docker.common
|
||||
pass
|
||||
|
||||
from ansible.module_utils.docker.common import (
|
||||
|
|
|
@ -36,7 +36,7 @@ author:
|
|||
- Felix Fontein (@felixfontein)
|
||||
|
||||
requirements:
|
||||
- "docker-py >= 1.8.0"
|
||||
- "L(Docker SDK for Python,https://docker-py.readthedocs.io/en/stable/) >= 1.8.0 (use L(docker-py,https://pypi.org/project/docker-py/) for Python 2.6)"
|
||||
- "Docker API >= 1.21"
|
||||
'''
|
||||
|
||||
|
@ -83,7 +83,7 @@ volume:
|
|||
try:
|
||||
from docker.errors import NotFound
|
||||
except ImportError:
|
||||
# missing docker-py handled in ansible.module_utils.docker.common
|
||||
# missing Docker SDK for Python handled in ansible.module_utils.docker.common
|
||||
pass
|
||||
|
||||
from ansible.module_utils.docker.common import AnsibleDockerClient
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue