|
|
|
@ -2154,12 +2154,10 @@ class ContainerManager(DockerBaseClass):
|
|
|
|
|
self.fail("Error disconnecting container from network %s - %s" % (diff['parameter']['name'],
|
|
|
|
|
str(exc)))
|
|
|
|
|
# connect to the network
|
|
|
|
|
params = dict(
|
|
|
|
|
ipv4_address=diff['parameter'].get('ipv4_address', None),
|
|
|
|
|
ipv6_address=diff['parameter'].get('ipv6_address', None),
|
|
|
|
|
links=diff['parameter'].get('links', None),
|
|
|
|
|
aliases=diff['parameter'].get('aliases', None)
|
|
|
|
|
)
|
|
|
|
|
params = dict()
|
|
|
|
|
for para in ('ipv4_address', 'ipv6_address', 'links', 'aliases'):
|
|
|
|
|
if diff['parameter'].get(para):
|
|
|
|
|
params[para] = diff['parameter'][para]
|
|
|
|
|
self.results['actions'].append(dict(added_to_network=diff['parameter']['name'], network_parameters=params))
|
|
|
|
|
if not self.check_mode:
|
|
|
|
|
try:
|
|
|
|
@ -2436,6 +2434,16 @@ class AnsibleDockerClientContainer(AnsibleDockerClient):
|
|
|
|
|
self.module.warn("docker API version is %s. Minimum version required is 1.25 to set or "
|
|
|
|
|
"update the container's stop_timeout configuration." % (docker_api_version,))
|
|
|
|
|
|
|
|
|
|
ipvX_address_supported = LooseVersion(docker_version) >= LooseVersion('1.9')
|
|
|
|
|
if not ipvX_address_supported:
|
|
|
|
|
ipvX_address_used = False
|
|
|
|
|
for network in self.module.params.get("networks", []):
|
|
|
|
|
if 'ipv4_address' in network or 'ipv6_address' in network:
|
|
|
|
|
ipvX_address_used = True
|
|
|
|
|
if ipvX_address_used:
|
|
|
|
|
self.fail("docker or docker-py version is %s. Minimum version required is 1.9 to use "
|
|
|
|
|
"ipv4_address or ipv6_address in networks." % (docker_version,))
|
|
|
|
|
|
|
|
|
|
runtime_supported = LooseVersion(docker_api_version) >= LooseVersion('1.12')
|
|
|
|
|
if self.module.params.get("runtime") and not runtime_supported:
|
|
|
|
|
self.fail('docker API version is %s. Minimum version required is 1.12 to set runtime option.' % (docker_api_version,))
|
|
|
|
|