mirror of
https://github.com/ansible-collections/community.docker.git
synced 2025-12-17 20:38:42 +00:00
Implement all remaining deprecations for 3.0.0 (#400)
* Remove support for Ansible 2.9 and ansible-base 2.10. * Remove Ansible 2.9 compatiblity code. * Remove docker-compose from EE. * Drop support for Python 2.6. Stop advertising docker-py for Python 2.6. * Drop support for API versions 1.20 to 1.24. * Fix condition.
This commit is contained in:
parent
4d508b4c37
commit
623786c659
@ -94,28 +94,6 @@ stages:
|
|||||||
test: '2.11/sanity/1'
|
test: '2.11/sanity/1'
|
||||||
- name: Units
|
- name: Units
|
||||||
test: '2.11/units/1'
|
test: '2.11/units/1'
|
||||||
- stage: Ansible_2_10
|
|
||||||
displayName: Sanity & Units 2.10
|
|
||||||
dependsOn: []
|
|
||||||
jobs:
|
|
||||||
- template: templates/matrix.yml
|
|
||||||
parameters:
|
|
||||||
targets:
|
|
||||||
- name: Sanity
|
|
||||||
test: '2.10/sanity/1'
|
|
||||||
- name: Units
|
|
||||||
test: '2.10/units/1'
|
|
||||||
- stage: Ansible_2_9
|
|
||||||
displayName: Sanity & Units 2.9
|
|
||||||
dependsOn: []
|
|
||||||
jobs:
|
|
||||||
- template: templates/matrix.yml
|
|
||||||
parameters:
|
|
||||||
targets:
|
|
||||||
- name: Sanity
|
|
||||||
test: '2.9/sanity/1'
|
|
||||||
- name: Units
|
|
||||||
test: '2.9/units/1'
|
|
||||||
|
|
||||||
### Docker
|
### Docker
|
||||||
- stage: Docker_devel
|
- stage: Docker_devel
|
||||||
@ -168,6 +146,8 @@ stages:
|
|||||||
parameters:
|
parameters:
|
||||||
testFormat: 2.12/linux/{0}
|
testFormat: 2.12/linux/{0}
|
||||||
targets:
|
targets:
|
||||||
|
- name: Fedora 33
|
||||||
|
test: fedora33
|
||||||
- name: Fedora 34
|
- name: Fedora 34
|
||||||
test: fedora34
|
test: fedora34
|
||||||
- name: Ubuntu 18.04
|
- name: Ubuntu 18.04
|
||||||
@ -182,39 +162,11 @@ stages:
|
|||||||
- template: templates/matrix.yml
|
- template: templates/matrix.yml
|
||||||
parameters:
|
parameters:
|
||||||
testFormat: 2.11/linux/{0}
|
testFormat: 2.11/linux/{0}
|
||||||
targets:
|
|
||||||
- name: Fedora 33
|
|
||||||
test: fedora33
|
|
||||||
- name: Alpine 3
|
|
||||||
test: alpine3
|
|
||||||
groups:
|
|
||||||
- 4
|
|
||||||
- 5
|
|
||||||
- stage: Docker_2_10
|
|
||||||
displayName: Docker 2.10
|
|
||||||
dependsOn: []
|
|
||||||
jobs:
|
|
||||||
- template: templates/matrix.yml
|
|
||||||
parameters:
|
|
||||||
testFormat: 2.10/linux/{0}
|
|
||||||
targets:
|
targets:
|
||||||
- name: Fedora 32
|
- name: Fedora 32
|
||||||
test: fedora32
|
test: fedora32
|
||||||
- name: Ubuntu 16.04
|
- name: Alpine 3
|
||||||
test: ubuntu1604
|
test: alpine3
|
||||||
groups:
|
|
||||||
- 4
|
|
||||||
- 5
|
|
||||||
- stage: Docker_2_9
|
|
||||||
displayName: Docker 2.9
|
|
||||||
dependsOn: []
|
|
||||||
jobs:
|
|
||||||
- template: templates/matrix.yml
|
|
||||||
parameters:
|
|
||||||
testFormat: 2.9/linux/{0}
|
|
||||||
targets:
|
|
||||||
- name: Fedora 31
|
|
||||||
test: fedora31
|
|
||||||
groups:
|
groups:
|
||||||
- 4
|
- 4
|
||||||
- 5
|
- 5
|
||||||
@ -304,36 +256,6 @@ stages:
|
|||||||
- 3
|
- 3
|
||||||
- 4
|
- 4
|
||||||
- 5
|
- 5
|
||||||
- stage: Remote_2_10
|
|
||||||
displayName: Remote 2.10
|
|
||||||
dependsOn: []
|
|
||||||
jobs:
|
|
||||||
- template: templates/matrix.yml
|
|
||||||
parameters:
|
|
||||||
nameFormat: RHEL {0}
|
|
||||||
testFormat: 2.10/rhel/{0}
|
|
||||||
targets:
|
|
||||||
- test: '7.8'
|
|
||||||
groups:
|
|
||||||
- 1
|
|
||||||
- 2
|
|
||||||
- 3
|
|
||||||
- 4
|
|
||||||
- stage: Remote_2_9
|
|
||||||
displayName: Remote 2.9
|
|
||||||
dependsOn: []
|
|
||||||
jobs:
|
|
||||||
- template: templates/matrix.yml
|
|
||||||
parameters:
|
|
||||||
nameFormat: RHEL {0}
|
|
||||||
testFormat: 2.9/rhel/{0}
|
|
||||||
targets:
|
|
||||||
- test: '8.2'
|
|
||||||
groups:
|
|
||||||
- 1
|
|
||||||
- 2
|
|
||||||
- 3
|
|
||||||
- 4
|
|
||||||
|
|
||||||
## Finally
|
## Finally
|
||||||
|
|
||||||
@ -344,20 +266,14 @@ stages:
|
|||||||
- Ansible_2_13
|
- Ansible_2_13
|
||||||
- Ansible_2_12
|
- Ansible_2_12
|
||||||
- Ansible_2_11
|
- Ansible_2_11
|
||||||
- Ansible_2_10
|
|
||||||
- Ansible_2_9
|
|
||||||
- Remote_devel
|
- Remote_devel
|
||||||
- Remote_2_13
|
- Remote_2_13
|
||||||
- Remote_2_12
|
- Remote_2_12
|
||||||
- Remote_2_11
|
- Remote_2_11
|
||||||
- Remote_2_10
|
|
||||||
- Remote_2_9
|
|
||||||
- Docker_devel
|
- Docker_devel
|
||||||
- Docker_2_13
|
- Docker_2_13
|
||||||
- Docker_2_12
|
- Docker_2_12
|
||||||
- Docker_2_11
|
- Docker_2_11
|
||||||
- Docker_2_10
|
|
||||||
- Docker_2_9
|
|
||||||
- Docker_community_devel
|
- Docker_community_devel
|
||||||
jobs:
|
jobs:
|
||||||
- template: templates/coverage.yml
|
- template: templates/coverage.yml
|
||||||
|
|||||||
12
README.md
12
README.md
@ -10,19 +10,15 @@ Please note that this collection does **not** support Windows targets. The conne
|
|||||||
|
|
||||||
## Tested with Ansible
|
## Tested with Ansible
|
||||||
|
|
||||||
Tested with the current Ansible 2.9, ansible-base 2.10, ansible-core 2.11, ansible-core 2.12 and ansible-core 2.13 releases and the current development version of ansible-core. Ansible versions before 2.9.10 are not supported.
|
Tested with the current ansible-core 2.11, ansible-core 2.12, and ansible-core 2.13 releases, and the current development version of ansible-core. Ansible/ansible-base versions before 2.11.0 are not supported.
|
||||||
|
|
||||||
Please note that support for Ansible 2.9 and ansible-base 2.10 has been deprecated and will be dropped from community.docker 3.0.0 on.
|
Please note that Ansible 2.9 and ansible-base 2.10 are no longer supported. If you need to use them, use community.docker 2.x.y. Also note that this collection does not work with ansible-core 2.11 (this includes ansible-base and Ansible 2.9) on Python 2.12+.
|
||||||
|
|
||||||
This collection does not work with ansible-core before 2.12 (this includes ansible-base and Ansible 2.9) on Python 2.12+.
|
|
||||||
|
|
||||||
## External requirements
|
## External requirements
|
||||||
|
|
||||||
Most modules and plugins require the [Docker SDK for Python](https://pypi.org/project/docker/). For Python 2.6 support, use [the deprecated docker-py library](https://pypi.org/project/docker-py/) instead.
|
Most modules and plugins require the [Docker SDK for Python](https://pypi.org/project/docker/) and Python 2.7 or newer. Python 2.6 is no longer supported; use community.docker 2.x.y if you need to use Python 2.6.
|
||||||
|
|
||||||
Please note that Python 2.6 support has been deprecated and will be dropped from community.docker 3.0.0 on.
|
If you have Docker SDK for Python < 2.0.0 installed ([docker-py](https://pypi.org/project/docker-py/)), you can still use it, though we recommend to uninstall it and then install [docker](https://pypi.org/project/docker/), the Docker SDK for Python >= 2.0.0. Note that both libraries cannot be installed at the same time. If you accidentally did install them simultaneously, you have to uninstall *both* before re-installing one of them.
|
||||||
|
|
||||||
Both libraries cannot be installed at the same time. If you accidentally did install them simultaneously, you have to uninstall *both* before re-installing one of them.
|
|
||||||
|
|
||||||
## Included content
|
## Included content
|
||||||
|
|
||||||
|
|||||||
5
changelogs/fragments/400-deprecations.yml
Normal file
5
changelogs/fragments/400-deprecations.yml
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
removed_features:
|
||||||
|
- Support for Ansible 2.9 and ansible-base 2.10 has been removed. If you need support for Ansible 2.9 or ansible-base 2.10, please use community.docker 2.x.y (https://github.com/ansible-collections/community.docker/pull/400).
|
||||||
|
- Execution Environments built with community.docker no longer include docker-compose < 2.0.0. If you need to use it with the ``docker_compose`` module, please install that requirement manually (https://github.com/ansible-collections/community.docker/pull/400).
|
||||||
|
- Support for Python 2.6 has been removed. If you need support for Python 2.6, please use community.docker 2.x.y (https://github.com/ansible-collections/community.docker/pull/400).
|
||||||
|
- Support for Docker API versions 1.20 to 1.24 has been removed. If you need support for these API versions, please use community.docker 2.x.y (https://github.com/ansible-collections/community.docker/pull/400).
|
||||||
@ -29,15 +29,7 @@ For Python 2.7, you need to use a version between 2.0.0 and 4.4.4 since the Pyth
|
|||||||
|
|
||||||
$ pip install 'docker==4.4.4'
|
$ pip install 'docker==4.4.4'
|
||||||
|
|
||||||
For Python 2.6, you need a version before 2.0.0. For these versions, the SDK was called ``docker-py``, so you need to install it as follows:
|
Note that the Docker SDK for Python was called ``docker-py`` on PyPi before version 2.0.0. Please avoid installing this really old version, and make sure to not install both ``docker`` and ``docker-py``. Installing both will result in a broken installation. If this happens, Ansible will detect it and inform you about it. If that happens, you must uninstall both and reinstall the correct version. If in doubt, always install ``docker`` and never ``docker-py``.
|
||||||
|
|
||||||
.. code-block:: bash
|
|
||||||
|
|
||||||
$ pip install 'docker-py>=1.10.0'
|
|
||||||
|
|
||||||
Please install only one of ``docker`` or ``docker-py``. Installing both will result in a broken installation. If this happens, Ansible will detect it and inform you about it. If that happens, you must uninstall both and reinstall the correct version.
|
|
||||||
|
|
||||||
If in doubt, always install ``docker`` and never ``docker-py``.
|
|
||||||
|
|
||||||
|
|
||||||
Connecting to the Docker API
|
Connecting to the Docker API
|
||||||
@ -94,7 +86,7 @@ For plugins, they have to be set for the environment Ansible itself runs in. For
|
|||||||
|
|
||||||
DOCKER_API_VERSION
|
DOCKER_API_VERSION
|
||||||
The version of the Docker API running on the Docker Host. Defaults to the latest version of the API supported
|
The version of the Docker API running on the Docker Host. Defaults to the latest version of the API supported
|
||||||
by docker-py.
|
by Docker SDK for Python.
|
||||||
|
|
||||||
DOCKER_TIMEOUT
|
DOCKER_TIMEOUT
|
||||||
The maximum amount of time in seconds to wait on a response from the API.
|
The maximum amount of time in seconds to wait on a response from the API.
|
||||||
|
|||||||
@ -1,5 +1,4 @@
|
|||||||
docker
|
docker
|
||||||
docker-compose
|
|
||||||
requests
|
requests
|
||||||
paramiko
|
paramiko
|
||||||
|
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
---
|
---
|
||||||
requires_ansible: '>=2.9.10'
|
requires_ansible: '>=2.11.0'
|
||||||
action_groups:
|
action_groups:
|
||||||
docker:
|
docker:
|
||||||
- docker_compose
|
- docker_compose
|
||||||
|
|||||||
@ -129,7 +129,7 @@ class Connection(ConnectionBase):
|
|||||||
)
|
)
|
||||||
except RequestException as e:
|
except RequestException as e:
|
||||||
self.client.fail(
|
self.client.fail(
|
||||||
'An unexpected requests error occurred for container "{1}" when docker-py tried to talk to the docker daemon: {0}'
|
'An unexpected requests error occurred for container "{1}" when Docker SDK for Python tried to talk to the docker daemon: {0}'
|
||||||
.format(e, self.get_option('remote_addr'))
|
.format(e, self.get_option('remote_addr'))
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -298,8 +298,8 @@ class Connection(ConnectionBase):
|
|||||||
bio = io.BytesIO()
|
bio = io.BytesIO()
|
||||||
with tarfile.open(fileobj=bio, mode='w|', dereference=True, encoding='utf-8') as tar:
|
with tarfile.open(fileobj=bio, mode='w|', dereference=True, encoding='utf-8') as tar:
|
||||||
# Note that without both name (bytes) and arcname (unicode), this either fails for
|
# Note that without both name (bytes) and arcname (unicode), this either fails for
|
||||||
# Python 2.6/2.7, Python 3.5/3.6, or Python 3.7+. Only when passing both (in this
|
# Python 2.7, Python 3.5/3.6, or Python 3.7+. Only when passing both (in this
|
||||||
# form) it works with Python 2.6, 2.7, 3.5, 3.6, and 3.7 up to 3.9.
|
# form) it works with Python 2.7, 3.5, 3.6, and 3.7 up to 3.11
|
||||||
tarinfo = tar.gettarinfo(b_in_path, arcname=to_text(out_file))
|
tarinfo = tar.gettarinfo(b_in_path, arcname=to_text(out_file))
|
||||||
user_id, group_id = self.ids[self.actual_user]
|
user_id, group_id = self.ids[self.actual_user]
|
||||||
tarinfo.uid = user_id
|
tarinfo.uid = user_id
|
||||||
|
|||||||
@ -159,12 +159,10 @@ notes:
|
|||||||
requirements:
|
requirements:
|
||||||
- "Docker SDK for Python: Please note that the L(docker-py,https://pypi.org/project/docker-py/)
|
- "Docker SDK for Python: Please note that the L(docker-py,https://pypi.org/project/docker-py/)
|
||||||
Python module has been superseded by L(docker,https://pypi.org/project/docker/)
|
Python module has been superseded by L(docker,https://pypi.org/project/docker/)
|
||||||
(see L(here,https://github.com/docker/docker-py/issues/1310) for details).
|
(see L(here,https://github.com/docker/docker-py/issues/1310) for details). Note that both
|
||||||
For Python 2.6, C(docker-py) must be used. Otherwise, it is recommended to
|
modules should *not* be installed at the same time. Also note that when both modules are
|
||||||
install the C(docker) Python module. Note that both modules should *not*
|
installed and one of them is uninstalled, the other might no longer function and a reinstall
|
||||||
be installed at the same time. Also note that when both modules are installed
|
of it is required."
|
||||||
and one of them is uninstalled, the other might no longer function and a
|
|
||||||
reinstall of it is required."
|
|
||||||
'''
|
'''
|
||||||
|
|
||||||
# Additional, more specific stuff for minimal Docker SDK for Python version >= 2.0.
|
# Additional, more specific stuff for minimal Docker SDK for Python version >= 2.0.
|
||||||
|
|||||||
@ -344,5 +344,5 @@ class InventoryModule(BaseInventoryPlugin, Constructable):
|
|||||||
)
|
)
|
||||||
except RequestException as e:
|
except RequestException as e:
|
||||||
raise AnsibleError(
|
raise AnsibleError(
|
||||||
'An unexpected requests error occurred when docker-py tried to talk to the docker daemon: {0}'.format(e)
|
'An unexpected requests error occurred when Docker SDK for Python tried to talk to the docker daemon: {0}'.format(e)
|
||||||
)
|
)
|
||||||
|
|||||||
@ -75,7 +75,7 @@ DOCUMENTATION = '''
|
|||||||
api_version:
|
api_version:
|
||||||
description:
|
description:
|
||||||
- The version of the Docker API running on the Docker Host.
|
- The version of the Docker API running on the Docker Host.
|
||||||
- Defaults to the latest version of the API supported by docker-py.
|
- Defaults to the latest version of the API supported by Docker SDK for Python.
|
||||||
type: str
|
type: str
|
||||||
aliases: [ docker_api_version ]
|
aliases: [ docker_api_version ]
|
||||||
timeout:
|
timeout:
|
||||||
|
|||||||
@ -71,8 +71,8 @@ except ImportError:
|
|||||||
try:
|
try:
|
||||||
from requests.exceptions import RequestException
|
from requests.exceptions import RequestException
|
||||||
except ImportError:
|
except ImportError:
|
||||||
# Either docker-py is no longer using requests, or docker-py isn't around either,
|
# Either Docker SDK for Python is no longer using requests, or Docker SDK for Python isn't around either,
|
||||||
# or docker-py's dependency requests is missing. In any case, define an exception
|
# or Docker SDK for Python's dependency requests is missing. In any case, define an exception
|
||||||
# class RequestException so that our code doesn't break.
|
# class RequestException so that our code doesn't break.
|
||||||
class RequestException(Exception):
|
class RequestException(Exception):
|
||||||
pass
|
pass
|
||||||
@ -180,9 +180,7 @@ def get_connect_params(auth, fail_function):
|
|||||||
|
|
||||||
DOCKERPYUPGRADE_SWITCH_TO_DOCKER = "Try `pip uninstall docker-py` followed by `pip install docker`."
|
DOCKERPYUPGRADE_SWITCH_TO_DOCKER = "Try `pip uninstall docker-py` followed by `pip install docker`."
|
||||||
DOCKERPYUPGRADE_UPGRADE_DOCKER = "Use `pip install --upgrade docker` to upgrade."
|
DOCKERPYUPGRADE_UPGRADE_DOCKER = "Use `pip install --upgrade docker` to upgrade."
|
||||||
DOCKERPYUPGRADE_RECOMMEND_DOCKER = ("Use `pip install --upgrade docker-py` to upgrade. "
|
DOCKERPYUPGRADE_RECOMMEND_DOCKER = "Use `pip install --upgrade docker-py` to upgrade."
|
||||||
"Hint: if you do not need Python 2.6 support, try "
|
|
||||||
"`pip uninstall docker-py` instead, followed by `pip install docker`.")
|
|
||||||
|
|
||||||
|
|
||||||
class AnsibleDockerClientBase(Client):
|
class AnsibleDockerClientBase(Client):
|
||||||
@ -197,28 +195,22 @@ class AnsibleDockerClientBase(Client):
|
|||||||
self.fail("Cannot have both the docker-py and docker python modules (old and new version of Docker "
|
self.fail("Cannot have both the docker-py and docker python modules (old and new version of Docker "
|
||||||
"SDK for Python) installed together as they use the same namespace and cause a corrupt "
|
"SDK for Python) installed together as they use the same namespace and cause a corrupt "
|
||||||
"installation. Please uninstall both packages, and re-install only the docker-py or docker "
|
"installation. Please uninstall both packages, and re-install only the docker-py or docker "
|
||||||
"python module (for %s's Python %s). It is recommended to install the docker module if no "
|
"python module (for %s's Python %s). It is recommended to install the docker module. Please "
|
||||||
"support for Python 2.6 is required. Please note that simply uninstalling one of the modules "
|
"note that simply uninstalling one of the modules can leave the other module in a broken "
|
||||||
"can leave the other module in a broken state." % (platform.node(), sys.executable))
|
"state." % (platform.node(), sys.executable))
|
||||||
|
|
||||||
if not HAS_DOCKER_PY:
|
if not HAS_DOCKER_PY:
|
||||||
if NEEDS_DOCKER_PY2:
|
msg = missing_required_lib("Docker SDK for Python: docker>=5.0.0 (Python >= 3.6) or "
|
||||||
msg = missing_required_lib("Docker SDK for Python: docker above 5.0.0 (Python >= 3.6) or "
|
"docker<5.0.0 (Python 2.7)")
|
||||||
"docker before 5.0.0 (Python 2.7)")
|
|
||||||
msg = msg + ", for example via `pip install docker` (Python >= 3.6) or " \
|
msg = msg + ", for example via `pip install docker` (Python >= 3.6) or " \
|
||||||
+ "`pip install docker==4.4.4` (Python 2.7). The error was: %s"
|
+ "`pip install docker==4.4.4` (Python 2.7). The error was: %s"
|
||||||
else:
|
|
||||||
msg = missing_required_lib("Docker SDK for Python: docker above 5.0.0 (Python >= 3.6) or "
|
|
||||||
"docker before 5.0.0 (Python 2.7) or docker-py (Python 2.6)")
|
|
||||||
msg = msg + ", for example via `pip install docker` (Python >= 3.6) or `pip install docker==4.4.4` (Python 2.7) " \
|
|
||||||
+ "or `pip install docker-py` (Python 2.6). The error was: %s"
|
|
||||||
self.fail(msg % HAS_DOCKER_ERROR, exception=HAS_DOCKER_TRACEBACK)
|
self.fail(msg % HAS_DOCKER_ERROR, exception=HAS_DOCKER_TRACEBACK)
|
||||||
|
|
||||||
if self.docker_py_version < LooseVersion(min_docker_version):
|
if self.docker_py_version < LooseVersion(min_docker_version):
|
||||||
msg = "Error: Docker SDK for Python version is %s (%s's Python %s). Minimum version required is %s."
|
msg = "Error: Docker SDK for Python version is %s (%s's Python %s). Minimum version required is %s."
|
||||||
if not NEEDS_DOCKER_PY2:
|
if not NEEDS_DOCKER_PY2:
|
||||||
# The minimal required version is < 2.0 (and the current version as well).
|
# The minimal required version is < 2.0 (and the current version as well).
|
||||||
# Advertise docker (instead of docker-py) for non-Python-2.6 users.
|
# Advertise docker (instead of docker-py).
|
||||||
msg += DOCKERPYUPGRADE_RECOMMEND_DOCKER
|
msg += DOCKERPYUPGRADE_RECOMMEND_DOCKER
|
||||||
elif docker_version < LooseVersion('2.0'):
|
elif docker_version < LooseVersion('2.0'):
|
||||||
msg += DOCKERPYUPGRADE_SWITCH_TO_DOCKER
|
msg += DOCKERPYUPGRADE_SWITCH_TO_DOCKER
|
||||||
@ -237,7 +229,7 @@ class AnsibleDockerClientBase(Client):
|
|||||||
self.fail("Error connecting: %s" % exc)
|
self.fail("Error connecting: %s" % exc)
|
||||||
|
|
||||||
self.docker_api_version = LooseVersion(self.docker_api_version_str)
|
self.docker_api_version = LooseVersion(self.docker_api_version_str)
|
||||||
if min_docker_api_version is not None:
|
min_docker_api_version = min_docker_api_version or '1.25'
|
||||||
if self.docker_api_version < LooseVersion(min_docker_api_version):
|
if self.docker_api_version < LooseVersion(min_docker_api_version):
|
||||||
self.fail('Docker API version is %s. Minimum version required is %s.' % (self.docker_api_version_str, min_docker_api_version))
|
self.fail('Docker API version is %s. Minimum version required is %s.' % (self.docker_api_version_str, min_docker_api_version))
|
||||||
|
|
||||||
|
|||||||
@ -139,7 +139,7 @@ class DockerSocketHandlerBase(object):
|
|||||||
|
|
||||||
def select(self, timeout=None, _internal_recursion=False):
|
def select(self, timeout=None, _internal_recursion=False):
|
||||||
if not _internal_recursion and self._paramiko_read_workaround and len(self._write_buffer) > 0:
|
if not _internal_recursion and self._paramiko_read_workaround and len(self._write_buffer) > 0:
|
||||||
# When the SSH transport is used, docker-py internally uses Paramiko, whose
|
# When the SSH transport is used, Docker SDK for Python internally uses Paramiko, whose
|
||||||
# Channel object supports select(), but only for reading
|
# Channel object supports select(), but only for reading
|
||||||
# (https://github.com/paramiko/paramiko/issues/695).
|
# (https://github.com/paramiko/paramiko/issues/695).
|
||||||
if self._sock.send_ready():
|
if self._sock.send_ready():
|
||||||
@ -208,25 +208,3 @@ class DockerSocketHandlerBase(object):
|
|||||||
class DockerSocketHandlerModule(DockerSocketHandlerBase):
|
class DockerSocketHandlerModule(DockerSocketHandlerBase):
|
||||||
def __init__(self, sock, module, selectors):
|
def __init__(self, sock, module, selectors):
|
||||||
super(DockerSocketHandlerModule, self).__init__(sock, selectors, module.debug)
|
super(DockerSocketHandlerModule, self).__init__(sock, selectors, module.debug)
|
||||||
|
|
||||||
|
|
||||||
def find_selectors(module):
|
|
||||||
try:
|
|
||||||
# ansible-base 2.10+ has selectors a compat version of selectors, which a bundled fallback:
|
|
||||||
from ansible.module_utils.compat import selectors
|
|
||||||
return selectors
|
|
||||||
except ImportError:
|
|
||||||
pass
|
|
||||||
try:
|
|
||||||
# Python 3.4+
|
|
||||||
import selectors
|
|
||||||
return selectors
|
|
||||||
except ImportError:
|
|
||||||
pass
|
|
||||||
try:
|
|
||||||
# backport package installed in the system
|
|
||||||
import selectors2
|
|
||||||
return selectors2
|
|
||||||
except ImportError:
|
|
||||||
pass
|
|
||||||
module.fail_json(msg=missing_required_lib('selectors2', reason='for handling stdin'))
|
|
||||||
|
|||||||
@ -177,9 +177,9 @@ extends_documentation_fragment:
|
|||||||
|
|
||||||
|
|
||||||
requirements:
|
requirements:
|
||||||
- "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)"
|
- "L(Docker SDK for Python,https://docker-py.readthedocs.io/en/stable/) >= 1.8.0"
|
||||||
- "docker-compose >= 1.7.0, < 2.0.0"
|
- "docker-compose >= 1.7.0, < 2.0.0"
|
||||||
- "Docker API >= 1.20"
|
- "Docker API >= 1.25"
|
||||||
- "PyYAML >= 3.11"
|
- "PyYAML >= 3.11"
|
||||||
'''
|
'''
|
||||||
|
|
||||||
@ -1194,7 +1194,6 @@ def main():
|
|||||||
argument_spec=argument_spec,
|
argument_spec=argument_spec,
|
||||||
mutually_exclusive=mutually_exclusive,
|
mutually_exclusive=mutually_exclusive,
|
||||||
supports_check_mode=True,
|
supports_check_mode=True,
|
||||||
min_docker_api_version='1.20',
|
|
||||||
)
|
)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
@ -1204,7 +1203,7 @@ def main():
|
|||||||
client.fail('An unexpected docker error occurred: {0}'.format(to_native(e)), exception=traceback.format_exc())
|
client.fail('An unexpected docker error occurred: {0}'.format(to_native(e)), exception=traceback.format_exc())
|
||||||
except RequestException as e:
|
except RequestException as e:
|
||||||
client.fail(
|
client.fail(
|
||||||
'An unexpected requests error occurred when docker-py tried to talk to the docker daemon: {0}'.format(to_native(e)),
|
'An unexpected requests error occurred when Docker SDK for Python tried to talk to the docker daemon: {0}'.format(to_native(e)),
|
||||||
exception=traceback.format_exc())
|
exception=traceback.format_exc())
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -418,7 +418,7 @@ def main():
|
|||||||
client.fail('An unexpected docker error occurred: {0}'.format(to_native(e)), exception=traceback.format_exc())
|
client.fail('An unexpected docker error occurred: {0}'.format(to_native(e)), exception=traceback.format_exc())
|
||||||
except RequestException as e:
|
except RequestException as e:
|
||||||
client.fail(
|
client.fail(
|
||||||
'An unexpected requests error occurred when docker-py tried to talk to the docker daemon: {0}'.format(to_native(e)),
|
'An unexpected requests error occurred when Docker SDK for Python tried to talk to the docker daemon: {0}'.format(to_native(e)),
|
||||||
exception=traceback.format_exc())
|
exception=traceback.format_exc())
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -414,7 +414,6 @@ options:
|
|||||||
init:
|
init:
|
||||||
description:
|
description:
|
||||||
- Run an init inside the container that forwards signals and reaps processes.
|
- Run an init inside the container that forwards signals and reaps processes.
|
||||||
- This option requires Docker API >= 1.25.
|
|
||||||
- If I(container_default_behavior) is set to C(compatibility), this option has a default of C(false).
|
- If I(container_default_behavior) is set to C(compatibility), this option has a default of C(false).
|
||||||
type: bool
|
type: bool
|
||||||
interactive:
|
interactive:
|
||||||
@ -899,8 +898,8 @@ author:
|
|||||||
- "Felix Fontein (@felixfontein)"
|
- "Felix Fontein (@felixfontein)"
|
||||||
|
|
||||||
requirements:
|
requirements:
|
||||||
- "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)"
|
- "L(Docker SDK for Python,https://docker-py.readthedocs.io/en/stable/) >= 1.8.0"
|
||||||
- "Docker API >= 1.20"
|
- "Docker API >= 1.25"
|
||||||
'''
|
'''
|
||||||
|
|
||||||
EXAMPLES = '''
|
EXAMPLES = '''
|
||||||
@ -1726,7 +1725,7 @@ class TaskParameters(DockerBaseClass):
|
|||||||
storage_opt='storage_opts',
|
storage_opt='storage_opts',
|
||||||
)
|
)
|
||||||
|
|
||||||
if self.client.docker_py_version >= LooseVersion('1.9') and self.client.docker_api_version >= LooseVersion('1.22'):
|
if self.client.docker_py_version >= LooseVersion('1.9'):
|
||||||
# blkio_weight can always be updated, but can only be set on creation
|
# blkio_weight can always be updated, but can only be set on creation
|
||||||
# when Docker SDK for Python and Docker API are new enough
|
# when Docker SDK for Python and Docker API are new enough
|
||||||
host_config_params['blkio_weight'] = 'blkio_weight'
|
host_config_params['blkio_weight'] = 'blkio_weight'
|
||||||
@ -2030,7 +2029,7 @@ class TaskParameters(DockerBaseClass):
|
|||||||
target = mount['target']
|
target = mount['target']
|
||||||
datatype = mount['type']
|
datatype = mount['type']
|
||||||
mount_dict = dict(mount)
|
mount_dict = dict(mount)
|
||||||
# Sanity checks (so we don't wait for docker-py to barf on input)
|
# Sanity checks (so we don't wait for Docker SDK for Python to barf on input)
|
||||||
if mount_dict.get('source') is None and datatype not in ('tmpfs', 'volume'):
|
if mount_dict.get('source') is None and datatype not in ('tmpfs', 'volume'):
|
||||||
self.client.fail('source must be specified for mount "{0}" of type "{1}"'.format(target, datatype))
|
self.client.fail('source must be specified for mount "{0}" of type "{1}"'.format(target, datatype))
|
||||||
mount_option_types = dict(
|
mount_option_types = dict(
|
||||||
@ -2353,31 +2352,6 @@ class Container(DockerBaseClass):
|
|||||||
# That's why it needs special handling here.
|
# That's why it needs special handling here.
|
||||||
config_mapping['stop_timeout'] = config.get('StopTimeout')
|
config_mapping['stop_timeout'] = config.get('StopTimeout')
|
||||||
|
|
||||||
if self.parameters.client.docker_api_version < LooseVersion('1.22'):
|
|
||||||
# For docker API < 1.22, update_container() is not supported. Thus
|
|
||||||
# we need to handle all limits which are usually handled by
|
|
||||||
# update_container() as configuration changes which require a container
|
|
||||||
# restart.
|
|
||||||
restart_policy = host_config.get('RestartPolicy', dict())
|
|
||||||
|
|
||||||
# Options which don't make sense without their accompanying option
|
|
||||||
if self.parameters.restart_policy:
|
|
||||||
config_mapping['restart_retries'] = restart_policy.get('MaximumRetryCount')
|
|
||||||
|
|
||||||
config_mapping.update(dict(
|
|
||||||
blkio_weight=host_config.get('BlkioWeight'),
|
|
||||||
cpu_period=host_config.get('CpuPeriod'),
|
|
||||||
cpu_quota=host_config.get('CpuQuota'),
|
|
||||||
cpu_shares=host_config.get('CpuShares'),
|
|
||||||
cpuset_cpus=host_config.get('CpusetCpus'),
|
|
||||||
cpuset_mems=host_config.get('CpusetMems'),
|
|
||||||
kernel_memory=host_config.get("KernelMemory"),
|
|
||||||
memory=host_config.get('Memory'),
|
|
||||||
memory_reservation=host_config.get('MemoryReservation'),
|
|
||||||
memory_swap=host_config.get('MemorySwap'),
|
|
||||||
restart_policy=restart_policy.get('Name')
|
|
||||||
))
|
|
||||||
|
|
||||||
differences = DifferenceTracker()
|
differences = DifferenceTracker()
|
||||||
for key, value in config_mapping.items():
|
for key, value in config_mapping.items():
|
||||||
minimal_version = self.parameters.client.option_minimal_versions.get(key, {})
|
minimal_version = self.parameters.client.option_minimal_versions.get(key, {})
|
||||||
@ -2443,9 +2417,6 @@ class Container(DockerBaseClass):
|
|||||||
'''
|
'''
|
||||||
if not self.container.get('HostConfig'):
|
if not self.container.get('HostConfig'):
|
||||||
self.fail("limits_differ_from_container: Error parsing container properties. HostConfig missing.")
|
self.fail("limits_differ_from_container: Error parsing container properties. HostConfig missing.")
|
||||||
if self.parameters.client.docker_api_version < LooseVersion('1.22'):
|
|
||||||
# update_container() call not supported
|
|
||||||
return False, []
|
|
||||||
|
|
||||||
host_config = self.container['HostConfig']
|
host_config = self.container['HostConfig']
|
||||||
|
|
||||||
@ -2626,7 +2597,7 @@ class Container(DockerBaseClass):
|
|||||||
self.log('_get_expected_binds')
|
self.log('_get_expected_binds')
|
||||||
image_vols = []
|
image_vols = []
|
||||||
if image:
|
if image:
|
||||||
image_vols = self._get_image_binds(image[self.parameters.client.image_inspect_source].get('Volumes'))
|
image_vols = self._get_image_binds(image['Config'].get('Volumes'))
|
||||||
param_vols = []
|
param_vols = []
|
||||||
if self.parameters.volumes:
|
if self.parameters.volumes:
|
||||||
for vol in self.parameters.volumes:
|
for vol in self.parameters.volumes:
|
||||||
@ -2662,7 +2633,7 @@ class Container(DockerBaseClass):
|
|||||||
return {}
|
return {}
|
||||||
|
|
||||||
# Can't use get('Labels', {}) because 'Labels' may be present and be None
|
# Can't use get('Labels', {}) because 'Labels' may be present and be None
|
||||||
return image[self.parameters.client.image_inspect_source].get('Labels') or {}
|
return image['Config'].get('Labels') or {}
|
||||||
|
|
||||||
def _get_expected_device_requests(self):
|
def _get_expected_device_requests(self):
|
||||||
if self.parameters.device_requests is None:
|
if self.parameters.device_requests is None:
|
||||||
@ -2707,8 +2678,8 @@ class Container(DockerBaseClass):
|
|||||||
def _get_expected_volumes(self, image):
|
def _get_expected_volumes(self, image):
|
||||||
self.log('_get_expected_volumes')
|
self.log('_get_expected_volumes')
|
||||||
expected_vols = dict()
|
expected_vols = dict()
|
||||||
if image and image[self.parameters.client.image_inspect_source].get('Volumes'):
|
if image and image['Config'].get('Volumes'):
|
||||||
expected_vols.update(image[self.parameters.client.image_inspect_source].get('Volumes'))
|
expected_vols.update(image['Config'].get('Volumes'))
|
||||||
|
|
||||||
if self.parameters.volumes:
|
if self.parameters.volumes:
|
||||||
for vol in self.parameters.volumes:
|
for vol in self.parameters.volumes:
|
||||||
@ -2731,8 +2702,8 @@ class Container(DockerBaseClass):
|
|||||||
def _get_expected_env(self, image):
|
def _get_expected_env(self, image):
|
||||||
self.log('_get_expected_env')
|
self.log('_get_expected_env')
|
||||||
expected_env = dict()
|
expected_env = dict()
|
||||||
if image and image[self.parameters.client.image_inspect_source].get('Env'):
|
if image and image['Config'].get('Env'):
|
||||||
for env_var in image[self.parameters.client.image_inspect_source]['Env']:
|
for env_var in image['Config']['Env']:
|
||||||
parts = env_var.split('=', 1)
|
parts = env_var.split('=', 1)
|
||||||
expected_env[parts[0]] = parts[1]
|
expected_env[parts[0]] = parts[1]
|
||||||
if self.parameters.env:
|
if self.parameters.env:
|
||||||
@ -2746,7 +2717,7 @@ class Container(DockerBaseClass):
|
|||||||
self.log('_get_expected_exposed')
|
self.log('_get_expected_exposed')
|
||||||
image_ports = []
|
image_ports = []
|
||||||
if image:
|
if image:
|
||||||
image_exposed_ports = image[self.parameters.client.image_inspect_source].get('ExposedPorts') or {}
|
image_exposed_ports = image['Config'].get('ExposedPorts') or {}
|
||||||
image_ports = [self._normalize_port(p) for p in image_exposed_ports.keys()]
|
image_ports = [self._normalize_port(p) for p in image_exposed_ports.keys()]
|
||||||
param_ports = []
|
param_ports = []
|
||||||
if self.parameters.ports:
|
if self.parameters.ports:
|
||||||
@ -3420,9 +3391,7 @@ class AnsibleDockerClientContainer(AnsibleDockerClient):
|
|||||||
self.comparisons = comparisons
|
self.comparisons = comparisons
|
||||||
|
|
||||||
def _get_additional_minimal_versions(self):
|
def _get_additional_minimal_versions(self):
|
||||||
stop_timeout_supported = self.docker_api_version >= LooseVersion('1.25')
|
|
||||||
stop_timeout_needed_for_update = self.module.params.get("stop_timeout") is not None and self.module.params.get('state') != 'absent'
|
stop_timeout_needed_for_update = self.module.params.get("stop_timeout") is not None and self.module.params.get('state') != 'absent'
|
||||||
if stop_timeout_supported:
|
|
||||||
stop_timeout_supported = self.docker_py_version >= LooseVersion('2.1')
|
stop_timeout_supported = self.docker_py_version >= LooseVersion('2.1')
|
||||||
if stop_timeout_needed_for_update and not stop_timeout_supported:
|
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
|
# We warn (instead of fail) since in older versions, stop_timeout was not used
|
||||||
@ -3430,12 +3399,6 @@ class AnsibleDockerClientContainer(AnsibleDockerClient):
|
|||||||
self.module.warn("Docker SDK for Python's 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. "
|
"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 "
|
|
||||||
"update the container's stop_timeout configuration." % (self.docker_api_version_str,))
|
|
||||||
self.option_minimal_versions['stop_timeout']['supported'] = stop_timeout_supported
|
self.option_minimal_versions['stop_timeout']['supported'] = stop_timeout_supported
|
||||||
|
|
||||||
def __init__(self, **kwargs):
|
def __init__(self, **kwargs):
|
||||||
@ -3447,34 +3410,25 @@ class AnsibleDockerClientContainer(AnsibleDockerClient):
|
|||||||
volume_binds=dict(),
|
volume_binds=dict(),
|
||||||
name=dict(),
|
name=dict(),
|
||||||
# normal options
|
# normal options
|
||||||
device_read_bps=dict(docker_py_version='1.9.0', docker_api_version='1.22'),
|
device_read_bps=dict(docker_py_version='1.9.0'),
|
||||||
device_read_iops=dict(docker_py_version='1.9.0', docker_api_version='1.22'),
|
device_read_iops=dict(docker_py_version='1.9.0'),
|
||||||
device_write_bps=dict(docker_py_version='1.9.0', docker_api_version='1.22'),
|
device_write_bps=dict(docker_py_version='1.9.0'),
|
||||||
device_write_iops=dict(docker_py_version='1.9.0', docker_api_version='1.22'),
|
device_write_iops=dict(docker_py_version='1.9.0'),
|
||||||
device_requests=dict(docker_py_version='4.3.0', docker_api_version='1.40'),
|
device_requests=dict(docker_py_version='4.3.0', docker_api_version='1.40'),
|
||||||
dns_opts=dict(docker_api_version='1.21', docker_py_version='1.10.0'),
|
dns_opts=dict(docker_py_version='1.10.0'),
|
||||||
ipc_mode=dict(docker_api_version='1.25'),
|
auto_remove=dict(docker_py_version='2.1.0'),
|
||||||
mac_address=dict(docker_api_version='1.25'),
|
healthcheck=dict(docker_py_version='2.0.0'),
|
||||||
oom_score_adj=dict(docker_api_version='1.22'),
|
init=dict(docker_py_version='2.2.0'),
|
||||||
shm_size=dict(docker_api_version='1.22'),
|
runtime=dict(docker_py_version='2.4.0'),
|
||||||
stop_signal=dict(docker_api_version='1.21'),
|
sysctls=dict(docker_py_version='1.10.0'),
|
||||||
tmpfs=dict(docker_api_version='1.22'),
|
userns_mode=dict(docker_py_version='1.10.0'),
|
||||||
volume_driver=dict(docker_api_version='1.21'),
|
uts=dict(docker_py_version='3.5.0'),
|
||||||
memory_reservation=dict(docker_api_version='1.21'),
|
pids_limit=dict(docker_py_version='1.10.0'),
|
||||||
kernel_memory=dict(docker_api_version='1.21'),
|
mounts=dict(docker_py_version='2.6.0'),
|
||||||
auto_remove=dict(docker_py_version='2.1.0', docker_api_version='1.25'),
|
cpus=dict(docker_py_version='2.3.0'),
|
||||||
healthcheck=dict(docker_py_version='2.0.0', docker_api_version='1.24'),
|
storage_opts=dict(docker_py_version='2.1.0'),
|
||||||
init=dict(docker_py_version='2.2.0', docker_api_version='1.25'),
|
|
||||||
runtime=dict(docker_py_version='2.4.0', docker_api_version='1.25'),
|
|
||||||
sysctls=dict(docker_py_version='1.10.0', docker_api_version='1.24'),
|
|
||||||
userns_mode=dict(docker_py_version='1.10.0', docker_api_version='1.23'),
|
|
||||||
uts=dict(docker_py_version='3.5.0', docker_api_version='1.25'),
|
|
||||||
pids_limit=dict(docker_py_version='1.10.0', docker_api_version='1.23'),
|
|
||||||
mounts=dict(docker_py_version='2.6.0', docker_api_version='1.25'),
|
|
||||||
cpus=dict(docker_py_version='2.3.0', docker_api_version='1.25'),
|
|
||||||
storage_opts=dict(docker_py_version='2.1.0', docker_api_version='1.24'),
|
|
||||||
# specials
|
# specials
|
||||||
ipvX_address_supported=dict(docker_py_version='1.9.0', docker_api_version='1.22',
|
ipvX_address_supported=dict(docker_py_version='1.9.0',
|
||||||
detect_usage=detect_ipvX_address_usage,
|
detect_usage=detect_ipvX_address_usage,
|
||||||
usage_msg='ipv4_address or ipv6_address in networks'),
|
usage_msg='ipv4_address or ipv6_address in networks'),
|
||||||
stop_timeout=dict(), # see _get_additional_minimal_versions()
|
stop_timeout=dict(), # see _get_additional_minimal_versions()
|
||||||
@ -3486,10 +3440,6 @@ class AnsibleDockerClientContainer(AnsibleDockerClient):
|
|||||||
**kwargs
|
**kwargs
|
||||||
)
|
)
|
||||||
|
|
||||||
self.image_inspect_source = 'Config'
|
|
||||||
if self.docker_api_version < LooseVersion('1.21'):
|
|
||||||
self.image_inspect_source = 'ContainerConfig'
|
|
||||||
|
|
||||||
self._get_additional_minimal_versions()
|
self._get_additional_minimal_versions()
|
||||||
self._parse_comparisons()
|
self._parse_comparisons()
|
||||||
|
|
||||||
@ -3660,7 +3610,6 @@ def main():
|
|||||||
argument_spec=argument_spec,
|
argument_spec=argument_spec,
|
||||||
required_if=required_if,
|
required_if=required_if,
|
||||||
supports_check_mode=True,
|
supports_check_mode=True,
|
||||||
min_docker_api_version='1.20',
|
|
||||||
)
|
)
|
||||||
if client.module.params['networks_cli_compatible'] is True and client.module.params['networks'] and client.module.params['network_mode'] is None:
|
if client.module.params['networks_cli_compatible'] is True and client.module.params['networks'] and client.module.params['network_mode'] is None:
|
||||||
# Same behavior as Docker CLI: if networks are specified, use the name of the first network as the value for network_mode
|
# Same behavior as Docker CLI: if networks are specified, use the name of the first network as the value for network_mode
|
||||||
@ -3674,7 +3623,7 @@ def main():
|
|||||||
client.fail('An unexpected docker error occurred: {0}'.format(to_native(e)), exception=traceback.format_exc())
|
client.fail('An unexpected docker error occurred: {0}'.format(to_native(e)), exception=traceback.format_exc())
|
||||||
except RequestException as e:
|
except RequestException as e:
|
||||||
client.fail(
|
client.fail(
|
||||||
'An unexpected requests error occurred when docker-py tried to talk to the docker daemon: {0}'.format(to_native(e)),
|
'An unexpected requests error occurred when Docker SDK for Python tried to talk to the docker daemon: {0}'.format(to_native(e)),
|
||||||
exception=traceback.format_exc())
|
exception=traceback.format_exc())
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -90,8 +90,8 @@ author:
|
|||||||
- "Felix Fontein (@felixfontein)"
|
- "Felix Fontein (@felixfontein)"
|
||||||
|
|
||||||
requirements:
|
requirements:
|
||||||
- "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)"
|
- "L(Docker SDK for Python,https://docker-py.readthedocs.io/en/stable/) >= 1.8.0"
|
||||||
- "Docker API >= 1.20"
|
- "Docker API >= 1.25"
|
||||||
'''
|
'''
|
||||||
|
|
||||||
EXAMPLES = '''
|
EXAMPLES = '''
|
||||||
@ -151,6 +151,7 @@ import shlex
|
|||||||
import traceback
|
import traceback
|
||||||
|
|
||||||
from ansible.module_utils.common.text.converters import to_text, to_bytes, to_native
|
from ansible.module_utils.common.text.converters import to_text, to_bytes, to_native
|
||||||
|
from ansible.module_utils.compat import selectors
|
||||||
from ansible.module_utils.six import string_types
|
from ansible.module_utils.six import string_types
|
||||||
|
|
||||||
from ansible_collections.community.docker.plugins.module_utils.common import (
|
from ansible_collections.community.docker.plugins.module_utils.common import (
|
||||||
@ -164,7 +165,6 @@ from ansible_collections.community.docker.plugins.module_utils.socket_helper imp
|
|||||||
)
|
)
|
||||||
|
|
||||||
from ansible_collections.community.docker.plugins.module_utils.socket_handler import (
|
from ansible_collections.community.docker.plugins.module_utils.socket_handler import (
|
||||||
find_selectors,
|
|
||||||
DockerSocketHandlerModule,
|
DockerSocketHandlerModule,
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -192,13 +192,12 @@ def main():
|
|||||||
|
|
||||||
option_minimal_versions = dict(
|
option_minimal_versions = dict(
|
||||||
chdir=dict(docker_py_version='3.0.0', docker_api_version='1.35'),
|
chdir=dict(docker_py_version='3.0.0', docker_api_version='1.35'),
|
||||||
env=dict(docker_py_version='2.3.0', docker_api_version='1.25'),
|
env=dict(docker_py_version='2.3.0'),
|
||||||
)
|
)
|
||||||
|
|
||||||
client = AnsibleDockerClient(
|
client = AnsibleDockerClient(
|
||||||
argument_spec=argument_spec,
|
argument_spec=argument_spec,
|
||||||
option_minimal_versions=option_minimal_versions,
|
option_minimal_versions=option_minimal_versions,
|
||||||
min_docker_api_version='1.20',
|
|
||||||
mutually_exclusive=[('argv', 'command')],
|
mutually_exclusive=[('argv', 'command')],
|
||||||
required_one_of=[('argv', 'command')],
|
required_one_of=[('argv', 'command')],
|
||||||
)
|
)
|
||||||
@ -231,10 +230,6 @@ def main():
|
|||||||
if stdin is not None and client.module.params['stdin_add_newline']:
|
if stdin is not None and client.module.params['stdin_add_newline']:
|
||||||
stdin += '\n'
|
stdin += '\n'
|
||||||
|
|
||||||
selectors = None
|
|
||||||
if stdin and not detach:
|
|
||||||
selectors = find_selectors(client.module)
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
kwargs = {}
|
kwargs = {}
|
||||||
if chdir is not None:
|
if chdir is not None:
|
||||||
@ -257,7 +252,7 @@ def main():
|
|||||||
client.module.exit_json(changed=True, exec_id=exec_id)
|
client.module.exit_json(changed=True, exec_id=exec_id)
|
||||||
|
|
||||||
else:
|
else:
|
||||||
if selectors:
|
if stdin and not detach:
|
||||||
exec_socket = client.exec_start(
|
exec_socket = client.exec_start(
|
||||||
exec_id,
|
exec_id,
|
||||||
tty=tty,
|
tty=tty,
|
||||||
@ -306,7 +301,7 @@ def main():
|
|||||||
client.fail('An unexpected docker error occurred: {0}'.format(to_native(e)), exception=traceback.format_exc())
|
client.fail('An unexpected docker error occurred: {0}'.format(to_native(e)), exception=traceback.format_exc())
|
||||||
except RequestException as e:
|
except RequestException as e:
|
||||||
client.fail(
|
client.fail(
|
||||||
'An unexpected requests error occurred when docker-py tried to talk to the docker daemon: {0}'.format(to_native(e)),
|
'An unexpected requests error occurred when Docker SDK for Python tried to talk to the docker daemon: {0}'.format(to_native(e)),
|
||||||
exception=traceback.format_exc())
|
exception=traceback.format_exc())
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -35,8 +35,8 @@ author:
|
|||||||
- "Felix Fontein (@felixfontein)"
|
- "Felix Fontein (@felixfontein)"
|
||||||
|
|
||||||
requirements:
|
requirements:
|
||||||
- "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)"
|
- "L(Docker SDK for Python,https://docker-py.readthedocs.io/en/stable/) >= 1.8.0"
|
||||||
- "Docker API >= 1.20"
|
- "Docker API >= 1.25"
|
||||||
'''
|
'''
|
||||||
|
|
||||||
EXAMPLES = '''
|
EXAMPLES = '''
|
||||||
@ -126,7 +126,6 @@ def main():
|
|||||||
client = AnsibleDockerClient(
|
client = AnsibleDockerClient(
|
||||||
argument_spec=argument_spec,
|
argument_spec=argument_spec,
|
||||||
supports_check_mode=True,
|
supports_check_mode=True,
|
||||||
min_docker_api_version='1.20',
|
|
||||||
)
|
)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
@ -141,7 +140,7 @@ def main():
|
|||||||
client.fail('An unexpected docker error occurred: {0}'.format(to_native(e)), exception=traceback.format_exc())
|
client.fail('An unexpected docker error occurred: {0}'.format(to_native(e)), exception=traceback.format_exc())
|
||||||
except RequestException as e:
|
except RequestException as e:
|
||||||
client.fail(
|
client.fail(
|
||||||
'An unexpected requests error occurred when docker-py tried to talk to the docker daemon: {0}'.format(to_native(e)),
|
'An unexpected requests error occurred when Docker SDK for Python tried to talk to the docker daemon: {0}'.format(to_native(e)),
|
||||||
exception=traceback.format_exc())
|
exception=traceback.format_exc())
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -102,8 +102,8 @@ author:
|
|||||||
- Piotr Wojciechowski (@WojciechowskiPiotr)
|
- Piotr Wojciechowski (@WojciechowskiPiotr)
|
||||||
|
|
||||||
requirements:
|
requirements:
|
||||||
- "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)"
|
- "L(Docker SDK for Python,https://docker-py.readthedocs.io/en/stable/) >= 1.10.0"
|
||||||
- "Docker API >= 1.21"
|
- "Docker API >= 1.25"
|
||||||
'''
|
'''
|
||||||
|
|
||||||
EXAMPLES = '''
|
EXAMPLES = '''
|
||||||
@ -338,7 +338,6 @@ def main():
|
|||||||
argument_spec=argument_spec,
|
argument_spec=argument_spec,
|
||||||
supports_check_mode=True,
|
supports_check_mode=True,
|
||||||
min_docker_version='1.10.0',
|
min_docker_version='1.10.0',
|
||||||
min_docker_api_version='1.21',
|
|
||||||
option_minimal_versions=option_minimal_versions,
|
option_minimal_versions=option_minimal_versions,
|
||||||
fail_results=dict(
|
fail_results=dict(
|
||||||
can_talk_to_docker=False,
|
can_talk_to_docker=False,
|
||||||
@ -357,7 +356,7 @@ def main():
|
|||||||
client.fail('An unexpected docker error occurred: {0}'.format(to_native(e)), exception=traceback.format_exc())
|
client.fail('An unexpected docker error occurred: {0}'.format(to_native(e)), exception=traceback.format_exc())
|
||||||
except RequestException as e:
|
except RequestException as e:
|
||||||
client.fail(
|
client.fail(
|
||||||
'An unexpected requests error occurred when docker-py tried to talk to the docker daemon: {0}'.format(to_native(e)),
|
'An unexpected requests error occurred when Docker SDK for Python tried to talk to the docker daemon: {0}'.format(to_native(e)),
|
||||||
exception=traceback.format_exc())
|
exception=traceback.format_exc())
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -88,7 +88,6 @@ options:
|
|||||||
description:
|
description:
|
||||||
- Provide a dictionary of C(key:value) build arguments that map to Dockerfile ARG directive.
|
- Provide a dictionary of C(key:value) build arguments that map to Dockerfile ARG directive.
|
||||||
- Docker expects the value to be a string. For convenience any non-string values will be converted to strings.
|
- Docker expects the value to be a string. For convenience any non-string values will be converted to strings.
|
||||||
- Requires Docker API >= 1.21.
|
|
||||||
type: dict
|
type: dict
|
||||||
container_limits:
|
container_limits:
|
||||||
description:
|
description:
|
||||||
@ -213,8 +212,8 @@ extends_documentation_fragment:
|
|||||||
|
|
||||||
|
|
||||||
requirements:
|
requirements:
|
||||||
- "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)"
|
- "L(Docker SDK for Python,https://docker-py.readthedocs.io/en/stable/) >= 1.8.0"
|
||||||
- "Docker API >= 1.20"
|
- "Docker API >= 1.25"
|
||||||
|
|
||||||
author:
|
author:
|
||||||
- Pavel Antonov (@softzilla)
|
- Pavel Antonov (@softzilla)
|
||||||
@ -695,7 +694,7 @@ class ImageManager(DockerBaseClass):
|
|||||||
params['extra_hosts'] = self.extra_hosts
|
params['extra_hosts'] = self.extra_hosts
|
||||||
if self.use_config_proxy:
|
if self.use_config_proxy:
|
||||||
params['use_config_proxy'] = self.use_config_proxy
|
params['use_config_proxy'] = self.use_config_proxy
|
||||||
# Due to a bug in docker-py, it will crash if
|
# Due to a bug in Docker SDK for Python, it will crash if
|
||||||
# use_config_proxy is True and buildargs is None
|
# use_config_proxy is True and buildargs is None
|
||||||
if 'buildargs' not in params:
|
if 'buildargs' not in params:
|
||||||
params['buildargs'] = {}
|
params['buildargs'] = {}
|
||||||
@ -880,8 +879,8 @@ def main():
|
|||||||
return client.module.params['pull'] and client.module.params['pull'].get('platform') is not None
|
return client.module.params['pull'] and client.module.params['pull'].get('platform') is not None
|
||||||
|
|
||||||
option_minimal_versions = dict()
|
option_minimal_versions = dict()
|
||||||
option_minimal_versions["build.cache_from"] = dict(docker_py_version='2.1.0', docker_api_version='1.25', detect_usage=detect_build_cache_from)
|
option_minimal_versions["build.cache_from"] = dict(docker_py_version='2.1.0', detect_usage=detect_build_cache_from)
|
||||||
option_minimal_versions["build.network"] = dict(docker_py_version='2.4.0', docker_api_version='1.25', detect_usage=detect_build_network)
|
option_minimal_versions["build.network"] = dict(docker_py_version='2.4.0', detect_usage=detect_build_network)
|
||||||
option_minimal_versions["build.target"] = dict(docker_py_version='2.4.0', detect_usage=detect_build_target)
|
option_minimal_versions["build.target"] = dict(docker_py_version='2.4.0', detect_usage=detect_build_target)
|
||||||
option_minimal_versions["build.use_config_proxy"] = dict(docker_py_version='3.7.0', detect_usage=detect_use_config_proxy)
|
option_minimal_versions["build.use_config_proxy"] = dict(docker_py_version='3.7.0', detect_usage=detect_use_config_proxy)
|
||||||
option_minimal_versions["build.etc_hosts"] = dict(docker_py_version='2.6.0', docker_api_version='1.27', detect_usage=detect_etc_hosts)
|
option_minimal_versions["build.etc_hosts"] = dict(docker_py_version='2.6.0', docker_api_version='1.27', detect_usage=detect_etc_hosts)
|
||||||
@ -893,7 +892,6 @@ def main():
|
|||||||
required_if=required_if,
|
required_if=required_if,
|
||||||
supports_check_mode=True,
|
supports_check_mode=True,
|
||||||
min_docker_version='1.8.0',
|
min_docker_version='1.8.0',
|
||||||
min_docker_api_version='1.20',
|
|
||||||
option_minimal_versions=option_minimal_versions,
|
option_minimal_versions=option_minimal_versions,
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -917,7 +915,7 @@ def main():
|
|||||||
client.fail('An unexpected docker error occurred: {0}'.format(to_native(e)), exception=traceback.format_exc())
|
client.fail('An unexpected docker error occurred: {0}'.format(to_native(e)), exception=traceback.format_exc())
|
||||||
except RequestException as e:
|
except RequestException as e:
|
||||||
client.fail(
|
client.fail(
|
||||||
'An unexpected requests error occurred when docker-py tried to talk to the docker daemon: {0}'.format(to_native(e)),
|
'An unexpected requests error occurred when Docker SDK for Python tried to talk to the docker daemon: {0}'.format(to_native(e)),
|
||||||
exception=traceback.format_exc())
|
exception=traceback.format_exc())
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -41,8 +41,8 @@ extends_documentation_fragment:
|
|||||||
|
|
||||||
|
|
||||||
requirements:
|
requirements:
|
||||||
- "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)"
|
- "L(Docker SDK for Python,https://docker-py.readthedocs.io/en/stable/) >= 1.8.0"
|
||||||
- "Docker API >= 1.20"
|
- "Docker API >= 1.25"
|
||||||
|
|
||||||
author:
|
author:
|
||||||
- Chris Houseknecht (@chouseknecht)
|
- Chris Houseknecht (@chouseknecht)
|
||||||
@ -252,7 +252,6 @@ def main():
|
|||||||
client = AnsibleDockerClient(
|
client = AnsibleDockerClient(
|
||||||
argument_spec=argument_spec,
|
argument_spec=argument_spec,
|
||||||
supports_check_mode=True,
|
supports_check_mode=True,
|
||||||
min_docker_api_version='1.20',
|
|
||||||
)
|
)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
@ -267,7 +266,7 @@ def main():
|
|||||||
client.fail('An unexpected docker error occurred: {0}'.format(to_native(e)), exception=traceback.format_exc())
|
client.fail('An unexpected docker error occurred: {0}'.format(to_native(e)), exception=traceback.format_exc())
|
||||||
except RequestException as e:
|
except RequestException as e:
|
||||||
client.fail(
|
client.fail(
|
||||||
'An unexpected requests error occurred when docker-py tried to talk to the docker daemon: {0}'.format(to_native(e)),
|
'An unexpected requests error occurred when Docker SDK for Python tried to talk to the docker daemon: {0}'.format(to_native(e)),
|
||||||
exception=traceback.format_exc())
|
exception=traceback.format_exc())
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -36,7 +36,7 @@ notes:
|
|||||||
|
|
||||||
requirements:
|
requirements:
|
||||||
- "L(Docker SDK for Python,https://docker-py.readthedocs.io/en/stable/) >= 2.5.0"
|
- "L(Docker SDK for Python,https://docker-py.readthedocs.io/en/stable/) >= 2.5.0"
|
||||||
- "Docker API >= 1.23"
|
- "Docker API >= 1.25"
|
||||||
|
|
||||||
author:
|
author:
|
||||||
- Felix Fontein (@felixfontein)
|
- Felix Fontein (@felixfontein)
|
||||||
@ -169,7 +169,6 @@ def main():
|
|||||||
),
|
),
|
||||||
supports_check_mode=False,
|
supports_check_mode=False,
|
||||||
min_docker_version='2.5.0',
|
min_docker_version='2.5.0',
|
||||||
min_docker_api_version='1.23',
|
|
||||||
)
|
)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
@ -184,7 +183,7 @@ def main():
|
|||||||
client.fail('An unexpected docker error occurred: {0}'.format(to_native(e)), exception=traceback.format_exc())
|
client.fail('An unexpected docker error occurred: {0}'.format(to_native(e)), exception=traceback.format_exc())
|
||||||
except RequestException as e:
|
except RequestException as e:
|
||||||
client.fail(
|
client.fail(
|
||||||
'An unexpected requests error occurred when docker-py tried to talk to the docker daemon: {0}'.format(to_native(e)),
|
'An unexpected requests error occurred when Docker SDK for Python tried to talk to the docker daemon: {0}'.format(to_native(e)),
|
||||||
exception=traceback.format_exc())
|
exception=traceback.format_exc())
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -69,10 +69,10 @@ extends_documentation_fragment:
|
|||||||
- community.docker.docker.docker_py_1_documentation
|
- community.docker.docker.docker_py_1_documentation
|
||||||
|
|
||||||
requirements:
|
requirements:
|
||||||
- "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)"
|
- "L(Docker SDK for Python,https://docker-py.readthedocs.io/en/stable/) >= 1.8.0"
|
||||||
- "Python bindings for docker credentials store API >= 0.2.1
|
- "Python bindings for docker credentials store API >= 0.2.1
|
||||||
(use L(docker-pycreds,https://pypi.org/project/docker-pycreds/) when using Docker SDK for Python < 4.0.0)"
|
(use L(docker-pycreds,https://pypi.org/project/docker-pycreds/) when using Docker SDK for Python < 4.0.0)"
|
||||||
- "Docker API >= 1.20"
|
- "Docker API >= 1.25"
|
||||||
author:
|
author:
|
||||||
- Olaf Kilian (@olsaki) <olaf.kilian@symanex.com>
|
- Olaf Kilian (@olsaki) <olaf.kilian@symanex.com>
|
||||||
- Chris Houseknecht (@chouseknecht)
|
- Chris Houseknecht (@chouseknecht)
|
||||||
@ -448,7 +448,6 @@ def main():
|
|||||||
argument_spec=argument_spec,
|
argument_spec=argument_spec,
|
||||||
supports_check_mode=True,
|
supports_check_mode=True,
|
||||||
required_if=required_if,
|
required_if=required_if,
|
||||||
min_docker_api_version='1.20',
|
|
||||||
)
|
)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
@ -468,7 +467,7 @@ def main():
|
|||||||
client.fail('An unexpected docker error occurred: {0}'.format(to_native(e)), exception=traceback.format_exc())
|
client.fail('An unexpected docker error occurred: {0}'.format(to_native(e)), exception=traceback.format_exc())
|
||||||
except RequestException as e:
|
except RequestException as e:
|
||||||
client.fail(
|
client.fail(
|
||||||
'An unexpected requests error occurred when docker-py tried to talk to the docker daemon: {0}'.format(to_native(e)),
|
'An unexpected requests error occurred when Docker SDK for Python tried to talk to the docker daemon: {0}'.format(to_native(e)),
|
||||||
exception=traceback.format_exc())
|
exception=traceback.format_exc())
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -165,8 +165,8 @@ author:
|
|||||||
- "Dave Bendit (@DBendit)"
|
- "Dave Bendit (@DBendit)"
|
||||||
|
|
||||||
requirements:
|
requirements:
|
||||||
- "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)"
|
- "L(Docker SDK for Python,https://docker-py.readthedocs.io/en/stable/) >= 1.10.0"
|
||||||
- "The docker server >= 1.10.0"
|
- "Docker API >= 1.25"
|
||||||
'''
|
'''
|
||||||
|
|
||||||
EXAMPLES = '''
|
EXAMPLES = '''
|
||||||
@ -650,7 +650,6 @@ def main():
|
|||||||
option_minimal_versions = dict(
|
option_minimal_versions = dict(
|
||||||
scope=dict(docker_py_version='2.6.0', docker_api_version='1.30'),
|
scope=dict(docker_py_version='2.6.0', docker_api_version='1.30'),
|
||||||
attachable=dict(docker_py_version='2.0.0', docker_api_version='1.26'),
|
attachable=dict(docker_py_version='2.0.0', docker_api_version='1.26'),
|
||||||
labels=dict(docker_api_version='1.23'),
|
|
||||||
ipam_driver_options=dict(docker_py_version='2.0.0'),
|
ipam_driver_options=dict(docker_py_version='2.0.0'),
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -658,7 +657,6 @@ def main():
|
|||||||
argument_spec=argument_spec,
|
argument_spec=argument_spec,
|
||||||
supports_check_mode=True,
|
supports_check_mode=True,
|
||||||
min_docker_version='1.10.0',
|
min_docker_version='1.10.0',
|
||||||
min_docker_api_version='1.22',
|
|
||||||
# "The docker server >= 1.10.0"
|
# "The docker server >= 1.10.0"
|
||||||
option_minimal_versions=option_minimal_versions,
|
option_minimal_versions=option_minimal_versions,
|
||||||
)
|
)
|
||||||
@ -670,7 +668,7 @@ def main():
|
|||||||
client.fail('An unexpected docker error occurred: {0}'.format(to_native(e)), exception=traceback.format_exc())
|
client.fail('An unexpected docker error occurred: {0}'.format(to_native(e)), exception=traceback.format_exc())
|
||||||
except RequestException as e:
|
except RequestException as e:
|
||||||
client.fail(
|
client.fail(
|
||||||
'An unexpected requests error occurred when docker-py tried to talk to the docker daemon: {0}'.format(to_native(e)),
|
'An unexpected requests error occurred when Docker SDK for Python tried to talk to the docker daemon: {0}'.format(to_native(e)),
|
||||||
exception=traceback.format_exc())
|
exception=traceback.format_exc())
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -35,8 +35,8 @@ author:
|
|||||||
- "Dave Bendit (@DBendit)"
|
- "Dave Bendit (@DBendit)"
|
||||||
|
|
||||||
requirements:
|
requirements:
|
||||||
- "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)"
|
- "L(Docker SDK for Python,https://docker-py.readthedocs.io/en/stable/) >= 1.8.0"
|
||||||
- "Docker API >= 1.21"
|
- "Docker API >= 1.25"
|
||||||
'''
|
'''
|
||||||
|
|
||||||
EXAMPLES = '''
|
EXAMPLES = '''
|
||||||
@ -122,7 +122,6 @@ def main():
|
|||||||
client = AnsibleDockerClient(
|
client = AnsibleDockerClient(
|
||||||
argument_spec=argument_spec,
|
argument_spec=argument_spec,
|
||||||
supports_check_mode=True,
|
supports_check_mode=True,
|
||||||
min_docker_api_version='1.21',
|
|
||||||
)
|
)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
@ -137,7 +136,7 @@ def main():
|
|||||||
client.fail('An unexpected docker error occurred: {0}'.format(to_native(e)), exception=traceback.format_exc())
|
client.fail('An unexpected docker error occurred: {0}'.format(to_native(e)), exception=traceback.format_exc())
|
||||||
except RequestException as e:
|
except RequestException as e:
|
||||||
client.fail(
|
client.fail(
|
||||||
'An unexpected requests error occurred when docker-py tried to talk to the docker daemon: {0}'.format(to_native(e)),
|
'An unexpected requests error occurred when Docker SDK for Python tried to talk to the docker daemon: {0}'.format(to_native(e)),
|
||||||
exception=traceback.format_exc())
|
exception=traceback.format_exc())
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -274,7 +274,6 @@ def main():
|
|||||||
argument_spec=argument_spec,
|
argument_spec=argument_spec,
|
||||||
supports_check_mode=True,
|
supports_check_mode=True,
|
||||||
min_docker_version='2.4.0',
|
min_docker_version='2.4.0',
|
||||||
min_docker_api_version='1.25',
|
|
||||||
)
|
)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
@ -288,7 +287,7 @@ def main():
|
|||||||
client.fail('An unexpected docker error occurred: {0}'.format(to_native(e)), exception=traceback.format_exc())
|
client.fail('An unexpected docker error occurred: {0}'.format(to_native(e)), exception=traceback.format_exc())
|
||||||
except RequestException as e:
|
except RequestException as e:
|
||||||
client.fail(
|
client.fail(
|
||||||
'An unexpected requests error occurred when docker-py tried to talk to the docker daemon: {0}'.format(to_native(e)),
|
'An unexpected requests error occurred when Docker SDK for Python tried to talk to the docker daemon: {0}'.format(to_native(e)),
|
||||||
exception=traceback.format_exc())
|
exception=traceback.format_exc())
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -46,7 +46,7 @@ author:
|
|||||||
|
|
||||||
requirements:
|
requirements:
|
||||||
- "L(Docker SDK for Python,https://docker-py.readthedocs.io/en/stable/) >= 2.4.0"
|
- "L(Docker SDK for Python,https://docker-py.readthedocs.io/en/stable/) >= 2.4.0"
|
||||||
- "Docker API >= 1.24"
|
- "Docker API >= 1.25"
|
||||||
'''
|
'''
|
||||||
|
|
||||||
EXAMPLES = '''
|
EXAMPLES = '''
|
||||||
@ -136,7 +136,6 @@ def main():
|
|||||||
argument_spec=argument_spec,
|
argument_spec=argument_spec,
|
||||||
supports_check_mode=True,
|
supports_check_mode=True,
|
||||||
min_docker_version='2.4.0',
|
min_docker_version='2.4.0',
|
||||||
min_docker_api_version='1.24',
|
|
||||||
)
|
)
|
||||||
|
|
||||||
client.fail_task_if_not_swarm_manager()
|
client.fail_task_if_not_swarm_manager()
|
||||||
@ -152,7 +151,7 @@ def main():
|
|||||||
client.fail('An unexpected docker error occurred: {0}'.format(to_native(e)), exception=traceback.format_exc())
|
client.fail('An unexpected docker error occurred: {0}'.format(to_native(e)), exception=traceback.format_exc())
|
||||||
except RequestException as e:
|
except RequestException as e:
|
||||||
client.fail(
|
client.fail(
|
||||||
'An unexpected requests error occurred when docker-py tried to talk to the docker daemon: {0}'.format(to_native(e)),
|
'An unexpected requests error occurred when Docker SDK for Python tried to talk to the docker daemon: {0}'.format(to_native(e)),
|
||||||
exception=traceback.format_exc())
|
exception=traceback.format_exc())
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -125,7 +125,7 @@ try:
|
|||||||
from docker.errors import APIError, NotFound, DockerException
|
from docker.errors import APIError, NotFound, DockerException
|
||||||
from docker import DockerClient
|
from docker import DockerClient
|
||||||
except ImportError:
|
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
|
pass
|
||||||
|
|
||||||
from ansible_collections.community.docker.plugins.module_utils.common import (
|
from ansible_collections.community.docker.plugins.module_utils.common import (
|
||||||
@ -355,7 +355,6 @@ def main():
|
|||||||
argument_spec=argument_spec,
|
argument_spec=argument_spec,
|
||||||
supports_check_mode=True,
|
supports_check_mode=True,
|
||||||
min_docker_version='2.6.0',
|
min_docker_version='2.6.0',
|
||||||
min_docker_api_version='1.25',
|
|
||||||
)
|
)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
@ -365,7 +364,7 @@ def main():
|
|||||||
client.fail('An unexpected docker error occurred: {0}'.format(to_native(e)), exception=traceback.format_exc())
|
client.fail('An unexpected docker error occurred: {0}'.format(to_native(e)), exception=traceback.format_exc())
|
||||||
except RequestException as e:
|
except RequestException as e:
|
||||||
client.fail(
|
client.fail(
|
||||||
'An unexpected requests error occurred when docker-py tried to talk to the docker daemon: {0}'.format(to_native(e)),
|
'An unexpected requests error occurred when Docker SDK for Python tried to talk to the docker daemon: {0}'.format(to_native(e)),
|
||||||
exception=traceback.format_exc())
|
exception=traceback.format_exc())
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -216,7 +216,6 @@ def main():
|
|||||||
client = AnsibleDockerClient(
|
client = AnsibleDockerClient(
|
||||||
argument_spec=argument_spec,
|
argument_spec=argument_spec,
|
||||||
# supports_check_mode=True,
|
# supports_check_mode=True,
|
||||||
min_docker_api_version='1.25',
|
|
||||||
min_docker_version='2.1.0',
|
min_docker_version='2.1.0',
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -261,7 +260,7 @@ def main():
|
|||||||
client.fail('An unexpected docker error occurred: {0}'.format(to_native(e)), exception=traceback.format_exc())
|
client.fail('An unexpected docker error occurred: {0}'.format(to_native(e)), exception=traceback.format_exc())
|
||||||
except RequestException as e:
|
except RequestException as e:
|
||||||
client.fail(
|
client.fail(
|
||||||
'An unexpected requests error occurred when docker-py tried to talk to the docker daemon: {0}'.format(to_native(e)),
|
'An unexpected requests error occurred when Docker SDK for Python tried to talk to the docker daemon: {0}'.format(to_native(e)),
|
||||||
exception=traceback.format_exc())
|
exception=traceback.format_exc())
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -375,7 +375,6 @@ def main():
|
|||||||
required_if=required_if,
|
required_if=required_if,
|
||||||
mutually_exclusive=mutually_exclusive,
|
mutually_exclusive=mutually_exclusive,
|
||||||
min_docker_version='2.1.0',
|
min_docker_version='2.1.0',
|
||||||
min_docker_api_version='1.25',
|
|
||||||
)
|
)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
@ -391,7 +390,7 @@ def main():
|
|||||||
client.fail('An unexpected docker error occurred: {0}'.format(to_native(e)), exception=traceback.format_exc())
|
client.fail('An unexpected docker error occurred: {0}'.format(to_native(e)), exception=traceback.format_exc())
|
||||||
except RequestException as e:
|
except RequestException as e:
|
||||||
client.fail(
|
client.fail(
|
||||||
'An unexpected requests error occurred when docker-py tried to talk to the docker daemon: {0}'.format(to_native(e)),
|
'An unexpected requests error occurred when Docker SDK for Python tried to talk to the docker daemon: {0}'.format(to_native(e)),
|
||||||
exception=traceback.format_exc())
|
exception=traceback.format_exc())
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -189,7 +189,7 @@ extends_documentation_fragment:
|
|||||||
- community.docker.docker.docker_py_1_documentation
|
- community.docker.docker.docker_py_1_documentation
|
||||||
|
|
||||||
requirements:
|
requirements:
|
||||||
- "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)"
|
- "L(Docker SDK for Python,https://docker-py.readthedocs.io/en/stable/) >= 1.10.0"
|
||||||
- Docker API >= 1.25
|
- Docker API >= 1.25
|
||||||
author:
|
author:
|
||||||
- Thierry Bouvet (@tbouvet)
|
- Thierry Bouvet (@tbouvet)
|
||||||
@ -671,7 +671,6 @@ def main():
|
|||||||
supports_check_mode=True,
|
supports_check_mode=True,
|
||||||
required_if=required_if,
|
required_if=required_if,
|
||||||
min_docker_version='1.10.0',
|
min_docker_version='1.10.0',
|
||||||
min_docker_api_version='1.25',
|
|
||||||
option_minimal_versions=option_minimal_versions,
|
option_minimal_versions=option_minimal_versions,
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -688,7 +687,7 @@ def main():
|
|||||||
client.fail('An unexpected docker error occurred: {0}'.format(to_native(e)), exception=traceback.format_exc())
|
client.fail('An unexpected docker error occurred: {0}'.format(to_native(e)), exception=traceback.format_exc())
|
||||||
except RequestException as e:
|
except RequestException as e:
|
||||||
client.fail(
|
client.fail(
|
||||||
'An unexpected requests error occurred when docker-py tried to talk to the docker daemon: {0}'.format(to_native(e)),
|
'An unexpected requests error occurred when Docker SDK for Python tried to talk to the docker daemon: {0}'.format(to_native(e)),
|
||||||
exception=traceback.format_exc())
|
exception=traceback.format_exc())
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -83,8 +83,8 @@ extends_documentation_fragment:
|
|||||||
|
|
||||||
|
|
||||||
requirements:
|
requirements:
|
||||||
- "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)"
|
- "L(Docker SDK for Python,https://docker-py.readthedocs.io/en/stable/) >= 1.10.0"
|
||||||
- "Docker API >= 1.24"
|
- "Docker API >= 1.25"
|
||||||
'''
|
'''
|
||||||
|
|
||||||
EXAMPLES = '''
|
EXAMPLES = '''
|
||||||
@ -347,14 +347,13 @@ def main():
|
|||||||
verbose_output=dict(type='bool', default=False),
|
verbose_output=dict(type='bool', default=False),
|
||||||
)
|
)
|
||||||
option_minimal_versions = dict(
|
option_minimal_versions = dict(
|
||||||
unlock_key=dict(docker_py_version='2.7.0', docker_api_version='1.25'),
|
unlock_key=dict(docker_py_version='2.7.0'),
|
||||||
)
|
)
|
||||||
|
|
||||||
client = AnsibleDockerSwarmClient(
|
client = AnsibleDockerSwarmClient(
|
||||||
argument_spec=argument_spec,
|
argument_spec=argument_spec,
|
||||||
supports_check_mode=True,
|
supports_check_mode=True,
|
||||||
min_docker_version='1.10.0',
|
min_docker_version='1.10.0',
|
||||||
min_docker_api_version='1.24',
|
|
||||||
option_minimal_versions=option_minimal_versions,
|
option_minimal_versions=option_minimal_versions,
|
||||||
fail_results=dict(
|
fail_results=dict(
|
||||||
can_talk_to_docker=False,
|
can_talk_to_docker=False,
|
||||||
@ -378,7 +377,7 @@ def main():
|
|||||||
client.fail('An unexpected docker error occurred: {0}'.format(to_native(e)), exception=traceback.format_exc())
|
client.fail('An unexpected docker error occurred: {0}'.format(to_native(e)), exception=traceback.format_exc())
|
||||||
except RequestException as e:
|
except RequestException as e:
|
||||||
client.fail(
|
client.fail(
|
||||||
'An unexpected requests error occurred when docker-py tried to talk to the docker daemon: {0}'.format(to_native(e)),
|
'An unexpected requests error occurred when Docker SDK for Python tried to talk to the docker daemon: {0}'.format(to_native(e)),
|
||||||
exception=traceback.format_exc())
|
exception=traceback.format_exc())
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -72,28 +72,24 @@ options:
|
|||||||
description:
|
description:
|
||||||
- List of custom DNS servers.
|
- List of custom DNS servers.
|
||||||
- Corresponds to the C(--dns) option of C(docker service create).
|
- Corresponds to the C(--dns) option of C(docker service create).
|
||||||
- Requires API version >= 1.25.
|
|
||||||
type: list
|
type: list
|
||||||
elements: str
|
elements: str
|
||||||
dns_search:
|
dns_search:
|
||||||
description:
|
description:
|
||||||
- List of custom DNS search domains.
|
- List of custom DNS search domains.
|
||||||
- Corresponds to the C(--dns-search) option of C(docker service create).
|
- Corresponds to the C(--dns-search) option of C(docker service create).
|
||||||
- Requires API version >= 1.25.
|
|
||||||
type: list
|
type: list
|
||||||
elements: str
|
elements: str
|
||||||
dns_options:
|
dns_options:
|
||||||
description:
|
description:
|
||||||
- List of custom DNS options.
|
- List of custom DNS options.
|
||||||
- Corresponds to the C(--dns-option) option of C(docker service create).
|
- Corresponds to the C(--dns-option) option of C(docker service create).
|
||||||
- Requires API version >= 1.25.
|
|
||||||
type: list
|
type: list
|
||||||
elements: str
|
elements: str
|
||||||
endpoint_mode:
|
endpoint_mode:
|
||||||
description:
|
description:
|
||||||
- Service endpoint mode.
|
- Service endpoint mode.
|
||||||
- Corresponds to the C(--endpoint-mode) option of C(docker service create).
|
- Corresponds to the C(--endpoint-mode) option of C(docker service create).
|
||||||
- Requires API version >= 1.25.
|
|
||||||
type: str
|
type: str
|
||||||
choices:
|
choices:
|
||||||
- vip
|
- vip
|
||||||
@ -119,14 +115,12 @@ options:
|
|||||||
description:
|
description:
|
||||||
- Force update even if no changes require it.
|
- Force update even if no changes require it.
|
||||||
- Corresponds to the C(--force) option of C(docker service update).
|
- Corresponds to the C(--force) option of C(docker service update).
|
||||||
- Requires API version >= 1.25.
|
|
||||||
type: bool
|
type: bool
|
||||||
default: no
|
default: no
|
||||||
groups:
|
groups:
|
||||||
description:
|
description:
|
||||||
- List of additional group names and/or IDs that the container process will run as.
|
- List of additional group names and/or IDs that the container process will run as.
|
||||||
- Corresponds to the C(--group) option of C(docker service update).
|
- Corresponds to the C(--group) option of C(docker service update).
|
||||||
- Requires API version >= 1.25.
|
|
||||||
type: list
|
type: list
|
||||||
elements: str
|
elements: str
|
||||||
healthcheck:
|
healthcheck:
|
||||||
@ -136,7 +130,6 @@ options:
|
|||||||
for details on how healthchecks work.
|
for details on how healthchecks work.
|
||||||
- "I(interval), I(timeout) and I(start_period) are specified as durations. They accept duration as a string in a format
|
- "I(interval), I(timeout) and I(start_period) are specified as durations. They accept duration as a string in a format
|
||||||
that look like: C(5h34m56s), C(1m30s) etc. The supported units are C(us), C(ms), C(s), C(m) and C(h)."
|
that look like: C(5h34m56s), C(1m30s) etc. The supported units are C(us), C(ms), C(s), C(m) and C(h)."
|
||||||
- Requires API version >= 1.25.
|
|
||||||
type: dict
|
type: dict
|
||||||
suboptions:
|
suboptions:
|
||||||
test:
|
test:
|
||||||
@ -164,14 +157,12 @@ options:
|
|||||||
description:
|
description:
|
||||||
- Container hostname.
|
- Container hostname.
|
||||||
- Corresponds to the C(--hostname) option of C(docker service create).
|
- Corresponds to the C(--hostname) option of C(docker service create).
|
||||||
- Requires API version >= 1.25.
|
|
||||||
type: str
|
type: str
|
||||||
hosts:
|
hosts:
|
||||||
description:
|
description:
|
||||||
- Dict of host-to-IP mappings, where each host name is a key in the dictionary.
|
- Dict of host-to-IP mappings, where each host name is a key in the dictionary.
|
||||||
Each host name will be added to the container's /etc/hosts file.
|
Each host name will be added to the container's /etc/hosts file.
|
||||||
- Corresponds to the C(--host) option of C(docker service create).
|
- Corresponds to the C(--host) option of C(docker service create).
|
||||||
- Requires API version >= 1.25.
|
|
||||||
type: dict
|
type: dict
|
||||||
image:
|
image:
|
||||||
description:
|
description:
|
||||||
@ -357,7 +348,6 @@ options:
|
|||||||
description:
|
description:
|
||||||
- List of dictionaries describing the service published ports.
|
- List of dictionaries describing the service published ports.
|
||||||
- Corresponds to the C(--publish) option of C(docker service create).
|
- Corresponds to the C(--publish) option of C(docker service create).
|
||||||
- Requires API version >= 1.25.
|
|
||||||
type: list
|
type: list
|
||||||
elements: dict
|
elements: dict
|
||||||
suboptions:
|
suboptions:
|
||||||
@ -510,7 +500,6 @@ options:
|
|||||||
description:
|
description:
|
||||||
- List of dictionaries describing the service secrets.
|
- List of dictionaries describing the service secrets.
|
||||||
- Corresponds to the C(--secret) option of C(docker service create).
|
- Corresponds to the C(--secret) option of C(docker service create).
|
||||||
- Requires API version >= 1.25.
|
|
||||||
type: list
|
type: list
|
||||||
elements: dict
|
elements: dict
|
||||||
suboptions:
|
suboptions:
|
||||||
@ -566,7 +555,6 @@ options:
|
|||||||
description:
|
description:
|
||||||
- Allocate a pseudo-TTY.
|
- Allocate a pseudo-TTY.
|
||||||
- Corresponds to the C(--tty) option of C(docker service create).
|
- Corresponds to the C(--tty) option of C(docker service create).
|
||||||
- Requires API version >= 1.25.
|
|
||||||
type: bool
|
type: bool
|
||||||
update_config:
|
update_config:
|
||||||
description:
|
description:
|
||||||
@ -600,13 +588,11 @@ options:
|
|||||||
- "Accepts a string in a format that look like:
|
- "Accepts a string in a format that look like:
|
||||||
C(5h34m56s), C(1m30s) etc. The supported units are C(us), C(ms), C(s), C(m) and C(h)."
|
C(5h34m56s), C(1m30s) etc. The supported units are C(us), C(ms), C(s), C(m) and C(h)."
|
||||||
- Corresponds to the C(--update-monitor) option of C(docker service create).
|
- Corresponds to the C(--update-monitor) option of C(docker service create).
|
||||||
- Requires API version >= 1.25.
|
|
||||||
type: str
|
type: str
|
||||||
max_failure_ratio:
|
max_failure_ratio:
|
||||||
description:
|
description:
|
||||||
- Fraction of tasks that may fail during an update before the failure action is invoked.
|
- Fraction of tasks that may fail during an update before the failure action is invoked.
|
||||||
- Corresponds to the C(--update-max-failure-ratio) option of C(docker service create).
|
- Corresponds to the C(--update-max-failure-ratio) option of C(docker service create).
|
||||||
- Requires API version >= 1.25.
|
|
||||||
type: float
|
type: float
|
||||||
order:
|
order:
|
||||||
description:
|
description:
|
||||||
@ -647,7 +633,7 @@ extends_documentation_fragment:
|
|||||||
|
|
||||||
requirements:
|
requirements:
|
||||||
- "L(Docker SDK for Python,https://docker-py.readthedocs.io/en/stable/) >= 2.0.2"
|
- "L(Docker SDK for Python,https://docker-py.readthedocs.io/en/stable/) >= 2.0.2"
|
||||||
- "Docker API >= 1.24"
|
- "Docker API >= 1.25"
|
||||||
notes:
|
notes:
|
||||||
- "Images will only resolve to the latest digest when using Docker API >= 1.30 and Docker SDK for Python >= 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."
|
When using older versions use C(force_update: true) to trigger the swarm to resolve a new image."
|
||||||
@ -1333,10 +1319,7 @@ class DockerService(DockerBaseClass):
|
|||||||
@property
|
@property
|
||||||
def can_use_task_template_networks(self):
|
def can_use_task_template_networks(self):
|
||||||
# In Docker API 1.25 attaching networks to TaskTemplate is preferred over Spec
|
# In Docker API 1.25 attaching networks to TaskTemplate is preferred over Spec
|
||||||
return (
|
return self.docker_py_version >= LooseVersion('2.7')
|
||||||
self.docker_api_version >= LooseVersion('1.25') and
|
|
||||||
self.docker_py_version >= LooseVersion('2.7')
|
|
||||||
)
|
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def get_restart_config_from_ansible_params(params):
|
def get_restart_config_from_ansible_params(params):
|
||||||
@ -2735,20 +2718,20 @@ def main():
|
|||||||
)
|
)
|
||||||
|
|
||||||
option_minimal_versions = dict(
|
option_minimal_versions = dict(
|
||||||
dns=dict(docker_py_version='2.6.0', docker_api_version='1.25'),
|
dns=dict(docker_py_version='2.6.0'),
|
||||||
dns_options=dict(docker_py_version='2.6.0', docker_api_version='1.25'),
|
dns_options=dict(docker_py_version='2.6.0'),
|
||||||
dns_search=dict(docker_py_version='2.6.0', docker_api_version='1.25'),
|
dns_search=dict(docker_py_version='2.6.0'),
|
||||||
endpoint_mode=dict(docker_py_version='3.0.0', docker_api_version='1.25'),
|
endpoint_mode=dict(docker_py_version='3.0.0'),
|
||||||
force_update=dict(docker_py_version='2.1.0', docker_api_version='1.25'),
|
force_update=dict(docker_py_version='2.1.0'),
|
||||||
healthcheck=dict(docker_py_version='2.6.0', docker_api_version='1.25'),
|
healthcheck=dict(docker_py_version='2.6.0'),
|
||||||
hostname=dict(docker_py_version='2.2.0', docker_api_version='1.25'),
|
hostname=dict(docker_py_version='2.2.0'),
|
||||||
hosts=dict(docker_py_version='2.6.0', docker_api_version='1.25'),
|
hosts=dict(docker_py_version='2.6.0'),
|
||||||
groups=dict(docker_py_version='2.6.0', docker_api_version='1.25'),
|
groups=dict(docker_py_version='2.6.0'),
|
||||||
tty=dict(docker_py_version='2.4.0', docker_api_version='1.25'),
|
tty=dict(docker_py_version='2.4.0'),
|
||||||
secrets=dict(docker_py_version='2.4.0', docker_api_version='1.25'),
|
secrets=dict(docker_py_version='2.4.0'),
|
||||||
configs=dict(docker_py_version='2.6.0', docker_api_version='1.30'),
|
configs=dict(docker_py_version='2.6.0', docker_api_version='1.30'),
|
||||||
stop_signal=dict(docker_py_version='2.6.0', docker_api_version='1.28'),
|
stop_signal=dict(docker_py_version='2.6.0', docker_api_version='1.28'),
|
||||||
publish=dict(docker_py_version='3.0.0', docker_api_version='1.25'),
|
publish=dict(docker_py_version='3.0.0'),
|
||||||
read_only=dict(docker_py_version='2.6.0', docker_api_version='1.28'),
|
read_only=dict(docker_py_version='2.6.0', docker_api_version='1.28'),
|
||||||
resolve_image=dict(docker_api_version='1.30', docker_py_version='3.2.0'),
|
resolve_image=dict(docker_api_version='1.30', docker_py_version='3.2.0'),
|
||||||
rollback_config=dict(docker_py_version='3.5.0', docker_api_version='1.28'),
|
rollback_config=dict(docker_py_version='3.5.0', docker_api_version='1.28'),
|
||||||
@ -2758,7 +2741,6 @@ def main():
|
|||||||
# specials
|
# specials
|
||||||
publish_mode=dict(
|
publish_mode=dict(
|
||||||
docker_py_version='3.0.0',
|
docker_py_version='3.0.0',
|
||||||
docker_api_version='1.25',
|
|
||||||
detect_usage=_detect_publish_mode_usage,
|
detect_usage=_detect_publish_mode_usage,
|
||||||
usage_msg='set publish.mode'
|
usage_msg='set publish.mode'
|
||||||
),
|
),
|
||||||
@ -2770,7 +2752,6 @@ def main():
|
|||||||
),
|
),
|
||||||
update_config_max_failure_ratio=dict(
|
update_config_max_failure_ratio=dict(
|
||||||
docker_py_version='2.1.0',
|
docker_py_version='2.1.0',
|
||||||
docker_api_version='1.25',
|
|
||||||
detect_usage=lambda c: (c.module.params['update_config'] or {}).get(
|
detect_usage=lambda c: (c.module.params['update_config'] or {}).get(
|
||||||
'max_failure_ratio'
|
'max_failure_ratio'
|
||||||
) is not None,
|
) is not None,
|
||||||
@ -2784,7 +2765,6 @@ def main():
|
|||||||
),
|
),
|
||||||
update_config_monitor=dict(
|
update_config_monitor=dict(
|
||||||
docker_py_version='2.1.0',
|
docker_py_version='2.1.0',
|
||||||
docker_api_version='1.25',
|
|
||||||
detect_usage=lambda c: (c.module.params['update_config'] or {}).get(
|
detect_usage=lambda c: (c.module.params['update_config'] or {}).get(
|
||||||
'monitor'
|
'monitor'
|
||||||
) is not None,
|
) is not None,
|
||||||
@ -2843,7 +2823,6 @@ def main():
|
|||||||
required_if=required_if,
|
required_if=required_if,
|
||||||
supports_check_mode=True,
|
supports_check_mode=True,
|
||||||
min_docker_version='2.0.2',
|
min_docker_version='2.0.2',
|
||||||
min_docker_api_version='1.24',
|
|
||||||
option_minimal_versions=option_minimal_versions,
|
option_minimal_versions=option_minimal_versions,
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -2867,7 +2846,7 @@ def main():
|
|||||||
client.fail('An unexpected docker error occurred: {0}'.format(to_native(e)), exception=traceback.format_exc())
|
client.fail('An unexpected docker error occurred: {0}'.format(to_native(e)), exception=traceback.format_exc())
|
||||||
except RequestException as e:
|
except RequestException as e:
|
||||||
client.fail(
|
client.fail(
|
||||||
'An unexpected requests error occurred when docker-py tried to talk to the docker daemon: {0}'.format(to_native(e)),
|
'An unexpected requests error occurred when Docker SDK for Python tried to talk to the docker daemon: {0}'.format(to_native(e)),
|
||||||
exception=traceback.format_exc())
|
exception=traceback.format_exc())
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -35,7 +35,7 @@ author:
|
|||||||
|
|
||||||
requirements:
|
requirements:
|
||||||
- "L(Docker SDK for Python,https://docker-py.readthedocs.io/en/stable/) >= 2.0.0"
|
- "L(Docker SDK for Python,https://docker-py.readthedocs.io/en/stable/) >= 2.0.0"
|
||||||
- "Docker API >= 1.24"
|
- "Docker API >= 1.25"
|
||||||
'''
|
'''
|
||||||
|
|
||||||
EXAMPLES = '''
|
EXAMPLES = '''
|
||||||
@ -94,7 +94,6 @@ def main():
|
|||||||
argument_spec=argument_spec,
|
argument_spec=argument_spec,
|
||||||
supports_check_mode=True,
|
supports_check_mode=True,
|
||||||
min_docker_version='2.0.0',
|
min_docker_version='2.0.0',
|
||||||
min_docker_api_version='1.24',
|
|
||||||
)
|
)
|
||||||
|
|
||||||
client.fail_task_if_not_swarm_manager()
|
client.fail_task_if_not_swarm_manager()
|
||||||
@ -111,7 +110,7 @@ def main():
|
|||||||
client.fail('An unexpected docker error occurred: {0}'.format(to_native(e)), exception=traceback.format_exc())
|
client.fail('An unexpected docker error occurred: {0}'.format(to_native(e)), exception=traceback.format_exc())
|
||||||
except RequestException as e:
|
except RequestException as e:
|
||||||
client.fail(
|
client.fail(
|
||||||
'An unexpected requests error occurred when docker-py tried to talk to the docker daemon: {0}'.format(to_native(e)),
|
'An unexpected requests error occurred when Docker SDK for Python tried to talk to the docker daemon: {0}'.format(to_native(e)),
|
||||||
exception=traceback.format_exc())
|
exception=traceback.format_exc())
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -76,8 +76,8 @@ author:
|
|||||||
- Alex Grönholm (@agronholm)
|
- Alex Grönholm (@agronholm)
|
||||||
|
|
||||||
requirements:
|
requirements:
|
||||||
- "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)"
|
- "L(Docker SDK for Python,https://docker-py.readthedocs.io/en/stable/) >= 1.10.0"
|
||||||
- "The docker server >= 1.9.0"
|
- "Docker API >= 1.25"
|
||||||
'''
|
'''
|
||||||
|
|
||||||
EXAMPLES = '''
|
EXAMPLES = '''
|
||||||
@ -287,14 +287,13 @@ def main():
|
|||||||
)
|
)
|
||||||
|
|
||||||
option_minimal_versions = dict(
|
option_minimal_versions = dict(
|
||||||
labels=dict(docker_py_version='1.10.0', docker_api_version='1.23'),
|
labels=dict(docker_py_version='1.10.0'),
|
||||||
)
|
)
|
||||||
|
|
||||||
client = AnsibleDockerClient(
|
client = AnsibleDockerClient(
|
||||||
argument_spec=argument_spec,
|
argument_spec=argument_spec,
|
||||||
supports_check_mode=True,
|
supports_check_mode=True,
|
||||||
min_docker_version='1.10.0',
|
min_docker_version='1.10.0',
|
||||||
min_docker_api_version='1.21',
|
|
||||||
# "The docker server >= 1.9.0"
|
# "The docker server >= 1.9.0"
|
||||||
option_minimal_versions=option_minimal_versions,
|
option_minimal_versions=option_minimal_versions,
|
||||||
)
|
)
|
||||||
@ -306,7 +305,7 @@ def main():
|
|||||||
client.fail('An unexpected docker error occurred: {0}'.format(to_native(e)), exception=traceback.format_exc())
|
client.fail('An unexpected docker error occurred: {0}'.format(to_native(e)), exception=traceback.format_exc())
|
||||||
except RequestException as e:
|
except RequestException as e:
|
||||||
client.fail(
|
client.fail(
|
||||||
'An unexpected requests error occurred when docker-py tried to talk to the docker daemon: {0}'.format(to_native(e)),
|
'An unexpected requests error occurred when Docker SDK for Python tried to talk to the docker daemon: {0}'.format(to_native(e)),
|
||||||
exception=traceback.format_exc())
|
exception=traceback.format_exc())
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -31,8 +31,7 @@ author:
|
|||||||
- Felix Fontein (@felixfontein)
|
- Felix Fontein (@felixfontein)
|
||||||
|
|
||||||
requirements:
|
requirements:
|
||||||
- "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)"
|
- "L(Docker SDK for Python,https://docker-py.readthedocs.io/en/stable/) >= 1.8.0"
|
||||||
- "Docker API >= 1.21"
|
|
||||||
'''
|
'''
|
||||||
|
|
||||||
EXAMPLES = '''
|
EXAMPLES = '''
|
||||||
@ -109,7 +108,6 @@ def main():
|
|||||||
argument_spec=argument_spec,
|
argument_spec=argument_spec,
|
||||||
supports_check_mode=True,
|
supports_check_mode=True,
|
||||||
min_docker_version='1.8.0',
|
min_docker_version='1.8.0',
|
||||||
min_docker_api_version='1.21',
|
|
||||||
)
|
)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
@ -124,7 +122,7 @@ def main():
|
|||||||
client.fail('An unexpected docker error occurred: {0}'.format(to_native(e)), exception=traceback.format_exc())
|
client.fail('An unexpected docker error occurred: {0}'.format(to_native(e)), exception=traceback.format_exc())
|
||||||
except RequestException as e:
|
except RequestException as e:
|
||||||
client.fail(
|
client.fail(
|
||||||
'An unexpected requests error occurred when docker-py tried to talk to the docker daemon: {0}'.format(to_native(e)),
|
'An unexpected requests error occurred when Docker SDK for Python tried to talk to the docker daemon: {0}'.format(to_native(e)),
|
||||||
exception=traceback.format_exc())
|
exception=traceback.format_exc())
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -2,4 +2,4 @@
|
|||||||
# See template for more information:
|
# See template for more information:
|
||||||
# https://github.com/ansible/ansible/blob/devel/test/lib/ansible_test/config/config.yml
|
# https://github.com/ansible/ansible/blob/devel/test/lib/ansible_test/config/config.yml
|
||||||
modules:
|
modules:
|
||||||
python_requires: default
|
python_requires: '>= 2.7'
|
||||||
|
|||||||
@ -1,34 +0,0 @@
|
|||||||
---
|
|
||||||
# Create random name prefix (for containers, networks, ...)
|
|
||||||
- name: Create random container name prefix
|
|
||||||
set_fact:
|
|
||||||
cname_prefix: "{{ 'ansible-docker-test-%0x' % ((2**32) | random) }}"
|
|
||||||
|
|
||||||
- name: Create project and container names
|
|
||||||
set_fact:
|
|
||||||
pname: "{{ cname_prefix }}"
|
|
||||||
cname: "{{ cname_prefix }}-hi"
|
|
||||||
|
|
||||||
- name: Define service
|
|
||||||
set_fact:
|
|
||||||
test_service: |
|
|
||||||
version: '3'
|
|
||||||
services:
|
|
||||||
{{ cname }}:
|
|
||||||
image: "{{ docker_test_image_alpine }}"
|
|
||||||
command: '/bin/sh -c "sleep 10m"'
|
|
||||||
stop_grace_period: 1s
|
|
||||||
|
|
||||||
- name: Present
|
|
||||||
community.docker.docker_compose:
|
|
||||||
project_name: "{{ pname }}"
|
|
||||||
state: present
|
|
||||||
remove_orphans: true
|
|
||||||
definition: "{{ test_service | from_yaml }}"
|
|
||||||
|
|
||||||
- name: Absent
|
|
||||||
community.docker.docker_compose:
|
|
||||||
project_name: "{{ pname }}"
|
|
||||||
state: absent
|
|
||||||
remove_orphans: true
|
|
||||||
definition: "{{ test_service | from_yaml }}"
|
|
||||||
@ -37,7 +37,7 @@
|
|||||||
when: docker_py_version is version('1.10.0', '>=')
|
when: docker_py_version is version('1.10.0', '>=')
|
||||||
diff: no
|
diff: no
|
||||||
|
|
||||||
when: has_docker_compose and docker_py_version is version('1.8.0', '>=') and docker_api_version is version('1.20', '>=')
|
when: has_docker_compose and docker_py_version is version('1.8.0', '>=') and docker_api_version is version('1.25', '>=')
|
||||||
|
|
||||||
- fail: msg="Too old docker / docker-py version to run all docker_container tests!"
|
- fail: msg="Too old docker / docker-py version to run all docker_container tests!"
|
||||||
when: has_docker_compose and not(docker_py_version is version('3.5.0', '>=') and docker_api_version is version('1.25', '>=')) and (ansible_distribution != 'CentOS' or ansible_distribution_major_version|int > 6)
|
when: has_docker_compose and not(docker_py_version is version('3.5.0', '>=') and docker_api_version is version('1.25', '>=')) and (ansible_distribution != 'CentOS' or ansible_distribution_major_version|int > 6)
|
||||||
|
|||||||
@ -56,7 +56,7 @@
|
|||||||
when: docker_py_version is version('1.10.0', '>=')
|
when: docker_py_version is version('1.10.0', '>=')
|
||||||
diff: no
|
diff: no
|
||||||
|
|
||||||
when: docker_py_version is version('1.8.0', '>=') and docker_api_version is version('1.20', '>=')
|
when: docker_py_version is version('1.8.0', '>=') and docker_api_version is version('1.25', '>=')
|
||||||
|
|
||||||
- fail: msg="Too old docker / docker-py version to run all docker_container tests!"
|
- fail: msg="Too old docker / docker-py version to run all docker_container tests!"
|
||||||
when: not(docker_py_version is version('3.5.0', '>=') and docker_api_version is version('1.25', '>=')) and (ansible_distribution != 'CentOS' or ansible_distribution_major_version|int > 6)
|
when: not(docker_py_version is version('3.5.0', '>=') and docker_api_version is version('1.25', '>=')) and (ansible_distribution != 'CentOS' or ansible_distribution_major_version|int > 6)
|
||||||
|
|||||||
@ -190,7 +190,7 @@
|
|||||||
- "'stderr' not in result"
|
- "'stderr' not in result"
|
||||||
- result.exec_id is string
|
- result.exec_id is string
|
||||||
|
|
||||||
- when: docker_py_version is version('2.3.0', '>=') and docker_api_version is version('1.25', '>=')
|
- when: docker_py_version is version('2.3.0', '>=')
|
||||||
block:
|
block:
|
||||||
- name: Execute in a present container (environment variable)
|
- name: Execute in a present container (environment variable)
|
||||||
docker_container_exec:
|
docker_container_exec:
|
||||||
@ -220,7 +220,7 @@
|
|||||||
state: absent
|
state: absent
|
||||||
force_kill: yes
|
force_kill: yes
|
||||||
|
|
||||||
when: docker_py_version is version('1.8.0', '>=') and docker_api_version is version('1.20', '>=')
|
when: docker_py_version is version('1.8.0', '>=') and docker_api_version is version('1.25', '>=')
|
||||||
|
|
||||||
- fail: msg="Too old docker / docker-py version to run docker_container_exec tests!"
|
- fail: msg="Too old docker / docker-py version to run docker_container_exec tests!"
|
||||||
when: not(docker_py_version is version('1.8.0', '>=') and docker_api_version is version('1.20', '>=')) and (ansible_distribution != 'CentOS' or ansible_distribution_major_version|int > 6)
|
when: not(docker_py_version is version('1.8.0', '>=') and docker_api_version is version('1.25', '>=')) and (ansible_distribution != 'CentOS' or ansible_distribution_major_version|int > 6)
|
||||||
|
|||||||
@ -74,7 +74,7 @@
|
|||||||
state: absent
|
state: absent
|
||||||
force_kill: yes
|
force_kill: yes
|
||||||
|
|
||||||
when: docker_py_version is version('1.8.0', '>=') and docker_api_version is version('1.20', '>=')
|
when: docker_py_version is version('1.8.0', '>=') and docker_api_version is version('1.25', '>=')
|
||||||
|
|
||||||
- fail: msg="Too old docker / docker-py version to run docker_container_info tests!"
|
- fail: msg="Too old docker / docker-py version to run docker_container_info tests!"
|
||||||
when: not(docker_py_version is version('1.8.0', '>=') and docker_api_version is version('1.20', '>=')) and (ansible_distribution != 'CentOS' or ansible_distribution_major_version|int > 6)
|
when: not(docker_py_version is version('1.8.0', '>=') and docker_api_version is version('1.25', '>=')) and (ansible_distribution != 'CentOS' or ansible_distribution_major_version|int > 6)
|
||||||
|
|||||||
@ -4,7 +4,7 @@
|
|||||||
####################################################################
|
####################################################################
|
||||||
|
|
||||||
- include_tasks: test_host_info.yml
|
- include_tasks: test_host_info.yml
|
||||||
when: docker_py_version is version('1.10.0', '>=') and docker_api_version is version('1.21', '>=')
|
when: docker_py_version is version('1.10.0', '>=') and docker_api_version is version('1.25', '>=')
|
||||||
|
|
||||||
- fail: msg="Too old docker / docker-py version to run docker_host_info tests!"
|
- fail: msg="Too old docker / docker-py version to run docker_host_info tests!"
|
||||||
when: not(docker_py_version is version('1.10.0', '>=') and docker_api_version is version('1.21', '>=')) and (ansible_distribution != 'CentOS' or ansible_distribution_major_version|int > 6)
|
when: not(docker_py_version is version('1.10.0', '>=') and docker_api_version is version('1.25', '>=')) and (ansible_distribution != 'CentOS' or ansible_distribution_major_version|int > 6)
|
||||||
|
|||||||
@ -43,7 +43,7 @@
|
|||||||
force_kill: yes
|
force_kill: yes
|
||||||
with_items: "{{ cnames }}"
|
with_items: "{{ cnames }}"
|
||||||
|
|
||||||
when: docker_py_version is version('1.8.0', '>=') and docker_api_version is version('1.20', '>=')
|
when: docker_py_version is version('1.8.0', '>=') and docker_api_version is version('1.25', '>=')
|
||||||
|
|
||||||
- fail: msg="Too old docker / docker-py version to run docker_image tests!"
|
- fail: msg="Too old docker / docker-py version to run docker_image tests!"
|
||||||
when: not(docker_py_version is version('1.8.0', '>=') and docker_api_version is version('1.20', '>=')) and (ansible_distribution != 'CentOS' or ansible_distribution_major_version|int > 6)
|
when: not(docker_py_version is version('1.8.0', '>=') and docker_api_version is version('1.25', '>=')) and (ansible_distribution != 'CentOS' or ansible_distribution_major_version|int > 6)
|
||||||
|
|||||||
@ -289,20 +289,12 @@
|
|||||||
register: load_image_3
|
register: load_image_3
|
||||||
ignore_errors: true
|
ignore_errors: true
|
||||||
|
|
||||||
- name: load image (invalid image, old API version)
|
|
||||||
docker_image:
|
|
||||||
name: foo:bar
|
|
||||||
load_path: "{{ remote_tmp_dir }}/image-invalid.tar"
|
|
||||||
source: load
|
|
||||||
api_version: "1.22"
|
|
||||||
register: load_image_4
|
|
||||||
|
|
||||||
- name: load image (ID, idempotency)
|
- name: load image (ID, idempotency)
|
||||||
docker_image:
|
docker_image:
|
||||||
name: "{{ archive_image.image.Id }}"
|
name: "{{ archive_image.image.Id }}"
|
||||||
load_path: "{{ remote_tmp_dir }}/image_id.tar"
|
load_path: "{{ remote_tmp_dir }}/image_id.tar"
|
||||||
source: load
|
source: load
|
||||||
register: load_image_5
|
register: load_image_4
|
||||||
|
|
||||||
- assert:
|
- assert:
|
||||||
that:
|
that:
|
||||||
@ -314,9 +306,7 @@
|
|||||||
"The archive did not contain image 'foo:bar'. Instead, found '" ~ docker_test_image_hello_world ~ "'." == load_image_2.msg
|
"The archive did not contain image 'foo:bar'. Instead, found '" ~ docker_test_image_hello_world ~ "'." == load_image_2.msg
|
||||||
- load_image_3 is failed
|
- load_image_3 is failed
|
||||||
- '"Detected no loaded images. Archive potentially corrupt?" == load_image_3.msg'
|
- '"Detected no loaded images. Archive potentially corrupt?" == load_image_3.msg'
|
||||||
- load_image_4 is changed
|
- load_image_4 is not changed
|
||||||
- "'The API version of your Docker daemon is < 1.23, which does not return the image loading result from the Docker daemon. Therefore, we cannot verify whether the expected image was loaded, whether multiple images where loaded, or whether the load actually succeeded. You should consider upgrading your Docker daemon.' in load_image_4.warnings"
|
|
||||||
- load_image_5 is not changed
|
|
||||||
|
|
||||||
####################################################################
|
####################################################################
|
||||||
## build.path ######################################################
|
## build.path ######################################################
|
||||||
|
|||||||
@ -53,7 +53,7 @@
|
|||||||
- "docker_test_image_hello_world in result.images[0].RepoTags"
|
- "docker_test_image_hello_world in result.images[0].RepoTags"
|
||||||
- "docker_test_image_alpine in result.images[1].RepoTags"
|
- "docker_test_image_alpine in result.images[1].RepoTags"
|
||||||
|
|
||||||
when: docker_py_version is version('1.8.0', '>=') and docker_api_version is version('1.20', '>=')
|
when: docker_py_version is version('1.8.0', '>=') and docker_api_version is version('1.25', '>=')
|
||||||
|
|
||||||
- fail: msg="Too old docker / docker-py version to run docker_image_info tests!"
|
- fail: msg="Too old docker / docker-py version to run docker_image_info tests!"
|
||||||
when: not(docker_py_version is version('1.8.0', '>=') and docker_api_version is version('1.20', '>=')) and (ansible_distribution != 'CentOS' or ansible_distribution_major_version|int > 6)
|
when: not(docker_py_version is version('1.8.0', '>=') and docker_api_version is version('1.25', '>=')) and (ansible_distribution != 'CentOS' or ansible_distribution_major_version|int > 6)
|
||||||
|
|||||||
@ -28,7 +28,7 @@
|
|||||||
force_kill: yes
|
force_kill: yes
|
||||||
with_items: "{{ cnames }}"
|
with_items: "{{ cnames }}"
|
||||||
|
|
||||||
when: docker_py_version is version('2.5.0', '>=') and docker_api_version is version('1.23', '>=')
|
when: docker_py_version is version('2.5.0', '>=') and docker_api_version is version('1.25', '>=')
|
||||||
|
|
||||||
- fail: msg="Too old docker / docker-py version to run docker_image tests!"
|
- fail: msg="Too old docker / docker-py version to run docker_image tests!"
|
||||||
when: not(docker_py_version is version('2.5.0', '>=') and docker_api_version is version('1.23', '>=')) and (ansible_distribution != 'CentOS' or ansible_distribution_major_version|int > 6)
|
when: not(docker_py_version is version('2.5.0', '>=') and docker_api_version is version('1.25', '>=')) and (ansible_distribution != 'CentOS' or ansible_distribution_major_version|int > 6)
|
||||||
|
|||||||
@ -3,7 +3,7 @@
|
|||||||
- include_tasks: run-test.yml
|
- include_tasks: run-test.yml
|
||||||
with_fileglob:
|
with_fileglob:
|
||||||
- "tests/*.yml"
|
- "tests/*.yml"
|
||||||
when: docker_py_version is version('1.8.0', '>=') and docker_api_version is version('1.20', '>=')
|
when: docker_py_version is version('1.8.0', '>=') and docker_api_version is version('1.25', '>=')
|
||||||
|
|
||||||
- fail: msg="Too old docker / docker-py version to run docker_image tests!"
|
- fail: msg="Too old docker / docker-py version to run docker_image tests!"
|
||||||
when: not(docker_py_version is version('1.8.0', '>=') and docker_api_version is version('1.20', '>=')) and (ansible_distribution != 'CentOS' or ansible_distribution_major_version|int > 6)
|
when: not(docker_py_version is version('1.8.0', '>=') and docker_api_version is version('1.25', '>=')) and (ansible_distribution != 'CentOS' or ansible_distribution_major_version|int > 6)
|
||||||
|
|||||||
@ -42,7 +42,7 @@
|
|||||||
force: yes
|
force: yes
|
||||||
loop: "{{ dnetworks }}"
|
loop: "{{ dnetworks }}"
|
||||||
|
|
||||||
when: docker_py_version is version('1.10.0', '>=') and docker_api_version is version('1.20', '>=') # FIXME: find out API version!
|
when: docker_py_version is version('1.10.0', '>=') and docker_api_version is version('1.25', '>=')
|
||||||
|
|
||||||
- fail: msg="Too old docker / docker-py version to run docker_network tests!"
|
- fail: msg="Too old docker / docker-py version to run docker_network tests!"
|
||||||
when: not(docker_py_version is version('1.10.0', '>=') and docker_api_version is version('1.20', '>=')) and (ansible_distribution != 'CentOS' or ansible_distribution_major_version|int > 6)
|
when: not(docker_py_version is version('1.10.0', '>=') and docker_api_version is version('1.25', '>=')) and (ansible_distribution != 'CentOS' or ansible_distribution_major_version|int > 6)
|
||||||
|
|||||||
@ -145,7 +145,7 @@
|
|||||||
force: yes
|
force: yes
|
||||||
|
|
||||||
# Requirements for docker_swarm
|
# Requirements for docker_swarm
|
||||||
when: docker_py_version is version('2.6.0', '>=') and docker_api_version is version('1.25', '>=')
|
when: docker_py_version is version('2.6.0', '>=')
|
||||||
|
|
||||||
####################################################################
|
####################################################################
|
||||||
## attachable ######################################################
|
## attachable ######################################################
|
||||||
|
|||||||
@ -56,6 +56,3 @@
|
|||||||
docker_swarm:
|
docker_swarm:
|
||||||
state: absent
|
state: absent
|
||||||
force: yes
|
force: yes
|
||||||
|
|
||||||
# Requirements for docker_swarm
|
|
||||||
when: docker_py_version is version('2.6.0', '>=') and docker_api_version is version('1.25', '>=')
|
|
||||||
|
|||||||
@ -70,7 +70,7 @@
|
|||||||
- "'is too new. Maximum supported API version is' in docker_inspect.stderr"
|
- "'is too new. Maximum supported API version is' in docker_inspect.stderr"
|
||||||
when: docker_inspect is failed
|
when: docker_inspect is failed
|
||||||
|
|
||||||
when: docker_py_version is version('1.8.0', '>=') and docker_api_version is version('1.21', '>=')
|
when: docker_py_version is version('1.8.0', '>=') and docker_api_version is version('1.25', '>=')
|
||||||
|
|
||||||
- fail: msg="Too old docker / docker-py version to run docker_network_info tests!"
|
- fail: msg="Too old docker / docker-py version to run docker_network_info tests!"
|
||||||
when: not(docker_py_version is version('1.8.0', '>=') and docker_api_version is version('1.21', '>=')) and (ansible_distribution != 'CentOS' or ansible_distribution_major_version|int > 6)
|
when: not(docker_py_version is version('1.8.0', '>=') and docker_api_version is version('1.25', '>=')) and (ansible_distribution != 'CentOS' or ansible_distribution_major_version|int > 6)
|
||||||
|
|||||||
@ -4,7 +4,6 @@
|
|||||||
####################################################################
|
####################################################################
|
||||||
|
|
||||||
- include_tasks: test_node_info.yml
|
- include_tasks: test_node_info.yml
|
||||||
# Maximum of 1.24 (docker API version for docker_node_info) and 1.25 (docker API version for docker_swarm) is 1.25
|
|
||||||
when: docker_py_version is version('2.4.0', '>=') and docker_api_version is version('1.25', '>=')
|
when: docker_py_version is version('2.4.0', '>=') and docker_api_version is version('1.25', '>=')
|
||||||
|
|
||||||
- fail: msg="Too old docker / docker-py version to run docker_node_info tests!"
|
- fail: msg="Too old docker / docker-py version to run docker_node_info tests!"
|
||||||
|
|||||||
@ -18,7 +18,7 @@
|
|||||||
state: absent
|
state: absent
|
||||||
with_items: "{{ plugin_names }}"
|
with_items: "{{ plugin_names }}"
|
||||||
|
|
||||||
when: docker_py_version is version('1.10.0', '>=') and docker_api_version is version('1.20', '>=')
|
when: docker_py_version is version('1.10.0', '>=') and docker_api_version is version('1.25', '>=')
|
||||||
|
|
||||||
- fail: msg="Too old docker / docker-py version to run docker_plugin tests!"
|
- fail: msg="Too old docker / docker-py version to run docker_plugin tests!"
|
||||||
when: not(docker_py_version is version('1.10.0', '>=') and docker_api_version is version('1.20', '>=')) and (ansible_distribution != 'CentOS' or ansible_distribution_major_version|int > 6)
|
when: not(docker_py_version is version('1.10.0', '>=') and docker_api_version is version('1.25', '>=')) and (ansible_distribution != 'CentOS' or ansible_distribution_major_version|int > 6)
|
||||||
|
|||||||
@ -4,7 +4,6 @@
|
|||||||
####################################################################
|
####################################################################
|
||||||
|
|
||||||
- include_tasks: test_swarm_info.yml
|
- include_tasks: test_swarm_info.yml
|
||||||
# Maximum of 1.24 (docker API version for docker_swarm_info) and 1.25 (docker API version for docker_swarm) is 1.25
|
|
||||||
when: docker_py_version is version('1.10.0', '>=') and docker_api_version is version('1.25', '>=')
|
when: docker_py_version is version('1.10.0', '>=') and docker_api_version is version('1.25', '>=')
|
||||||
|
|
||||||
- fail: msg="Too old docker / docker-py version to run docker_swarm_info tests!"
|
- fail: msg="Too old docker / docker-py version to run docker_swarm_info tests!"
|
||||||
|
|||||||
@ -73,7 +73,6 @@
|
|||||||
state: absent
|
state: absent
|
||||||
force: yes
|
force: yes
|
||||||
ignore_errors: yes
|
ignore_errors: yes
|
||||||
# Maximum of 1.24 (docker API version for docker_swarm_service) and 1.25 (docker API version for docker_swarm) is 1.25
|
|
||||||
when: docker_py_version is version('2.0.2', '>=') and docker_api_version is version('1.25', '>=')
|
when: docker_py_version is version('2.0.2', '>=') and docker_api_version is version('1.25', '>=')
|
||||||
|
|
||||||
- fail: msg="Too old docker / docker-py version to run docker_swarm_service tests!"
|
- fail: msg="Too old docker / docker-py version to run docker_swarm_service tests!"
|
||||||
|
|||||||
@ -110,4 +110,4 @@
|
|||||||
that:
|
that:
|
||||||
- output is success
|
- output is success
|
||||||
- output is changed
|
- output is changed
|
||||||
when: docker_api_version is version('1.24', '>=') and docker_py_version is version('3.0.0', '>=')
|
when: docker_api_version is version('1.25', '>=') and docker_py_version is version('3.0.0', '>=')
|
||||||
|
|||||||
@ -319,12 +319,12 @@
|
|||||||
- dns_4 is changed
|
- dns_4 is changed
|
||||||
- dns_5 is changed
|
- dns_5 is changed
|
||||||
- dns_6 is not changed
|
- dns_6 is not changed
|
||||||
when: docker_api_version is version('1.25', '>=') and docker_py_version is version('2.6.0', '>=')
|
when: docker_py_version is version('2.6.0', '>=')
|
||||||
- assert:
|
- assert:
|
||||||
that:
|
that:
|
||||||
- dns_1 is failed
|
- dns_1 is failed
|
||||||
- "'Minimum version required' in dns_1.msg"
|
- "'Minimum version required' in dns_1.msg"
|
||||||
when: docker_api_version is version('1.25', '<') or docker_py_version is version('2.6.0', '<')
|
when: docker_py_version is version('2.6.0', '<')
|
||||||
|
|
||||||
####################################################################
|
####################################################################
|
||||||
## dns_options #####################################################
|
## dns_options #####################################################
|
||||||
@ -412,12 +412,12 @@
|
|||||||
- dns_options_4 is not changed
|
- dns_options_4 is not changed
|
||||||
- dns_options_5 is changed
|
- dns_options_5 is changed
|
||||||
- dns_options_6 is not changed
|
- dns_options_6 is not changed
|
||||||
when: docker_api_version is version('1.25', '>=') and docker_py_version is version('2.6.0', '>=')
|
when: docker_py_version is version('2.6.0', '>=')
|
||||||
- assert:
|
- assert:
|
||||||
that:
|
that:
|
||||||
- dns_options_1 is failed
|
- dns_options_1 is failed
|
||||||
- "'Minimum version required' in dns_options_1.msg"
|
- "'Minimum version required' in dns_options_1.msg"
|
||||||
when: docker_api_version is version('1.25', '<') or docker_py_version is version('2.6.0', '<')
|
when: docker_py_version is version('2.6.0', '<')
|
||||||
|
|
||||||
####################################################################
|
####################################################################
|
||||||
## dns_search ######################################################
|
## dns_search ######################################################
|
||||||
@ -505,12 +505,12 @@
|
|||||||
- dns_search_4 is changed
|
- dns_search_4 is changed
|
||||||
- dns_search_5 is changed
|
- dns_search_5 is changed
|
||||||
- dns_search_6 is not changed
|
- dns_search_6 is not changed
|
||||||
when: docker_api_version is version('1.25', '>=') and docker_py_version is version('2.6.0', '>=')
|
when: docker_py_version is version('2.6.0', '>=')
|
||||||
- assert:
|
- assert:
|
||||||
that:
|
that:
|
||||||
- dns_search_1 is failed
|
- dns_search_1 is failed
|
||||||
- "'Minimum version required' in dns_search_1.msg"
|
- "'Minimum version required' in dns_search_1.msg"
|
||||||
when: docker_api_version is version('1.25', '<') or docker_py_version is version('2.6.0', '<')
|
when: docker_py_version is version('2.6.0', '<')
|
||||||
|
|
||||||
####################################################################
|
####################################################################
|
||||||
## endpoint_mode ###################################################
|
## endpoint_mode ###################################################
|
||||||
@ -557,12 +557,12 @@
|
|||||||
- endpoint_mode_1 is changed
|
- endpoint_mode_1 is changed
|
||||||
- endpoint_mode_2 is not changed
|
- endpoint_mode_2 is not changed
|
||||||
- endpoint_mode_3 is changed
|
- endpoint_mode_3 is changed
|
||||||
when: docker_api_version is version('1.25', '>=') and docker_py_version is version('3.0.0', '>=')
|
when: docker_py_version is version('3.0.0', '>=')
|
||||||
- assert:
|
- assert:
|
||||||
that:
|
that:
|
||||||
- endpoint_mode_1 is failed
|
- endpoint_mode_1 is failed
|
||||||
- "'Minimum version required' in endpoint_mode_1.msg"
|
- "'Minimum version required' in endpoint_mode_1.msg"
|
||||||
when: docker_api_version is version('1.25', '<') or docker_py_version is version('3.0.0', '<')
|
when: docker_py_version is version('3.0.0', '<')
|
||||||
|
|
||||||
####################################################################
|
####################################################################
|
||||||
## env #############################################################
|
## env #############################################################
|
||||||
@ -800,12 +800,12 @@
|
|||||||
that:
|
that:
|
||||||
- force_update_1 is changed
|
- force_update_1 is changed
|
||||||
- force_update_2 is changed
|
- force_update_2 is changed
|
||||||
when: docker_api_version is version('1.25', '>=') and docker_py_version is version('2.1.0', '>=')
|
when: docker_py_version is version('2.1.0', '>=')
|
||||||
- assert:
|
- assert:
|
||||||
that:
|
that:
|
||||||
- force_update_1 is failed
|
- force_update_1 is failed
|
||||||
- "'Minimum version required' in force_update_1.msg"
|
- "'Minimum version required' in force_update_1.msg"
|
||||||
when: docker_api_version is version('1.25', '<') or docker_py_version is version('2.1.0', '<')
|
when: docker_py_version is version('2.1.0', '<')
|
||||||
|
|
||||||
####################################################################
|
####################################################################
|
||||||
## groups ##########################################################
|
## groups ##########################################################
|
||||||
@ -892,12 +892,12 @@
|
|||||||
- groups_4 is changed
|
- groups_4 is changed
|
||||||
- groups_5 is changed
|
- groups_5 is changed
|
||||||
- groups_6 is not changed
|
- groups_6 is not changed
|
||||||
when: docker_api_version is version('1.25', '>=') and docker_py_version is version('2.6.0', '>=')
|
when: docker_py_version is version('2.6.0', '>=')
|
||||||
- assert:
|
- assert:
|
||||||
that:
|
that:
|
||||||
- groups_1 is failed
|
- groups_1 is failed
|
||||||
- "'Minimum version required' in groups_1.msg"
|
- "'Minimum version required' in groups_1.msg"
|
||||||
when: docker_api_version is version('1.25', '<') or docker_py_version is version('2.6.0', '<')
|
when: docker_py_version is version('2.6.0', '<')
|
||||||
|
|
||||||
####################################################################
|
####################################################################
|
||||||
## healthcheck #####################################################
|
## healthcheck #####################################################
|
||||||
@ -1091,12 +1091,12 @@
|
|||||||
- hostname_1 is changed
|
- hostname_1 is changed
|
||||||
- hostname_2 is not changed
|
- hostname_2 is not changed
|
||||||
- hostname_3 is changed
|
- hostname_3 is changed
|
||||||
when: docker_api_version is version('1.25', '>=') and docker_py_version is version('2.2.0', '>=')
|
when: docker_py_version is version('2.2.0', '>=')
|
||||||
- assert:
|
- assert:
|
||||||
that:
|
that:
|
||||||
- hostname_1 is failed
|
- hostname_1 is failed
|
||||||
- "'Minimum version required' in hostname_1.msg"
|
- "'Minimum version required' in hostname_1.msg"
|
||||||
when: docker_api_version is version('1.25', '<') or docker_py_version is version('2.2.0', '<')
|
when: docker_py_version is version('2.2.0', '<')
|
||||||
|
|
||||||
###################################################################
|
###################################################################
|
||||||
## hosts ##########################################################
|
## hosts ##########################################################
|
||||||
@ -1148,12 +1148,12 @@
|
|||||||
- hosts_1 is changed
|
- hosts_1 is changed
|
||||||
- hosts_2 is not changed
|
- hosts_2 is not changed
|
||||||
- hosts_3 is changed
|
- hosts_3 is changed
|
||||||
when: docker_api_version is version('1.25', '>=') and docker_py_version is version('2.6.0', '>=')
|
when: docker_py_version is version('2.6.0', '>=')
|
||||||
- assert:
|
- assert:
|
||||||
that:
|
that:
|
||||||
- hosts_1 is failed
|
- hosts_1 is failed
|
||||||
- "'Minimum version required' in hosts_1.msg"
|
- "'Minimum version required' in hosts_1.msg"
|
||||||
when: docker_api_version is version('1.25', '<') or docker_py_version is version('2.6.0', '<')
|
when: docker_py_version is version('2.6.0', '<')
|
||||||
|
|
||||||
|
|
||||||
###################################################################
|
###################################################################
|
||||||
@ -1587,12 +1587,12 @@
|
|||||||
- (publish_8_info.service.Endpoint.Ports | length) == 2
|
- (publish_8_info.service.Endpoint.Ports | length) == 2
|
||||||
- publish_9 is changed
|
- publish_9 is changed
|
||||||
- publish_10 is not changed
|
- publish_10 is not changed
|
||||||
when: docker_api_version is version('1.25', '>=') and docker_py_version is version('3.0.0', '>=')
|
when: docker_py_version is version('3.0.0', '>=')
|
||||||
- assert:
|
- assert:
|
||||||
that:
|
that:
|
||||||
- publish_1 is failed
|
- publish_1 is failed
|
||||||
- "'Minimum version required' in publish_1.msg"
|
- "'Minimum version required' in publish_1.msg"
|
||||||
when: docker_api_version is version('1.25', '<') or docker_py_version is version('3.0.0', '<')
|
when: docker_py_version is version('3.0.0', '<')
|
||||||
|
|
||||||
###################################################################
|
###################################################################
|
||||||
## read_only ######################################################
|
## read_only ######################################################
|
||||||
@ -1784,12 +1784,12 @@
|
|||||||
- tty_1 is changed
|
- tty_1 is changed
|
||||||
- tty_2 is not changed
|
- tty_2 is not changed
|
||||||
- tty_3 is changed
|
- tty_3 is changed
|
||||||
when: docker_api_version is version('1.25', '>=') and docker_py_version is version('2.4.0', '>=')
|
when: docker_py_version is version('2.4.0', '>=')
|
||||||
- assert:
|
- assert:
|
||||||
that:
|
that:
|
||||||
- tty_1 is failed
|
- tty_1 is failed
|
||||||
- "'Minimum version required' in tty_1.msg"
|
- "'Minimum version required' in tty_1.msg"
|
||||||
when: docker_api_version is version('1.25', '<') or docker_py_version is version('2.4.0', '<')
|
when: docker_py_version is version('2.4.0', '<')
|
||||||
|
|
||||||
###################################################################
|
###################################################################
|
||||||
## user ###########################################################
|
## user ###########################################################
|
||||||
|
|||||||
@ -16,14 +16,14 @@
|
|||||||
data: "secret1"
|
data: "secret1"
|
||||||
state: "present"
|
state: "present"
|
||||||
register: "secret_result_1"
|
register: "secret_result_1"
|
||||||
when: docker_api_version is version('1.25', '>=') and docker_py_version is version('2.1.0', '>=')
|
when: docker_py_version is version('2.1.0', '>=')
|
||||||
|
|
||||||
- docker_secret:
|
- docker_secret:
|
||||||
name: "{{ secret_name_2 }}"
|
name: "{{ secret_name_2 }}"
|
||||||
data: "secret2"
|
data: "secret2"
|
||||||
state: "present"
|
state: "present"
|
||||||
register: "secret_result_2"
|
register: "secret_result_2"
|
||||||
when: docker_api_version is version('1.25', '>=') and docker_py_version is version('2.1.0', '>=')
|
when: docker_py_version is version('2.1.0', '>=')
|
||||||
|
|
||||||
- docker_secret:
|
- docker_secret:
|
||||||
name: "{{ secret_name_3 }}"
|
name: "{{ secret_name_3 }}"
|
||||||
@ -31,7 +31,7 @@
|
|||||||
state: "present"
|
state: "present"
|
||||||
rolling_versions: true
|
rolling_versions: true
|
||||||
register: "secret_result_3"
|
register: "secret_result_3"
|
||||||
when: docker_api_version is version('1.25', '>=') and docker_py_version is version('2.1.0', '>=')
|
when: docker_py_version is version('2.1.0', '>=')
|
||||||
|
|
||||||
####################################################################
|
####################################################################
|
||||||
## secrets #########################################################
|
## secrets #########################################################
|
||||||
@ -159,7 +159,7 @@
|
|||||||
state: "present"
|
state: "present"
|
||||||
rolling_versions: true
|
rolling_versions: true
|
||||||
register: secrets_10
|
register: secrets_10
|
||||||
when: docker_api_version is version('1.25', '>=') and docker_py_version is version('2.1.0', '>=')
|
when: docker_py_version is version('2.1.0', '>=')
|
||||||
ignore_errors: yes
|
ignore_errors: yes
|
||||||
|
|
||||||
- name: rolling secrets service update
|
- name: rolling secrets service update
|
||||||
@ -193,12 +193,12 @@
|
|||||||
- secrets_9 is changed
|
- secrets_9 is changed
|
||||||
- secrets_10 is not failed
|
- secrets_10 is not failed
|
||||||
- secrets_11 is changed
|
- secrets_11 is changed
|
||||||
when: docker_api_version is version('1.25', '>=') and docker_py_version is version('2.4.0', '>=')
|
when: docker_py_version is version('2.4.0', '>=')
|
||||||
- assert:
|
- assert:
|
||||||
that:
|
that:
|
||||||
- secrets_1 is failed
|
- secrets_1 is failed
|
||||||
- "'Minimum version required' in secrets_1.msg"
|
- "'Minimum version required' in secrets_1.msg"
|
||||||
when: docker_api_version is version('1.25', '<') or docker_py_version is version('2.4.0', '<')
|
when: docker_py_version is version('2.4.0', '<')
|
||||||
|
|
||||||
####################################################################
|
####################################################################
|
||||||
## secrets (uid) ###################################################
|
## secrets (uid) ###################################################
|
||||||
@ -282,12 +282,12 @@
|
|||||||
- secrets_3 is changed
|
- secrets_3 is changed
|
||||||
- secrets_4 is changed
|
- secrets_4 is changed
|
||||||
- secrets_5 is not changed
|
- secrets_5 is not changed
|
||||||
when: docker_api_version is version('1.25', '>=') and docker_py_version is version('2.4.0', '>=')
|
when: docker_py_version is version('2.4.0', '>=')
|
||||||
- assert:
|
- assert:
|
||||||
that:
|
that:
|
||||||
- secrets_1 is failed
|
- secrets_1 is failed
|
||||||
- "'Minimum version required' in secrets_1.msg"
|
- "'Minimum version required' in secrets_1.msg"
|
||||||
when: docker_api_version is version('1.25', '<') or docker_py_version is version('2.4.0', '<')
|
when: docker_py_version is version('2.4.0', '<')
|
||||||
|
|
||||||
####################################################################
|
####################################################################
|
||||||
## secrets (gid) ###################################################
|
## secrets (gid) ###################################################
|
||||||
@ -371,12 +371,12 @@
|
|||||||
- secrets_3 is changed
|
- secrets_3 is changed
|
||||||
- secrets_4 is changed
|
- secrets_4 is changed
|
||||||
- secrets_5 is not changed
|
- secrets_5 is not changed
|
||||||
when: docker_api_version is version('1.25', '>=') and docker_py_version is version('2.4.0', '>=')
|
when: docker_py_version is version('2.4.0', '>=')
|
||||||
- assert:
|
- assert:
|
||||||
that:
|
that:
|
||||||
- secrets_1 is failed
|
- secrets_1 is failed
|
||||||
- "'Minimum version required' in secrets_1.msg"
|
- "'Minimum version required' in secrets_1.msg"
|
||||||
when: docker_api_version is version('1.25', '<') or docker_py_version is version('2.4.0', '<')
|
when: docker_py_version is version('2.4.0', '<')
|
||||||
|
|
||||||
####################################################################
|
####################################################################
|
||||||
## secrets (mode) ##################################################
|
## secrets (mode) ##################################################
|
||||||
@ -432,12 +432,12 @@
|
|||||||
- secrets_1 is changed
|
- secrets_1 is changed
|
||||||
- secrets_2 is not changed
|
- secrets_2 is not changed
|
||||||
- secrets_3 is changed
|
- secrets_3 is changed
|
||||||
when: docker_api_version is version('1.25', '>=') and docker_py_version is version('2.4.0', '>=')
|
when: docker_py_version is version('2.4.0', '>=')
|
||||||
- assert:
|
- assert:
|
||||||
that:
|
that:
|
||||||
- secrets_1 is failed
|
- secrets_1 is failed
|
||||||
- "'Minimum version required' in secrets_1.msg"
|
- "'Minimum version required' in secrets_1.msg"
|
||||||
when: docker_api_version is version('1.25', '<') or docker_py_version is version('2.4.0', '<')
|
when: docker_py_version is version('2.4.0', '<')
|
||||||
|
|
||||||
####################################################################
|
####################################################################
|
||||||
####################################################################
|
####################################################################
|
||||||
@ -455,4 +455,4 @@
|
|||||||
loop_control:
|
loop_control:
|
||||||
loop_var: secret_name
|
loop_var: secret_name
|
||||||
ignore_errors: yes
|
ignore_errors: yes
|
||||||
when: docker_api_version is version('1.25', '>=') and docker_py_version is version('2.1.0', '>=')
|
when: docker_py_version is version('2.1.0', '>=')
|
||||||
|
|||||||
@ -183,12 +183,12 @@
|
|||||||
- update_max_failure_ratio_1 is changed
|
- update_max_failure_ratio_1 is changed
|
||||||
- update_max_failure_ratio_2 is not changed
|
- update_max_failure_ratio_2 is not changed
|
||||||
- update_max_failure_ratio_3 is changed
|
- update_max_failure_ratio_3 is changed
|
||||||
when: docker_api_version is version('1.25', '>=') and docker_py_version is version('2.1.0', '>=')
|
when: docker_py_version is version('2.1.0', '>=')
|
||||||
- assert:
|
- assert:
|
||||||
that:
|
that:
|
||||||
- update_max_failure_ratio_1 is failed
|
- update_max_failure_ratio_1 is failed
|
||||||
- "'Minimum version required' in update_max_failure_ratio_1.msg"
|
- "'Minimum version required' in update_max_failure_ratio_1.msg"
|
||||||
when: docker_api_version is version('1.25', '<') or docker_py_version is version('2.1.0', '<')
|
when: docker_py_version is version('2.1.0', '<')
|
||||||
|
|
||||||
###################################################################
|
###################################################################
|
||||||
# update_config.monitor ###########################################
|
# update_config.monitor ###########################################
|
||||||
@ -238,12 +238,12 @@
|
|||||||
- update_monitor_1 is changed
|
- update_monitor_1 is changed
|
||||||
- update_monitor_2 is not changed
|
- update_monitor_2 is not changed
|
||||||
- update_monitor_3 is changed
|
- update_monitor_3 is changed
|
||||||
when: docker_api_version is version('1.25', '>=') and docker_py_version is version('2.1.0', '>=')
|
when: docker_py_version is version('2.1.0', '>=')
|
||||||
- assert:
|
- assert:
|
||||||
that:
|
that:
|
||||||
- update_monitor_1 is failed
|
- update_monitor_1 is failed
|
||||||
- "'Minimum version required' in update_monitor_1.msg"
|
- "'Minimum version required' in update_monitor_1.msg"
|
||||||
when: docker_api_version is version('1.25', '<') or docker_py_version is version('2.1.0', '<')
|
when: docker_py_version is version('2.1.0', '<')
|
||||||
|
|
||||||
###################################################################
|
###################################################################
|
||||||
# update_config.order #############################################
|
# update_config.order #############################################
|
||||||
|
|||||||
@ -5,7 +5,7 @@
|
|||||||
####################################################################
|
####################################################################
|
||||||
|
|
||||||
- include_tasks: test_docker_swarm_service_info.yml
|
- include_tasks: test_docker_swarm_service_info.yml
|
||||||
when: docker_py_version is version('2.0.0', '>=') and docker_api_version is version('1.24', '>=')
|
when: docker_py_version is version('2.0.0', '>=') and docker_api_version is version('1.25', '>=')
|
||||||
|
|
||||||
- fail: msg="Too old docker / docker-py version to run docker_swarm_service_info tests!"
|
- fail: msg="Too old docker / docker-py version to run docker_swarm_service_info tests!"
|
||||||
when: not(docker_py_version is version('2.0.0', '>=') and docker_api_version is version('1.24', '>=')) and (ansible_distribution != 'CentOS' or ansible_distribution_major_version|int > 6)
|
when: not(docker_py_version is version('2.0.0', '>=') and docker_api_version is version('1.25', '>=')) and (ansible_distribution != 'CentOS' or ansible_distribution_major_version|int > 6)
|
||||||
|
|||||||
@ -76,7 +76,6 @@
|
|||||||
state: absent
|
state: absent
|
||||||
force: true
|
force: true
|
||||||
|
|
||||||
# Maximum of 1.24 (docker API version for docker_swarm_service_info) and 1.25 (docker API version for docker_swarm) is 1.25
|
|
||||||
when: docker_py_version is version('2.0.2', '>=') and docker_api_version is version('1.25', '>=')
|
when: docker_py_version is version('2.0.2', '>=') and docker_api_version is version('1.25', '>=')
|
||||||
|
|
||||||
- fail: msg="Too old docker / docker-py version to run docker_swarm_service_info tests!"
|
- fail: msg="Too old docker / docker-py version to run docker_swarm_service_info tests!"
|
||||||
|
|||||||
@ -24,7 +24,7 @@
|
|||||||
state: absent
|
state: absent
|
||||||
with_items: "{{ vnames }}"
|
with_items: "{{ vnames }}"
|
||||||
|
|
||||||
when: docker_py_version is version('1.10.0', '>=') and docker_api_version is version('1.20', '>=') # FIXME: find out API version!
|
when: docker_py_version is version('1.10.0', '>=') and docker_api_version is version('1.25', '>=') # FIXME: find out API version!
|
||||||
|
|
||||||
- fail: msg="Too old docker / docker-py version to run docker_volume tests!"
|
- fail: msg="Too old docker / docker-py version to run docker_volume tests!"
|
||||||
when: not(docker_py_version is version('1.10.0', '>=') and docker_api_version is version('1.20', '>=')) and (ansible_distribution != 'CentOS' or ansible_distribution_major_version|int > 6)
|
when: not(docker_py_version is version('1.10.0', '>=') and docker_api_version is version('1.25', '>=')) and (ansible_distribution != 'CentOS' or ansible_distribution_major_version|int > 6)
|
||||||
|
|||||||
@ -68,7 +68,7 @@
|
|||||||
when: docker_volume_inspect is failed
|
when: docker_volume_inspect is failed
|
||||||
|
|
||||||
# Requirements for docker_volume
|
# Requirements for docker_volume
|
||||||
when: docker_py_version is version('1.10.0', '>=') and docker_api_version is version('1.24', '>=')
|
when: docker_py_version is version('1.10.0', '>=') and docker_api_version is version('1.25', '>=')
|
||||||
|
|
||||||
- fail: msg="Too old docker / docker-py version to run docker_volume_info tests!"
|
- fail: msg="Too old docker / docker-py version to run docker_volume_info tests!"
|
||||||
when: not(docker_py_version is version('1.10.0', '>=') and docker_api_version is version('1.24', '>=')) and (ansible_distribution != 'CentOS' or ansible_distribution_major_version|int > 6)
|
when: not(docker_py_version is version('1.10.0', '>=') and docker_api_version is version('1.25', '>=')) and (ansible_distribution != 'CentOS' or ansible_distribution_major_version|int > 6)
|
||||||
|
|||||||
@ -33,9 +33,9 @@
|
|||||||
msg: Using test registry name {{ docker_registry_container_name_registry }} and nginx frontend names {{ docker_registry_container_name_nginx }} and {{ docker_registry_container_name_nginx2 }}
|
msg: Using test registry name {{ docker_registry_container_name_registry }} and nginx frontend names {{ docker_registry_container_name_nginx }} and {{ docker_registry_container_name_nginx2 }}
|
||||||
|
|
||||||
- fail: msg="Too old docker / docker-py version to set up docker registry!"
|
- fail: msg="Too old docker / docker-py version to set up docker registry!"
|
||||||
when: not(docker_py_version is version('1.8.0', '>=') and docker_api_version is version('1.20', '>=')) and (ansible_distribution != 'CentOS' or ansible_distribution_major_version|int > 6)
|
when: not(docker_py_version is version('1.8.0', '>=') and docker_api_version is version('1.25', '>=')) and (ansible_distribution != 'CentOS' or ansible_distribution_major_version|int > 6)
|
||||||
|
|
||||||
- when: docker_py_version is version('1.8.0', '>=') and docker_api_version is version('1.20', '>=')
|
- when: docker_py_version is version('1.8.0', '>=') and docker_api_version is version('1.25', '>=')
|
||||||
block:
|
block:
|
||||||
|
|
||||||
# Set up registry container
|
# Set up registry container
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user