mirror of
https://github.com/ansible-collections/community.docker.git
synced 2026-03-21 05:49:32 +00:00
Adjust deprecations (#1)
* First batch of c.g 2.0.0 deprecations. * Remove use_tls and force from docker_image. * More removals. * Change community.general 3.0.0 deprecations to community.docker 2.0.0. * Fix sanity. * Fixing some bugs. * Add PR URL to fragment. ci_complete ci_coverage * Improve docs, remove superfluous code.
This commit is contained in:
parent
400c484a54
commit
5dba331bc7
23
changelogs/fragments/c.g-2.0.0-deprecations.yml
Normal file
23
changelogs/fragments/c.g-2.0.0-deprecations.yml
Normal file
@ -0,0 +1,23 @@
|
||||
removed_features:
|
||||
- "docker_image_facts - this alias is on longer availabe, use ``docker_image_info`` instead (https://github.com/ansible-collections/community.docker/pull/1)."
|
||||
- "docker_image - the ``source`` option is now mandatory (https://github.com/ansible-collections/community.docker/pull/1)."
|
||||
- "docker_image - the default of the ``build.pull`` option changed to ``false`` (https://github.com/ansible-collections/community.docker/pull/1)."
|
||||
- "docker_image - the ``container_limits``, ``dockerfile``, ``http_timeout``, ``nocache``, ``rm``, ``path``, ``buildargs``, ``pull`` have been removed. Use the corresponding suboptions of ``build`` instead (https://github.com/ansible-collections/community.docker/pull/1)."
|
||||
- "docker_image - the ``force`` option has been removed. Use the more specific ``force_*`` options instead (https://github.com/ansible-collections/community.docker/pull/1)."
|
||||
- "docker_image - the ``use_tls`` option has been removed. Use ``tls`` and ``validate_certs`` instead (https://github.com/ansible-collections/community.docker/pull/1)."
|
||||
- "docker_image - ``state=build`` has been removed. Use ``present`` instead (https://github.com/ansible-collections/community.docker/pull/1)."
|
||||
- "docker_volume - the ``force`` option has been removed. Use ``recreate`` instead (https://github.com/ansible-collections/community.docker/pull/1)."
|
||||
- "docker_volume - no longer returns ``ansible_facts`` (https://github.com/ansible-collections/community.docker/pull/1)."
|
||||
- "docker_swarm - ``state=inspect`` has been removed. Use ``docker_swarm_info`` instead (https://github.com/ansible-collections/community.docker/pull/1)."
|
||||
- "docker_network - the ``ipam_options`` option has been removed. Use ``ipam_config`` instead (https://github.com/ansible-collections/community.docker/pull/1)."
|
||||
- "docker_network - no longer returns ``ansible_facts`` (https://github.com/ansible-collections/community.docker/pull/1)."
|
||||
- "docker_service - no longer returns ``ansible_facts`` (https://github.com/ansible-collections/community.docker/pull/1)."
|
||||
- "docker_swarm_service - the ``constraints`` option has been removed. Use ``placement.constraints`` instead (https://github.com/ansible-collections/community.docker/pull/1)."
|
||||
- "docker_swarm_service - the ``limit_cpu`` and ``limit_memory`` options has been removed. Use the corresponding suboptions in ``limits`` instead (https://github.com/ansible-collections/community.docker/pull/1)."
|
||||
- "docker_swarm_service - the ``log_driver`` and ``log_driver_options`` options has been removed. Use the corresponding suboptions in ``logging`` instead (https://github.com/ansible-collections/community.docker/pull/1)."
|
||||
- "docker_swarm_service - the ``reserve_cpu`` and ``reserve_memory`` options has been removed. Use the corresponding suboptions in ``reservations`` instead (https://github.com/ansible-collections/community.docker/pull/1)."
|
||||
- "docker_swarm_service - the ``restart_policy``, ``restart_policy_attempts``, ``restart_policy_delay`` and ``restart_policy_window`` options has been removed. Use the corresponding suboptions in ``restart_config`` instead (https://github.com/ansible-collections/community.docker/pull/1)."
|
||||
- "docker_swarm_service - the ``update_delay``, ``update_parallelism``, ``update_failure_action``, ``update_monitor``, ``update_max_failure_ratio`` and ``update_order`` options has been removed. Use the corresponding suboptions in ``update_config`` instead (https://github.com/ansible-collections/community.docker/pull/1)."
|
||||
- "docker_container - the default of ``networks_cli_compatible`` changed to ``true`` (https://github.com/ansible-collections/community.docker/pull/1)."
|
||||
- "docker_container - no longer returns ``ansible_facts`` (https://github.com/ansible-collections/community.docker/pull/1)."
|
||||
- "docker_container - the unused option ``trust_image_content`` has been removed (https://github.com/ansible-collections/community.docker/pull/1)."
|
||||
@ -427,14 +427,6 @@ class AnsibleDockerClient(Client):
|
||||
for key in DOCKER_COMMON_ARGS:
|
||||
params[key] = self.module.params.get(key)
|
||||
|
||||
if self.module.params.get('use_tls'):
|
||||
# support use_tls option in docker_image.py. This will be deprecated.
|
||||
use_tls = self.module.params.get('use_tls')
|
||||
if use_tls == 'encrypt':
|
||||
params['tls'] = True
|
||||
if use_tls == 'verify':
|
||||
params['validate_certs'] = True
|
||||
|
||||
result = dict(
|
||||
docker_host=self._get_value('docker_host', params['docker_host'], 'DOCKER_HOST',
|
||||
DEFAULT_DOCKER_HOST),
|
||||
|
||||
@ -306,9 +306,6 @@ RETURN = '''
|
||||
services:
|
||||
description:
|
||||
- A dictionary mapping the service's name to a dictionary of containers.
|
||||
- Note that facts are part of the registered vars since Ansible 2.8. For compatibility reasons, the facts
|
||||
are also accessible directly. The service's name is the variable with which the container dictionary
|
||||
can be accessed. Note that the returned facts will be removed in community.general 2.0.0.
|
||||
returned: success
|
||||
type: complex
|
||||
contains:
|
||||
@ -705,7 +702,7 @@ class ContainerManager(DockerBaseClass):
|
||||
start_deps = self.dependencies
|
||||
service_names = self.services
|
||||
detached = True
|
||||
result = dict(changed=False, actions=[], ansible_facts=dict(), services=dict())
|
||||
result = dict(changed=False, actions=[], services=dict())
|
||||
|
||||
up_options = {
|
||||
u'--no-recreate': False,
|
||||
@ -809,7 +806,6 @@ class ContainerManager(DockerBaseClass):
|
||||
|
||||
for service in self.project.services:
|
||||
service_facts = dict()
|
||||
result['ansible_facts'][service.name] = service_facts
|
||||
result['services'][service.name] = service_facts
|
||||
for container in service.containers(stopped=True):
|
||||
inspection = container.inspect()
|
||||
@ -1138,9 +1134,6 @@ def main():
|
||||
supports_check_mode=True,
|
||||
min_docker_api_version='1.20',
|
||||
)
|
||||
if client.module._name in ('docker_service', 'community.docker.docker_service'):
|
||||
client.module.deprecate("The 'docker_service' module has been renamed to 'docker_compose'.",
|
||||
version='2.0.0', collection_name='community.general') # was Ansible 2.12
|
||||
|
||||
try:
|
||||
result = ContainerManager(client).exec_module()
|
||||
|
||||
@ -29,7 +29,7 @@ notes:
|
||||
these options, it will be recreated instead. The options with default values which can cause this are I(auto_remove),
|
||||
I(detach), I(init), I(interactive), I(memory), I(paused), I(privileged), I(read_only) and I(tty). This behavior
|
||||
can be changed by setting I(container_default_behavior) to C(no_defaults), which will be the default value from
|
||||
community.general 3.0.0 on.
|
||||
community.docker 2.0.0 on.
|
||||
|
||||
options:
|
||||
auto_remove:
|
||||
@ -89,7 +89,7 @@ options:
|
||||
containers which use different values for these options.
|
||||
- The default value is C(compatibility), which will ensure that the default values
|
||||
are used when the values are not explicitly specified by the user.
|
||||
- From community.general 3.0.0 on, the default value will switch to C(no_defaults). To avoid
|
||||
- From community.docker 2.0.0 on, the default value will switch to C(no_defaults). To avoid
|
||||
deprecation warnings, please set I(container_default_behavior) to an explicit
|
||||
value.
|
||||
- This affects the I(auto_remove), I(detach), I(init), I(interactive), I(memory),
|
||||
@ -540,7 +540,7 @@ options:
|
||||
network_mode:
|
||||
description:
|
||||
- Connect the container to a network. Choices are C(bridge), C(host), C(none), C(container:<name|id>), C(<network_name>) or C(default).
|
||||
- "*Note* that from community.general 3.0.0 on, if I(networks_cli_compatible) is C(true) and I(networks) contains at least one network,
|
||||
- "*Note* that from community.docker 2.0.0 on, if I(networks_cli_compatible) is C(true) and I(networks) contains at least one network,
|
||||
the default value for I(network_mode) will be the name of the first network in the I(networks) list. You can prevent this
|
||||
by explicitly specifying a value for I(network_mode), like the default value C(default) which will be used by Docker if
|
||||
I(network_mode) is not specified."
|
||||
@ -554,10 +554,9 @@ options:
|
||||
- List of networks the container belongs to.
|
||||
- For examples of the data structure and usage see EXAMPLES below.
|
||||
- To remove a container from one or more networks, use the I(purge_networks) option.
|
||||
- Note that as opposed to C(docker run ...), M(community.docker.docker_container) does not remove the default
|
||||
network if I(networks) is specified. You need to explicitly use I(purge_networks) to enforce
|
||||
the removal of the default network (and all other networks not explicitly mentioned in I(networks)).
|
||||
Alternatively, use the I(networks_cli_compatible) option, which will be enabled by default from community.general 2.0.0 on.
|
||||
- If I(networks_cli_compatible) is set to C(false), this will not remove the default network if I(networks) is specified.
|
||||
This is different from the behavior of C(docker run ...). You need to explicitly use I(purge_networks) to enforce
|
||||
the removal of the default network (and all other networks not explicitly mentioned in I(networks)) in that case.
|
||||
type: list
|
||||
elements: dict
|
||||
suboptions:
|
||||
@ -587,24 +586,24 @@ options:
|
||||
elements: str
|
||||
networks_cli_compatible:
|
||||
description:
|
||||
- "When networks are provided to the module via the I(networks) option, the module
|
||||
behaves differently than C(docker run --network): C(docker run --network other)
|
||||
will create a container with network C(other) attached, but the default network
|
||||
not attached. This module with I(networks: {name: other}) will create a container
|
||||
with both C(default) and C(other) attached. If I(purge_networks) is set to C(yes),
|
||||
the C(default) network will be removed afterwards."
|
||||
- "If I(networks_cli_compatible) is set to C(yes), this module will behave as
|
||||
- "If I(networks_cli_compatible) is set to C(yes) (default), this module will behave as
|
||||
C(docker run --network) and will *not* add the default network if I(networks) is
|
||||
specified. If I(networks) is not specified, the default network will be attached."
|
||||
- "When I(networks_cli_compatible) is set to C(no) and networks are provided to the module
|
||||
via the I(networks) option, the module behaves differently than C(docker run --network):
|
||||
C(docker run --network other) will create a container with network C(other) attached,
|
||||
but the default network not attached. This module with I(networks: {name: other}) will
|
||||
create a container with both C(default) and C(other) attached. If I(purge_networks) is
|
||||
set to C(yes), the C(default) network will be removed afterwards."
|
||||
- "*Note* that docker CLI also sets I(network_mode) to the name of the first network
|
||||
added if C(--network) is specified. For more compatibility with docker CLI, you
|
||||
explicitly have to set I(network_mode) to the name of the first network you're
|
||||
adding. This behavior will change for community.general 3.0.0: then I(network_mode) will
|
||||
adding. This behavior will change for community.docker 2.0.0: then I(network_mode) will
|
||||
automatically be set to the first network name in I(networks) if I(network_mode)
|
||||
is not specified, I(networks) has at least one entry and I(networks_cli_compatible)
|
||||
is C(true)."
|
||||
- Current value is C(no). A new default of C(yes) will be set in community.general 2.0.0.
|
||||
type: bool
|
||||
default: true
|
||||
oom_killer:
|
||||
description:
|
||||
- Whether or not to disable OOM Killer for the container.
|
||||
@ -778,12 +777,6 @@ options:
|
||||
the docker daemon will always use the container's configured C(StopTimeout)
|
||||
value if it has been configured.
|
||||
type: int
|
||||
trust_image_content:
|
||||
description:
|
||||
- If C(yes), skip image verification.
|
||||
- The option has never been used by the module. It will be removed in community.general 3.0.0.
|
||||
type: bool
|
||||
default: no
|
||||
tmpfs:
|
||||
description:
|
||||
- Mount a tmpfs directory.
|
||||
@ -1104,9 +1097,6 @@ RETURN = '''
|
||||
container:
|
||||
description:
|
||||
- Facts representing the current state of the container. Matches the docker inspection output.
|
||||
- Note that facts are part of the registered vars since Ansible 2.8. For compatibility reasons, the facts
|
||||
are also accessible directly as C(docker_container). Note that the returned fact will be removed in
|
||||
community.general 2.0.0.
|
||||
- Before 2.3 this was C(ansible_docker_container) but was renamed in 2.3 to C(docker_container) due to
|
||||
conflicts with the connection plugin.
|
||||
- Empty if I(state) is C(absent)
|
||||
@ -1340,7 +1330,6 @@ class TaskParameters(DockerBaseClass):
|
||||
self.stop_signal = None
|
||||
self.stop_timeout = None
|
||||
self.tmpfs = None
|
||||
self.trust_image_content = None
|
||||
self.tty = None
|
||||
self.user = None
|
||||
self.uts = None
|
||||
@ -2710,7 +2699,6 @@ class ContainerManager(DockerBaseClass):
|
||||
self.results['diff'] = self.diff
|
||||
|
||||
if self.facts:
|
||||
self.results['ansible_facts'] = {'docker_container': self.facts}
|
||||
self.results['container'] = self.facts
|
||||
|
||||
def wait_for_state(self, container_id, complete_states=None, wait_states=None, accept_removal=False, max_wait=None):
|
||||
@ -3167,7 +3155,7 @@ class AnsibleDockerClientContainer(AnsibleDockerClient):
|
||||
# A list of module options which are not docker container properties
|
||||
__NON_CONTAINER_PROPERTY_OPTIONS = tuple([
|
||||
'env_file', 'force_kill', 'keep_volumes', 'ignore_image', 'name', 'pull', 'purge_networks',
|
||||
'recreate', 'restart', 'state', 'trust_image_content', 'networks', 'cleanup', 'kill_signal',
|
||||
'recreate', 'restart', 'state', 'networks', 'cleanup', 'kill_signal',
|
||||
'output_logs', 'paused', 'removal_wait_timeout'
|
||||
] + list(DOCKER_COMMON_ARGS.keys()))
|
||||
|
||||
@ -3357,8 +3345,8 @@ class AnsibleDockerClientContainer(AnsibleDockerClient):
|
||||
self.module.params['container_default_behavior'] = 'compatibility'
|
||||
self.module.deprecate(
|
||||
'The container_default_behavior option will change its default value from "compatibility" to '
|
||||
'"no_defaults" in community.general 3.0.0. To remove this warning, please specify an explicit value for it now',
|
||||
version='3.0.0', collection_name='community.general' # was Ansible 2.14
|
||||
'"no_defaults" in community.docker 2.0.0. To remove this warning, please specify an explicit value for it now',
|
||||
version='2.0.0', collection_name='community.docker' # was Ansible 2.14 / community.general 3.0.0
|
||||
)
|
||||
if self.module.params['container_default_behavior'] == 'compatibility':
|
||||
old_default_values = dict(
|
||||
@ -3477,7 +3465,7 @@ def main():
|
||||
aliases=dict(type='list', elements='str'),
|
||||
links=dict(type='list', elements='str'),
|
||||
)),
|
||||
networks_cli_compatible=dict(type='bool'),
|
||||
networks_cli_compatible=dict(type='bool', default=True),
|
||||
oom_killer=dict(type='bool'),
|
||||
oom_score_adj=dict(type='int'),
|
||||
output_logs=dict(type='bool', default=False),
|
||||
@ -3502,8 +3490,6 @@ def main():
|
||||
stop_timeout=dict(type='int'),
|
||||
sysctls=dict(type='dict'),
|
||||
tmpfs=dict(type='list', elements='str'),
|
||||
trust_image_content=dict(type='bool', default=False, removed_in_version='2.0.0',
|
||||
removed_from_collection='community.general'), # was Ansible 2.12
|
||||
tty=dict(type='bool'),
|
||||
ulimits=dict(type='list', elements='str'),
|
||||
user=dict(type='str'),
|
||||
@ -3525,16 +3511,6 @@ def main():
|
||||
supports_check_mode=True,
|
||||
min_docker_api_version='1.20',
|
||||
)
|
||||
if client.module.params['networks_cli_compatible'] is None and client.module.params['networks']:
|
||||
client.module.deprecate(
|
||||
'Please note that docker_container handles networks slightly different than docker CLI. '
|
||||
'If you specify networks, the default network will still be attached as the first network. '
|
||||
'(You can specify purge_networks to remove all networks not explicitly listed.) '
|
||||
'This behavior will change in community.general 2.0.0. You can change the behavior now by setting '
|
||||
'the new `networks_cli_compatible` option to `yes`, and remove this warning by setting '
|
||||
'it to `no`',
|
||||
version='2.0.0', collection_name='community.general', # was Ansible 2.12
|
||||
)
|
||||
if client.module.params['networks_cli_compatible'] is True and client.module.params['networks'] and client.module.params['network_mode'] is None:
|
||||
client.module.deprecate(
|
||||
'Please note that the default value for `network_mode` will change from not specified '
|
||||
@ -3545,7 +3521,7 @@ def main():
|
||||
'Please make sure that the value you set to `network_mode` equals the inspection result '
|
||||
'for existing containers, otherwise the module will recreate them. You can find out the '
|
||||
'correct value by running "docker inspect --format \'{{.HostConfig.NetworkMode}}\' <container_name>"',
|
||||
version='3.0.0', collection_name='community.general', # was Ansible 2.14
|
||||
version='2.0.0', collection_name='community.docker', # was Ansible 2.14 / community.general 3.0.0
|
||||
)
|
||||
|
||||
try:
|
||||
|
||||
@ -16,9 +16,7 @@ short_description: Manage docker images.
|
||||
|
||||
description:
|
||||
- Build, load or pull an image, making the image available for creating containers. Also supports tagging an
|
||||
image into a repository and archiving an image to a .tar file.
|
||||
- Since Ansible 2.8, it is recommended to explicitly specify the image's source (I(source) can be C(build),
|
||||
C(load), C(pull) or C(local)). This will be required from community.general 2.0.0 on.
|
||||
image into a repository and archiving an image to a C(.tar) file.
|
||||
|
||||
options:
|
||||
source:
|
||||
@ -31,10 +29,6 @@ options:
|
||||
- "Use C(pull) to pull the image from a registry."
|
||||
- "Use C(local) to make sure that the image is already available on the local
|
||||
docker daemon, i.e. do not try to build, pull or load the image."
|
||||
- "Before community.general 2.0.0, the value of this option will be auto-detected
|
||||
to be backwards compatible, but a warning will be issued if it is not
|
||||
explicitly specified. From community.general 2.0.0 on, auto-detection will be disabled
|
||||
and this option will be made mandatory."
|
||||
type: str
|
||||
choices:
|
||||
- build
|
||||
@ -70,8 +64,8 @@ options:
|
||||
pull:
|
||||
description:
|
||||
- When building an image downloads any updates to the FROM image in Dockerfile.
|
||||
- The default is currently C(yes). This will change to C(no) in community.general 2.0.0.
|
||||
type: bool
|
||||
default: no
|
||||
rm:
|
||||
description:
|
||||
- Remove intermediate containers after build.
|
||||
@ -136,26 +130,8 @@ options:
|
||||
load_path:
|
||||
description:
|
||||
- Use with state C(present) to load an image from a .tar file.
|
||||
- Set I(source) to C(load) if you want to load the image. The option will
|
||||
be set automatically before community.general 2.0.0 if this option is used (except
|
||||
if I(path) is specified as well, in which case building will take precedence).
|
||||
From community.general 2.0.0 on, you have to set I(source) to C(load).
|
||||
- Set I(source) to C(load) if you want to load the image.
|
||||
type: path
|
||||
dockerfile:
|
||||
description:
|
||||
- Use with state C(present) and source C(build) to provide an alternate name for the Dockerfile to use when building an image.
|
||||
- This can also include a relative path (relative to I(path)).
|
||||
- Please use I(build.dockerfile) instead. This option will be removed in community.general 2.0.0.
|
||||
type: str
|
||||
force:
|
||||
description:
|
||||
- Use with state I(absent) to un-tag and remove all images matching the specified name. Use with state
|
||||
C(present) to build, load or pull an image when the image already exists. Also use with state C(present)
|
||||
to force tagging an image.
|
||||
- Please stop using this option, and use the more specialized force options
|
||||
I(force_source), I(force_absent) and I(force_tag) instead.
|
||||
- This option will be removed in community.general 2.0.0.
|
||||
type: bool
|
||||
force_source:
|
||||
description:
|
||||
- Use with state C(present) to build, load or pull an image (depending on the
|
||||
@ -172,12 +148,6 @@ options:
|
||||
- Use with state C(present) to force tagging an image.
|
||||
type: bool
|
||||
default: false
|
||||
http_timeout:
|
||||
description:
|
||||
- Timeout for HTTP requests during the image build operation. Provide a positive integer value for the number of
|
||||
seconds.
|
||||
- Please use I(build.http_timeout) instead. This option will be removed in community.general 2.0.0.
|
||||
type: int
|
||||
name:
|
||||
description:
|
||||
- "Image name. Name format will be one of: name, repository/name, registry_server:port/name.
|
||||
@ -185,40 +155,11 @@ options:
|
||||
- Note that image IDs (hashes) are not supported.
|
||||
type: str
|
||||
required: yes
|
||||
path:
|
||||
description:
|
||||
- Use with state 'present' to build an image. Will be the path to a directory containing the context and
|
||||
Dockerfile for building an image.
|
||||
- Set I(source) to C(build) if you want to build the image. The option will
|
||||
be set automatically before community.general 2.0.0 if this option is used. From community.general 2.0.0
|
||||
on, you have to set I(source) to C(build).
|
||||
- Please use I(build.path) instead. This option will be removed in community.general 2.0.0.
|
||||
type: path
|
||||
aliases:
|
||||
- build_path
|
||||
pull:
|
||||
description:
|
||||
- When building an image downloads any updates to the FROM image in Dockerfile.
|
||||
- Please use I(build.pull) instead. This option will be removed in community.general 2.0.0.
|
||||
- The default is currently C(yes). This will change to C(no) in community.general 2.0.0.
|
||||
type: bool
|
||||
push:
|
||||
description:
|
||||
- Push the image to the registry. Specify the registry as part of the I(name) or I(repository) parameter.
|
||||
type: bool
|
||||
default: no
|
||||
rm:
|
||||
description:
|
||||
- Remove intermediate containers after build.
|
||||
- Please use I(build.rm) instead. This option will be removed in community.general 2.0.0.
|
||||
type: bool
|
||||
default: yes
|
||||
nocache:
|
||||
description:
|
||||
- Do not use cache when building an image.
|
||||
- Please use I(build.nocache) instead. This option will be removed in community.general 2.0.0.
|
||||
type: bool
|
||||
default: no
|
||||
repository:
|
||||
description:
|
||||
- Full path to a repository. Use with state C(present) to tag the image into the repository. Expects
|
||||
@ -231,19 +172,11 @@ options:
|
||||
matching the provided name.
|
||||
- When C(present) check if an image exists using the provided name and tag. If the image is not found or the
|
||||
force option is used, the image will either be pulled, built or loaded, depending on the I(source) option.
|
||||
- By default the image will be pulled from Docker Hub, or the registry specified in the image's name. Note that
|
||||
this will change in community.general 2.0.0, so to make sure that you are pulling, set I(source) to C(pull). To build
|
||||
the image, provide a I(path) value set to a directory containing a context and Dockerfile, and set I(source)
|
||||
to C(build). To load an image, specify I(load_path) to provide a path to an archive file. To tag an image to
|
||||
a repository, provide a I(repository) path. If the name contains a repository path, it will be pushed.
|
||||
- "*Note:* C(state=build) is DEPRECATED and will be removed in community.general 2.0.0. Specifying C(build) will behave the
|
||||
same as C(present)."
|
||||
type: str
|
||||
default: present
|
||||
choices:
|
||||
- absent
|
||||
- present
|
||||
- build
|
||||
tag:
|
||||
description:
|
||||
- Used to select an image when pulling. Will be added to the image when pushing, tagging or building. Defaults to
|
||||
@ -251,48 +184,6 @@ options:
|
||||
- If I(name) parameter format is I(name:tag), then tag value from I(name) will take precedence.
|
||||
type: str
|
||||
default: latest
|
||||
buildargs:
|
||||
description:
|
||||
- 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.
|
||||
- Requires Docker API >= 1.21.
|
||||
- Please use I(build.args) instead. This option will be removed in community.general 2.0.0.
|
||||
type: dict
|
||||
container_limits:
|
||||
description:
|
||||
- A dictionary of limits applied to each container created by the build process.
|
||||
- Please use I(build.container_limits) instead. This option will be removed in community.general 2.0.0.
|
||||
type: dict
|
||||
suboptions:
|
||||
memory:
|
||||
description:
|
||||
- Set memory limit for build.
|
||||
type: int
|
||||
memswap:
|
||||
description:
|
||||
- Total memory (memory + swap), -1 to disable swap.
|
||||
type: int
|
||||
cpushares:
|
||||
description:
|
||||
- CPU shares (relative weight).
|
||||
type: int
|
||||
cpusetcpus:
|
||||
description:
|
||||
- CPUs in which to allow execution, e.g., "0-3", "0,1".
|
||||
type: str
|
||||
use_tls:
|
||||
description:
|
||||
- "DEPRECATED. Whether to use tls to connect to the docker daemon. Set to
|
||||
C(encrypt) to use TLS. And set to C(verify) to use TLS and verify that
|
||||
the server's certificate is valid for the server."
|
||||
- "*Note:* If you specify this option, it will set the value of the I(tls) or
|
||||
I(validate_certs) parameters if not set to C(no)."
|
||||
- Will be removed in community.general 2.0.0.
|
||||
type: str
|
||||
choices:
|
||||
- 'no'
|
||||
- 'encrypt'
|
||||
- 'verify'
|
||||
|
||||
extends_documentation_fragment:
|
||||
- community.docker.docker
|
||||
@ -793,7 +684,7 @@ def main():
|
||||
network=dict(type='str'),
|
||||
nocache=dict(type='bool', default=False),
|
||||
path=dict(type='path', required=True),
|
||||
pull=dict(type='bool'),
|
||||
pull=dict(type='bool', default=False),
|
||||
rm=dict(type='bool', default=True),
|
||||
args=dict(type='dict'),
|
||||
use_config_proxy=dict(type='bool'),
|
||||
@ -801,36 +692,20 @@ def main():
|
||||
etc_hosts=dict(type='dict'),
|
||||
)),
|
||||
archive_path=dict(type='path'),
|
||||
container_limits=dict(type='dict', options=dict(
|
||||
memory=dict(type='int'),
|
||||
memswap=dict(type='int'),
|
||||
cpushares=dict(type='int'),
|
||||
cpusetcpus=dict(type='str'),
|
||||
), removed_in_version='2.0.0', removed_from_collection='community.general'), # was Ansible 2.12
|
||||
dockerfile=dict(type='str', removed_in_version='2.0.0', removed_from_collection='community.general'), # was Ansible 2.12
|
||||
force=dict(type='bool', removed_in_version='2.0.0', removed_from_collection='community.general'), # was Ansible 2.12
|
||||
force_source=dict(type='bool', default=False),
|
||||
force_absent=dict(type='bool', default=False),
|
||||
force_tag=dict(type='bool', default=False),
|
||||
http_timeout=dict(type='int', removed_in_version='2.0.0', removed_from_collection='community.general'), # was Ansible 2.12
|
||||
load_path=dict(type='path'),
|
||||
name=dict(type='str', required=True),
|
||||
nocache=dict(type='bool', default=False, removed_in_version='2.0.0', removed_from_collection='community.general'), # was Ansible 2.12
|
||||
path=dict(type='path', aliases=['build_path'], removed_in_version='2.0.0', removed_from_collection='community.general'), # was Ansible 2.12
|
||||
pull=dict(type='bool', removed_in_version='2.0.0', removed_from_collection='community.general'), # was Ansible 2.12
|
||||
push=dict(type='bool', default=False),
|
||||
repository=dict(type='str'),
|
||||
rm=dict(type='bool', default=True, removed_in_version='2.0.0', removed_from_collection='community.general'), # was Ansible 2.12
|
||||
state=dict(type='str', default='present', choices=['absent', 'present', 'build']),
|
||||
state=dict(type='str', default='present', choices=['absent', 'present']),
|
||||
tag=dict(type='str', default='latest'),
|
||||
use_tls=dict(type='str', choices=['no', 'encrypt', 'verify'], removed_in_version='2.0.0',
|
||||
removed_from_collection='community.general'), # was Ansible 2.12
|
||||
buildargs=dict(type='dict', removed_in_version='2.0.0', removed_from_collection='community.general'), # was Ansible 2.12
|
||||
)
|
||||
|
||||
required_if = [
|
||||
# ('state', 'present', ['source']), -- enable in community.general 2.0.0
|
||||
# ('source', 'build', ['build']), -- enable in community.general 2.0.0
|
||||
('state', 'present', ['source']),
|
||||
('source', 'build', ['build']),
|
||||
('source', 'load', ['load_path']),
|
||||
]
|
||||
|
||||
@ -865,74 +740,12 @@ def main():
|
||||
option_minimal_versions=option_minimal_versions,
|
||||
)
|
||||
|
||||
if client.module.params['state'] == 'build':
|
||||
client.module.deprecate('The "build" state has been deprecated for a long time. '
|
||||
'Please use "present", which has the same meaning as "build".',
|
||||
version='2.0.0', collection_name='community.general') # was Ansible 2.11
|
||||
client.module.params['state'] = 'present'
|
||||
if client.module.params['use_tls']:
|
||||
client.module.deprecate('The "use_tls" option has been deprecated for a long time. '
|
||||
'Please use the "tls" and "validate_certs" options instead.',
|
||||
version='2.0.0', collection_name='community.general') # was Ansible 2.11
|
||||
|
||||
if not is_valid_tag(client.module.params['tag'], allow_empty=True):
|
||||
client.fail('"{0}" is not a valid docker tag!'.format(client.module.params['tag']))
|
||||
|
||||
build_options = dict(
|
||||
container_limits='container_limits',
|
||||
dockerfile='dockerfile',
|
||||
http_timeout='http_timeout',
|
||||
nocache='nocache',
|
||||
path='path',
|
||||
pull='pull',
|
||||
rm='rm',
|
||||
buildargs='args',
|
||||
)
|
||||
for option, build_option in build_options.items():
|
||||
default_value = None
|
||||
if option in ('rm', ):
|
||||
default_value = True
|
||||
elif option in ('nocache', ):
|
||||
default_value = False
|
||||
if client.module.params[option] != default_value:
|
||||
if client.module.params['build'] is None:
|
||||
client.module.params['build'] = dict()
|
||||
if client.module.params['build'].get(build_option, default_value) != default_value:
|
||||
client.fail('Cannot specify both %s and build.%s!' % (option, build_option))
|
||||
client.module.params['build'][build_option] = client.module.params[option]
|
||||
client.module.deprecate('Please specify build.%s instead of %s. The %s option '
|
||||
'has been renamed' % (build_option, option, option),
|
||||
version='2.0.0', collection_name='community.general') # was Ansible 2.12
|
||||
if client.module.params['source'] == 'build':
|
||||
if (not client.module.params['build'] or not client.module.params['build'].get('path')):
|
||||
if not client.module.params['build'] or not client.module.params['build'].get('path'):
|
||||
client.fail('If "source" is set to "build", the "build.path" option must be specified.')
|
||||
if client.module.params['build'].get('pull') is None:
|
||||
client.module.deprecate("The default for build.pull is currently 'yes', but will be changed to "
|
||||
"'no' in community.general 2.0.0. Please set build.pull explicitly to the value you need",
|
||||
version='2.0.0', collection_name='community.general') # was Ansible 2.12
|
||||
client.module.params['build']['pull'] = True # TODO: change to False in community.general 2.0.0
|
||||
|
||||
if client.module.params['state'] == 'present' and client.module.params['source'] is None:
|
||||
# Autodetection. To be removed in community.general 2.0.0.
|
||||
if (client.module.params['build'] or dict()).get('path'):
|
||||
client.module.params['source'] = 'build'
|
||||
elif client.module.params['load_path']:
|
||||
client.module.params['source'] = 'load'
|
||||
else:
|
||||
client.module.params['source'] = 'pull'
|
||||
client.module.deprecate('The value of the "source" option was determined to be "%s". '
|
||||
'Please set the "source" option explicitly. Autodetection will '
|
||||
'be removed in community.general 2.0.0.' % client.module.params['source'],
|
||||
version='2.0.0', collection_name='community.general') # was Ansible 2.12
|
||||
|
||||
if client.module.params['force']:
|
||||
client.module.params['force_source'] = True
|
||||
client.module.params['force_absent'] = True
|
||||
client.module.params['force_tag'] = True
|
||||
client.module.deprecate('The "force" option will be removed in community.general 2.0.0. Please '
|
||||
'use the "force_source", "force_absent" or "force_tag" option '
|
||||
'instead, depending on what you want to force.',
|
||||
version='2.0.0', collection_name='community.general') # was Ansible 2.12
|
||||
|
||||
try:
|
||||
results = dict(
|
||||
|
||||
@ -248,9 +248,6 @@ def main():
|
||||
supports_check_mode=True,
|
||||
min_docker_api_version='1.20',
|
||||
)
|
||||
if client.module._name in ('docker_image_facts', 'community.docker.docker_image_facts'):
|
||||
client.module.deprecate("The 'docker_image_facts' module has been renamed to 'docker_image_info'",
|
||||
version='2.0.0', collection_name='community.general') # was Ansible 2.12
|
||||
|
||||
try:
|
||||
results = dict(
|
||||
|
||||
@ -43,7 +43,7 @@ options:
|
||||
email:
|
||||
description:
|
||||
- Does nothing, do not use.
|
||||
- Will be removed in community.general 3.0.0.
|
||||
- Will be removed in community.docker 2.0.0.
|
||||
type: str
|
||||
reauthorize:
|
||||
description:
|
||||
@ -445,7 +445,8 @@ def main():
|
||||
registry_url=dict(type='str', default=DEFAULT_DOCKER_REGISTRY, aliases=['registry', 'url']),
|
||||
username=dict(type='str'),
|
||||
password=dict(type='str', no_log=True),
|
||||
email=dict(type='str', removed_in_version='3.0.0', removed_from_collection='community.general'), # was Ansible 2.14
|
||||
# Was Ansible 2.14 / community.general 3.0.0:
|
||||
email=dict(type='str', removed_in_version='2.0.0', removed_from_collection='community.docker'),
|
||||
reauthorize=dict(type='bool', default=False, aliases=['reauth']),
|
||||
state=dict(type='str', default='present', choices=['present', 'absent']),
|
||||
config_path=dict(type='path', default='~/.docker/config.json', aliases=['dockercfg_path']),
|
||||
|
||||
@ -79,32 +79,6 @@ options:
|
||||
- Dictionary of IPAM driver options.
|
||||
type: dict
|
||||
|
||||
ipam_options:
|
||||
description:
|
||||
- Dictionary of IPAM options.
|
||||
- Deprecated in 2.8, will be removed in community.general 2.0.0. Use parameter I(ipam_config) instead. In Docker 1.10.0, IPAM
|
||||
options were introduced (see L(here,https://github.com/moby/moby/pull/17316)). This module parameter addresses
|
||||
the IPAM config not the newly introduced IPAM options. For the IPAM options, see the I(ipam_driver_options)
|
||||
parameter.
|
||||
type: dict
|
||||
suboptions:
|
||||
subnet:
|
||||
description:
|
||||
- IP subset in CIDR notation.
|
||||
type: str
|
||||
iprange:
|
||||
description:
|
||||
- IP address range in CIDR notation.
|
||||
type: str
|
||||
gateway:
|
||||
description:
|
||||
- IP gateway address.
|
||||
type: str
|
||||
aux_addresses:
|
||||
description:
|
||||
- Auxiliary IP addresses used by Network driver, as a mapping from hostname to IP.
|
||||
type: dict
|
||||
|
||||
ipam_config:
|
||||
description:
|
||||
- List of IPAM config blocks. Consult
|
||||
@ -270,8 +244,6 @@ RETURN = '''
|
||||
network:
|
||||
description:
|
||||
- Network inspection results for the affected network.
|
||||
- Note that facts are part of the registered vars since Ansible 2.8. For compatibility reasons, the facts
|
||||
are also accessible directly as C(docker_network). Note that the returned fact will be removed in community.general 2.0.0.
|
||||
returned: success
|
||||
type: dict
|
||||
sample: {}
|
||||
@ -312,7 +284,6 @@ class TaskParameters(DockerBaseClass):
|
||||
self.driver_options = None
|
||||
self.ipam_driver = None
|
||||
self.ipam_driver_options = None
|
||||
self.ipam_options = None
|
||||
self.ipam_config = None
|
||||
self.appends = None
|
||||
self.force = None
|
||||
@ -394,10 +365,6 @@ class DockerNetworkManager(object):
|
||||
if not self.parameters.connected and self.existing_network:
|
||||
self.parameters.connected = container_names_in_network(self.existing_network)
|
||||
|
||||
if (self.parameters.ipam_options['subnet'] or self.parameters.ipam_options['iprange'] or
|
||||
self.parameters.ipam_options['gateway'] or self.parameters.ipam_options['aux_addresses']):
|
||||
self.parameters.ipam_config = [self.parameters.ipam_options]
|
||||
|
||||
if self.parameters.ipam_config:
|
||||
try:
|
||||
for ipam_config in self.parameters.ipam_config:
|
||||
@ -644,7 +611,6 @@ class DockerNetworkManager(object):
|
||||
self.results.pop('actions')
|
||||
|
||||
network_facts = self.get_existing_network()
|
||||
self.results['ansible_facts'] = {u'docker_network': network_facts}
|
||||
self.results['network'] = network_facts
|
||||
|
||||
def absent(self):
|
||||
@ -663,12 +629,6 @@ def main():
|
||||
appends=dict(type='bool', default=False, aliases=['incremental']),
|
||||
ipam_driver=dict(type='str'),
|
||||
ipam_driver_options=dict(type='dict'),
|
||||
ipam_options=dict(type='dict', default={}, options=dict(
|
||||
subnet=dict(type='str'),
|
||||
iprange=dict(type='str'),
|
||||
gateway=dict(type='str'),
|
||||
aux_addresses=dict(type='dict'),
|
||||
), removed_in_version='2.0.0', removed_from_collection='community.general'), # was Ansible 2.12
|
||||
ipam_config=dict(type='list', elements='dict', options=dict(
|
||||
subnet=dict(type='str'),
|
||||
iprange=dict(type='str'),
|
||||
@ -683,10 +643,6 @@ def main():
|
||||
attachable=dict(type='bool'),
|
||||
)
|
||||
|
||||
mutually_exclusive = [
|
||||
('ipam_config', 'ipam_options')
|
||||
]
|
||||
|
||||
option_minimal_versions = dict(
|
||||
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'),
|
||||
@ -696,7 +652,6 @@ def main():
|
||||
|
||||
client = AnsibleDockerClient(
|
||||
argument_spec=argument_spec,
|
||||
mutually_exclusive=mutually_exclusive,
|
||||
supports_check_mode=True,
|
||||
min_docker_version='1.10.0',
|
||||
min_docker_api_version='1.22',
|
||||
|
||||
@ -78,7 +78,7 @@ requirements:
|
||||
- pyyaml
|
||||
|
||||
notes:
|
||||
- Return values I(out) and I(err) have been deprecated and will be removed in community.general 3.0.0. Use I(stdout) and I(stderr) instead.
|
||||
- Return values I(out) and I(err) have been deprecated and will be removed in community.docker 2.0.0. Use I(stdout) and I(stderr) instead.
|
||||
'''
|
||||
|
||||
RETURN = '''
|
||||
|
||||
@ -67,7 +67,6 @@ options:
|
||||
- Set to C(absent), to leave an existing cluster.
|
||||
- Set to C(remove), to remove an absent node from the cluster.
|
||||
Note that removing requires Docker SDK for Python >= 2.4.0.
|
||||
- Set to C(inspect) to display swarm informations.
|
||||
type: str
|
||||
default: present
|
||||
choices:
|
||||
@ -75,7 +74,6 @@ options:
|
||||
- join
|
||||
- absent
|
||||
- remove
|
||||
- inspect
|
||||
node_id:
|
||||
description:
|
||||
- Swarm id of the node to remove.
|
||||
@ -218,11 +216,6 @@ EXAMPLES = '''
|
||||
community.docker.docker_swarm:
|
||||
state: remove
|
||||
node_id: mynode
|
||||
|
||||
- name: Inspect swarm
|
||||
community.docker.docker_swarm:
|
||||
state: inspect
|
||||
register: swarm_info
|
||||
'''
|
||||
|
||||
RETURN = '''
|
||||
@ -438,14 +431,8 @@ class SwarmManager(DockerBaseClass):
|
||||
"join": self.join,
|
||||
"absent": self.leave,
|
||||
"remove": self.remove,
|
||||
"inspect": self.inspect_swarm
|
||||
}
|
||||
|
||||
if self.state == 'inspect':
|
||||
self.client.module.deprecate(
|
||||
"The 'inspect' state is deprecated, please use 'docker_swarm_info' to inspect swarm cluster",
|
||||
version='2.0.0', collection_name='community.general') # was Ansible 2.12
|
||||
|
||||
choice_map.get(self.state)()
|
||||
|
||||
if self.client.module._diff or self.parameters.debug:
|
||||
@ -600,7 +587,7 @@ def _detect_remove_operation(client):
|
||||
def main():
|
||||
argument_spec = dict(
|
||||
advertise_addr=dict(type='str'),
|
||||
state=dict(type='str', default='present', choices=['present', 'join', 'absent', 'remove', 'inspect']),
|
||||
state=dict(type='str', default='present', choices=['present', 'join', 'absent', 'remove']),
|
||||
force=dict(type='bool', default=False),
|
||||
listen_addr=dict(type='str', default='0.0.0.0:2377'),
|
||||
remote_addrs=dict(type='list', elements='str'),
|
||||
|
||||
@ -62,13 +62,6 @@ options:
|
||||
description:
|
||||
- File access mode inside the container. Must be an octal number (like C(0644) or C(0444)).
|
||||
type: int
|
||||
constraints:
|
||||
description:
|
||||
- List of the service constraints.
|
||||
- Corresponds to the C(--constraint) option of C(docker service create).
|
||||
- Deprecated in 2.8, will be removed in community.general 2.0.0. Use parameter C(placement.constraints) instead.
|
||||
type: list
|
||||
elements: str
|
||||
container_labels:
|
||||
description:
|
||||
- Dictionary of key value pairs.
|
||||
@ -214,22 +207,6 @@ options:
|
||||
- Corresponds to the C(--limit-memory) option of C(docker service create).
|
||||
type: str
|
||||
type: dict
|
||||
limit_cpu:
|
||||
description:
|
||||
- Service CPU limit. C(0) equals no limit.
|
||||
- Corresponds to the C(--limit-cpu) option of C(docker service create).
|
||||
- Deprecated in 2.8, will be removed in community.general 2.0.0. Use parameter C(limits.cpus) instead.
|
||||
type: float
|
||||
limit_memory:
|
||||
description:
|
||||
- "Service memory limit in format C(<number>[<unit>]). Number is a positive integer.
|
||||
Unit can be C(B) (byte), C(K) (kibibyte, 1024B), C(M) (mebibyte), C(G) (gibibyte),
|
||||
C(T) (tebibyte), or C(P) (pebibyte)."
|
||||
- C(0) equals no limit.
|
||||
- Omitting the unit defaults to bytes.
|
||||
- Corresponds to the C(--limit-memory) option of C(docker service create).
|
||||
- Deprecated in 2.8, will be removed in community.general 2.0.0. Use parameter C(limits.memory) instead.
|
||||
type: str
|
||||
logging:
|
||||
description:
|
||||
- "Logging configuration for the service."
|
||||
@ -245,18 +222,6 @@ options:
|
||||
- Corresponds to the C(--log-opt) option of C(docker service create).
|
||||
type: dict
|
||||
type: dict
|
||||
log_driver:
|
||||
description:
|
||||
- Configure the logging driver for a service.
|
||||
- Corresponds to the C(--log-driver) option of C(docker service create).
|
||||
- Deprecated in 2.8, will be removed in community.general 2.0.0. Use parameter C(logging.driver) instead.
|
||||
type: str
|
||||
log_driver_options:
|
||||
description:
|
||||
- Options for service logging driver.
|
||||
- Corresponds to the C(--log-opt) option of C(docker service create).
|
||||
- Deprecated in 2.8, will be removed in community.general 2.0.0. Use parameter C(logging.options) instead.
|
||||
type: dict
|
||||
mode:
|
||||
description:
|
||||
- Service replication mode.
|
||||
@ -446,22 +411,6 @@ options:
|
||||
- Corresponds to the C(--reserve-memory) option of C(docker service create).
|
||||
type: str
|
||||
type: dict
|
||||
reserve_cpu:
|
||||
description:
|
||||
- Service CPU reservation. C(0) equals no reservation.
|
||||
- Corresponds to the C(--reserve-cpu) option of C(docker service create).
|
||||
- Deprecated in 2.8, will be removed in community.general 2.0.0. Use parameter C(reservations.cpus) instead.
|
||||
type: float
|
||||
reserve_memory:
|
||||
description:
|
||||
- "Service memory reservation in format C(<number>[<unit>]). Number is a positive integer.
|
||||
Unit can be C(B) (byte), C(K) (kibibyte, 1024B), C(M) (mebibyte), C(G) (gibibyte),
|
||||
C(T) (tebibyte), or C(P) (pebibyte)."
|
||||
- C(0) equals no reservation.
|
||||
- Omitting the unit defaults to bytes.
|
||||
- Corresponds to the C(--reserve-memory) option of C(docker service create).
|
||||
- Deprecated in 2.8, will be removed in community.general 2.0.0. Use parameter C(reservations.memory) instead.
|
||||
type: str
|
||||
resolve_image:
|
||||
description:
|
||||
- If the current image digest should be resolved from registry and updated if changed.
|
||||
@ -501,38 +450,6 @@ options:
|
||||
- Corresponds to the C(--restart-window) option of C(docker service create).
|
||||
type: str
|
||||
type: dict
|
||||
restart_policy:
|
||||
description:
|
||||
- Restart condition of the service.
|
||||
- Corresponds to the C(--restart-condition) option of C(docker service create).
|
||||
- Deprecated in 2.8, will be removed in community.general 2.0.0. Use parameter C(restart_config.condition) instead.
|
||||
type: str
|
||||
choices:
|
||||
- none
|
||||
- on-failure
|
||||
- any
|
||||
restart_policy_attempts:
|
||||
description:
|
||||
- Maximum number of service restarts.
|
||||
- Corresponds to the C(--restart-condition) option of C(docker service create).
|
||||
- Deprecated in 2.8, will be removed in community.general 2.0.0. Use parameter C(restart_config.max_attempts) instead.
|
||||
type: int
|
||||
restart_policy_delay:
|
||||
description:
|
||||
- Delay between restarts.
|
||||
- "Accepts a duration as an integer in nanoseconds or 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)."
|
||||
- Corresponds to the C(--restart-delay) option of C(docker service create).
|
||||
- Deprecated in 2.8, will be removed in community.general 2.0.0. Use parameter C(restart_config.delay) instead.
|
||||
type: raw
|
||||
restart_policy_window:
|
||||
description:
|
||||
- Restart policy evaluation window.
|
||||
- "Accepts a duration as an integer in nanoseconds or 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)."
|
||||
- Corresponds to the C(--restart-window) option of C(docker service create).
|
||||
- Deprecated in 2.8, will be removed in community.general 2.0.0. Use parameter C(restart_config.window) instead.
|
||||
type: raw
|
||||
rollback_config:
|
||||
description:
|
||||
- Configures how the service should be rolled back in case of a failing update.
|
||||
@ -690,59 +607,6 @@ options:
|
||||
- Requires API version >= 1.29.
|
||||
type: str
|
||||
type: dict
|
||||
update_delay:
|
||||
description:
|
||||
- Rolling update delay.
|
||||
- "Accepts a duration as an integer in nanoseconds or 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)."
|
||||
- Corresponds to the C(--update-delay) option of C(docker service create).
|
||||
- Before Ansible 2.8, the default value for this option was C(10).
|
||||
- Deprecated in 2.8, will be removed in community.general 2.0.0. Use parameter C(update_config.delay) instead.
|
||||
type: raw
|
||||
update_parallelism:
|
||||
description:
|
||||
- Rolling update parallelism.
|
||||
- Corresponds to the C(--update-parallelism) option of C(docker service create).
|
||||
- Before Ansible 2.8, the default value for this option was C(1).
|
||||
- Deprecated in 2.8, will be removed in community.general 2.0.0. Use parameter C(update_config.parallelism) instead.
|
||||
type: int
|
||||
update_failure_action:
|
||||
description:
|
||||
- Action to take in case of container failure.
|
||||
- Corresponds to the C(--update-failure-action) option of C(docker service create).
|
||||
- Usage of I(rollback) requires API version >= 1.29.
|
||||
- Deprecated in 2.8, will be removed in community.general 2.0.0. Use parameter C(update_config.failure_action) instead.
|
||||
type: str
|
||||
choices:
|
||||
- continue
|
||||
- pause
|
||||
- rollback
|
||||
update_monitor:
|
||||
description:
|
||||
- Time to monitor updated tasks for failures.
|
||||
- "Accepts a duration as an integer in nanoseconds or 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)."
|
||||
- Corresponds to the C(--update-monitor) option of C(docker service create).
|
||||
- Requires API version >= 1.25.
|
||||
- Deprecated in 2.8, will be removed in community.general 2.0.0. Use parameter C(update_config.monitor) instead.
|
||||
type: raw
|
||||
update_max_failure_ratio:
|
||||
description:
|
||||
- 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).
|
||||
- Requires API version >= 1.25.
|
||||
- Deprecated in 2.8, will be removed in community.general 2.0.0. Use parameter C(update_config.max_failure_ratio) instead.
|
||||
type: float
|
||||
update_order:
|
||||
description:
|
||||
- Specifies the order of operations when rolling out an updated task.
|
||||
- Corresponds to the C(--update-order) option of C(docker service create).
|
||||
- Requires API version >= 1.29.
|
||||
- Deprecated in 2.8, will be removed in community.general 2.0.0. Use parameter C(update_config.order) instead.
|
||||
type: str
|
||||
choices:
|
||||
- stop-first
|
||||
- start-first
|
||||
user:
|
||||
description:
|
||||
- Sets the username or UID used for the specified command.
|
||||
@ -1445,12 +1309,10 @@ class DockerService(DockerBaseClass):
|
||||
condition = get_value(
|
||||
'condition',
|
||||
restart_config,
|
||||
default=params['restart_policy']
|
||||
)
|
||||
delay = get_value(
|
||||
'delay',
|
||||
restart_config,
|
||||
default=params['restart_policy_delay']
|
||||
)
|
||||
delay = get_nanoseconds_from_raw_option(
|
||||
'restart_policy_delay',
|
||||
@ -1459,12 +1321,10 @@ class DockerService(DockerBaseClass):
|
||||
max_attempts = get_value(
|
||||
'max_attempts',
|
||||
restart_config,
|
||||
default=params['restart_policy_attempts']
|
||||
)
|
||||
window = get_value(
|
||||
'window',
|
||||
restart_config,
|
||||
default=params['restart_policy_window']
|
||||
)
|
||||
window = get_nanoseconds_from_raw_option(
|
||||
'restart_policy_window',
|
||||
@ -1483,12 +1343,10 @@ class DockerService(DockerBaseClass):
|
||||
parallelism = get_value(
|
||||
'parallelism',
|
||||
update_config,
|
||||
default=params['update_parallelism']
|
||||
)
|
||||
delay = get_value(
|
||||
'delay',
|
||||
update_config,
|
||||
default=params['update_delay']
|
||||
)
|
||||
delay = get_nanoseconds_from_raw_option(
|
||||
'update_delay',
|
||||
@ -1497,12 +1355,10 @@ class DockerService(DockerBaseClass):
|
||||
failure_action = get_value(
|
||||
'failure_action',
|
||||
update_config,
|
||||
default=params['update_failure_action']
|
||||
)
|
||||
monitor = get_value(
|
||||
'monitor',
|
||||
update_config,
|
||||
default=params['update_monitor']
|
||||
)
|
||||
monitor = get_nanoseconds_from_raw_option(
|
||||
'update_monitor',
|
||||
@ -1511,12 +1367,10 @@ class DockerService(DockerBaseClass):
|
||||
max_failure_ratio = get_value(
|
||||
'max_failure_ratio',
|
||||
update_config,
|
||||
default=params['update_max_failure_ratio']
|
||||
)
|
||||
order = get_value(
|
||||
'order',
|
||||
update_config,
|
||||
default=params['update_order']
|
||||
)
|
||||
return {
|
||||
'update_parallelism': parallelism,
|
||||
@ -1556,12 +1410,10 @@ class DockerService(DockerBaseClass):
|
||||
driver = get_value(
|
||||
'driver',
|
||||
logging_config,
|
||||
default=params['log_driver']
|
||||
)
|
||||
options = get_value(
|
||||
'options',
|
||||
logging_config,
|
||||
default=params['log_driver_options']
|
||||
)
|
||||
return {
|
||||
'log_driver': driver,
|
||||
@ -1574,12 +1426,10 @@ class DockerService(DockerBaseClass):
|
||||
cpus = get_value(
|
||||
'cpus',
|
||||
limits,
|
||||
default=params['limit_cpu']
|
||||
)
|
||||
memory = get_value(
|
||||
'memory',
|
||||
limits,
|
||||
default=params['limit_memory']
|
||||
)
|
||||
if memory is not None:
|
||||
try:
|
||||
@ -1597,12 +1447,10 @@ class DockerService(DockerBaseClass):
|
||||
cpus = get_value(
|
||||
'cpus',
|
||||
reservations,
|
||||
default=params['reserve_cpu']
|
||||
)
|
||||
memory = get_value(
|
||||
'memory',
|
||||
reservations,
|
||||
default=params['reserve_memory']
|
||||
)
|
||||
|
||||
if memory is not None:
|
||||
@ -1620,8 +1468,7 @@ class DockerService(DockerBaseClass):
|
||||
placement = params['placement'] or {}
|
||||
constraints = get_value(
|
||||
'constraints',
|
||||
placement,
|
||||
default=params['constraints']
|
||||
placement
|
||||
)
|
||||
|
||||
preferences = placement.get('preferences')
|
||||
@ -2747,10 +2594,6 @@ def main():
|
||||
driver=dict(type='str'),
|
||||
options=dict(type='dict'),
|
||||
)),
|
||||
log_driver=dict(type='str', removed_in_version='2.0.0',
|
||||
removed_from_collection='community.general'), # was Ansible 2.12
|
||||
log_driver_options=dict(type='dict', removed_in_version='2.0.0',
|
||||
removed_from_collection='community.general'), # was Ansible 2.12
|
||||
publish=dict(type='list', elements='dict', options=dict(
|
||||
published_port=dict(type='int', required=True),
|
||||
target_port=dict(type='int', required=True),
|
||||
@ -2761,8 +2604,6 @@ def main():
|
||||
constraints=dict(type='list', elements='str'),
|
||||
preferences=dict(type='list', elements='dict'),
|
||||
)),
|
||||
constraints=dict(type='list', elements='str', removed_in_version='2.0.0',
|
||||
removed_from_collection='community.general'), # was Ansible 2.12
|
||||
tty=dict(type='bool'),
|
||||
dns=dict(type='list', elements='str'),
|
||||
dns_search=dict(type='list', elements='str'),
|
||||
@ -2791,19 +2632,11 @@ def main():
|
||||
cpus=dict(type='float'),
|
||||
memory=dict(type='str'),
|
||||
)),
|
||||
limit_cpu=dict(type='float', removed_in_version='2.0.0',
|
||||
removed_from_collection='community.general'), # was Ansible 2.12
|
||||
limit_memory=dict(type='str', removed_in_version='2.0.0',
|
||||
removed_from_collection='community.general'), # was Ansible 2.12
|
||||
read_only=dict(type='bool'),
|
||||
reservations=dict(type='dict', options=dict(
|
||||
cpus=dict(type='float'),
|
||||
memory=dict(type='str'),
|
||||
)),
|
||||
reserve_cpu=dict(type='float', removed_in_version='2.0.0',
|
||||
removed_from_collection='community.general'), # was Ansible 2.12
|
||||
reserve_memory=dict(type='str', removed_in_version='2.0.0',
|
||||
removed_from_collection='community.general'), # was Ansible 2.12
|
||||
resolve_image=dict(type='bool', default=False),
|
||||
restart_config=dict(type='dict', options=dict(
|
||||
condition=dict(type='str', choices=['none', 'on-failure', 'any']),
|
||||
@ -2811,18 +2644,6 @@ def main():
|
||||
max_attempts=dict(type='int'),
|
||||
window=dict(type='str'),
|
||||
)),
|
||||
restart_policy=dict(
|
||||
type='str',
|
||||
choices=['none', 'on-failure', 'any'],
|
||||
removed_in_version='2.0.0',
|
||||
removed_from_collection='community.general', # was Ansible 2.12
|
||||
),
|
||||
restart_policy_delay=dict(type='raw', removed_in_version='2.0.0',
|
||||
removed_from_collection='community.general'), # was Ansible 2.12
|
||||
restart_policy_attempts=dict(type='int', removed_in_version='2.0.0',
|
||||
removed_from_collection='community.general'), # was Ansible 2.12
|
||||
restart_policy_window=dict(type='raw', removed_in_version='2.0.0',
|
||||
removed_from_collection='community.general'), # was Ansible 2.12
|
||||
rollback_config=dict(type='dict', options=dict(
|
||||
parallelism=dict(type='int'),
|
||||
delay=dict(type='str'),
|
||||
@ -2845,33 +2666,12 @@ def main():
|
||||
max_failure_ratio=dict(type='float'),
|
||||
order=dict(type='str'),
|
||||
)),
|
||||
update_delay=dict(type='raw', removed_in_version='2.0.0',
|
||||
removed_from_collection='community.general'), # was Ansible 2.12
|
||||
update_parallelism=dict(type='int', removed_in_version='2.0.0',
|
||||
removed_from_collection='community.general'), # was Ansible 2.12
|
||||
update_failure_action=dict(
|
||||
type='str',
|
||||
choices=['continue', 'pause', 'rollback'],
|
||||
removed_in_version='2.0.0',
|
||||
removed_from_collection='community.general', # was Ansible 2.12
|
||||
),
|
||||
update_monitor=dict(type='raw', removed_in_version='2.0.0',
|
||||
removed_from_collection='community.general'), # was Ansible 2.12
|
||||
update_max_failure_ratio=dict(type='float', removed_in_version='2.0.0',
|
||||
removed_from_collection='community.general'), # was Ansible 2.12
|
||||
update_order=dict(
|
||||
type='str',
|
||||
choices=['stop-first', 'start-first'],
|
||||
removed_in_version='2.0.0',
|
||||
removed_from_collection='community.general', # was Ansible 2.12
|
||||
),
|
||||
user=dict(type='str'),
|
||||
working_dir=dict(type='str'),
|
||||
init=dict(type='bool'),
|
||||
)
|
||||
|
||||
option_minimal_versions = dict(
|
||||
constraints=dict(docker_py_version='2.4.0'),
|
||||
dns=dict(docker_py_version='2.6.0', docker_api_version='1.25'),
|
||||
dns_options=dict(docker_py_version='2.6.0', docker_api_version='1.25'),
|
||||
dns_search=dict(docker_py_version='2.6.0', docker_api_version='1.25'),
|
||||
@ -2884,9 +2684,6 @@ def main():
|
||||
tty=dict(docker_py_version='2.4.0', docker_api_version='1.25'),
|
||||
secrets=dict(docker_py_version='2.4.0', docker_api_version='1.25'),
|
||||
configs=dict(docker_py_version='2.6.0', docker_api_version='1.30'),
|
||||
update_max_failure_ratio=dict(docker_py_version='2.1.0', docker_api_version='1.25'),
|
||||
update_monitor=dict(docker_py_version='2.1.0', docker_api_version='1.25'),
|
||||
update_order=dict(docker_py_version='2.7.0', docker_api_version='1.29'),
|
||||
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'),
|
||||
read_only=dict(docker_py_version='2.6.0', docker_api_version='1.28'),
|
||||
|
||||
@ -40,16 +40,6 @@ options:
|
||||
- Dictionary of label key/values to set for the volume
|
||||
type: dict
|
||||
|
||||
force:
|
||||
description:
|
||||
- With state C(present) causes the volume to be deleted and recreated if the volume already
|
||||
exist and the driver, driver options or labels differ. This will cause any data in the existing
|
||||
volume to be lost.
|
||||
- Deprecated. Will be removed in community.general 2.0.0. Set I(recreate) to C(options-changed) instead
|
||||
for the same behavior of setting I(force) to C(yes).
|
||||
type: bool
|
||||
default: no
|
||||
|
||||
recreate:
|
||||
description:
|
||||
- Controls when a volume will be recreated when I(state) is C(present). Please
|
||||
@ -112,8 +102,6 @@ RETURN = '''
|
||||
volume:
|
||||
description:
|
||||
- Volume inspection results for the affected volume.
|
||||
- Note that facts are part of the registered vars since Ansible 2.8. For compatibility reasons, the facts
|
||||
are also accessible directly as C(docker_volume). Note that the returned fact will be removed in community.general 2.0.0.
|
||||
returned: success
|
||||
type: dict
|
||||
sample: {}
|
||||
@ -145,23 +133,12 @@ class TaskParameters(DockerBaseClass):
|
||||
self.driver = None
|
||||
self.driver_options = None
|
||||
self.labels = None
|
||||
self.force = None
|
||||
self.recreate = None
|
||||
self.debug = None
|
||||
|
||||
for key, value in iteritems(client.module.params):
|
||||
setattr(self, key, value)
|
||||
|
||||
if self.force is not None:
|
||||
if self.recreate != 'never':
|
||||
client.fail('Cannot use the deprecated "force" '
|
||||
'option when "recreate" is set. Please stop '
|
||||
'using the force option.')
|
||||
client.module.warn('The "force" option of docker_volume has been deprecated '
|
||||
'in Ansible 2.8. Please use the "recreate" '
|
||||
'option, which provides the same functionality as "force".')
|
||||
self.recreate = 'options-changed' if self.force else 'never'
|
||||
|
||||
|
||||
class DockerVolumeManager(object):
|
||||
|
||||
@ -287,7 +264,6 @@ class DockerVolumeManager(object):
|
||||
self.results.pop('actions')
|
||||
|
||||
volume_facts = self.get_existing_volume()
|
||||
self.results['ansible_facts'] = {u'docker_volume': volume_facts}
|
||||
self.results['volume'] = volume_facts
|
||||
|
||||
def absent(self):
|
||||
@ -302,7 +278,6 @@ def main():
|
||||
driver=dict(type='str', default='local'),
|
||||
driver_options=dict(type='dict', default={}),
|
||||
labels=dict(type='dict'),
|
||||
force=dict(type='bool', removed_in_version='2.0.0', removed_from_collection='community.general'), # was Ansible 2.12
|
||||
recreate=dict(type='str', default='never', choices=['always', 'never', 'options-changed']),
|
||||
debug=dict(type='bool', default=False)
|
||||
)
|
||||
|
||||
@ -382,7 +382,7 @@
|
||||
# If the image isn't there, it will pull it and return 'changed'.
|
||||
docker_image:
|
||||
name: hello-world
|
||||
pull: true
|
||||
source: pull
|
||||
|
||||
- name: wildcard
|
||||
docker_container:
|
||||
|
||||
@ -1865,7 +1865,7 @@
|
||||
# If the image isn't there, it will pull it and return 'changed'.
|
||||
docker_image:
|
||||
name: hello-world
|
||||
pull: true
|
||||
source: pull
|
||||
|
||||
- name: image
|
||||
docker_container:
|
||||
|
||||
@ -1,51 +0,0 @@
|
||||
---
|
||||
- name: Registering image name
|
||||
set_fact:
|
||||
iname: "{{ name_prefix ~ '-old-options' }}"
|
||||
|
||||
- name: Registering image name
|
||||
set_fact:
|
||||
inames: "{{ inames + [iname]}}"
|
||||
|
||||
####################################################################
|
||||
## build ###########################################################
|
||||
####################################################################
|
||||
|
||||
- name: build with old-style options
|
||||
docker_image:
|
||||
name: "{{ iname }}"
|
||||
path: "{{ role_path }}/files"
|
||||
dockerfile: Dockerfile
|
||||
http_timeout: 60
|
||||
nocache: yes
|
||||
pull: no
|
||||
rm: no
|
||||
buildargs:
|
||||
TEST1: val1
|
||||
TEST2: val2
|
||||
TEST3: "True"
|
||||
container_limits:
|
||||
memory: 5000000
|
||||
memswap: 7000000
|
||||
source: build
|
||||
register: build
|
||||
|
||||
- name: cleanup
|
||||
docker_image:
|
||||
name: "{{ iname }}"
|
||||
state: absent
|
||||
force_absent: yes
|
||||
|
||||
- set_fact:
|
||||
build_deprecations: "{{ build.deprecations | map(attribute='msg') | list }}"
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- '"Please specify build.container_limits instead of container_limits. The container_limits option has been renamed" in build_deprecations'
|
||||
- '"Please specify build.dockerfile instead of dockerfile. The dockerfile option has been renamed" in build_deprecations'
|
||||
- '"Please specify build.http_timeout instead of http_timeout. The http_timeout option has been renamed" in build_deprecations'
|
||||
- '"Please specify build.nocache instead of nocache. The nocache option has been renamed" in build_deprecations'
|
||||
- '"Please specify build.path instead of path. The path option has been renamed" in build_deprecations'
|
||||
- '"Please specify build.pull instead of pull. The pull option has been renamed" in build_deprecations'
|
||||
- '"Please specify build.rm instead of rm. The rm option has been renamed" in build_deprecations'
|
||||
- '"Please specify build.args instead of buildargs. The buildargs option has been renamed" in build_deprecations'
|
||||
@ -11,94 +11,8 @@
|
||||
dnetworks: "{{ dnetworks + [nname_ipam_0, nname_ipam_1, nname_ipam_2, nname_ipam_3] }}"
|
||||
|
||||
|
||||
#################### Deprecated ipam_config ####################
|
||||
|
||||
- name: Create network with ipam_config and deprecated ipam_options (conflicting)
|
||||
docker_network:
|
||||
name: "{{ nname_ipam_0 }}"
|
||||
ipam_options:
|
||||
subnet: 172.3.29.0/24
|
||||
ipam_config:
|
||||
- subnet: 172.3.29.0/24
|
||||
register: network
|
||||
ignore_errors: yes
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- network is failed
|
||||
- "network.msg == 'parameters are mutually exclusive: ipam_config|ipam_options'"
|
||||
|
||||
- name: Create network with deprecated custom IPAM options
|
||||
docker_network:
|
||||
name: "{{ nname_ipam_0 }}"
|
||||
ipam_options:
|
||||
subnet: 172.3.29.0/24
|
||||
gateway: 172.3.29.2
|
||||
iprange: 172.3.29.0/26
|
||||
aux_addresses:
|
||||
host1: 172.3.29.3
|
||||
host2: 172.3.29.4
|
||||
register: network
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- network is changed
|
||||
|
||||
- name: Create network with deprecated custom IPAM options (idempotence)
|
||||
docker_network:
|
||||
name: "{{ nname_ipam_0 }}"
|
||||
ipam_options:
|
||||
subnet: 172.3.29.0/24
|
||||
gateway: 172.3.29.2
|
||||
iprange: 172.3.29.0/26
|
||||
aux_addresses:
|
||||
host1: 172.3.29.3
|
||||
host2: 172.3.29.4
|
||||
register: network
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- network is not changed
|
||||
|
||||
- name: Change of network created with deprecated custom IPAM options
|
||||
docker_network:
|
||||
name: "{{ nname_ipam_0 }}"
|
||||
ipam_options:
|
||||
subnet: 172.3.28.0/24
|
||||
gateway: 172.3.28.2
|
||||
iprange: 172.3.28.0/26
|
||||
aux_addresses:
|
||||
host1: 172.3.28.3
|
||||
register: network
|
||||
diff: yes
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- network is changed
|
||||
- network.diff.differences | length == 4
|
||||
- '"ipam_config[0].subnet" in network.diff.differences'
|
||||
- '"ipam_config[0].gateway" in network.diff.differences'
|
||||
- '"ipam_config[0].iprange" in network.diff.differences'
|
||||
- '"ipam_config[0].aux_addresses" in network.diff.differences'
|
||||
|
||||
- name: Remove gateway and iprange of network with deprecated custom IPAM options
|
||||
docker_network:
|
||||
name: "{{ nname_ipam_0 }}"
|
||||
ipam_options:
|
||||
subnet: 172.3.28.0/24
|
||||
register: network
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- network is not changed
|
||||
|
||||
- name: Cleanup network with deprecated custom IPAM options
|
||||
docker_network:
|
||||
name: "{{ nname_ipam_0 }}"
|
||||
state: absent
|
||||
|
||||
|
||||
#################### IPv4 IPAM config ####################
|
||||
|
||||
- name: Create network with custom IPAM config
|
||||
docker_network:
|
||||
name: "{{ nname_ipam_1 }}"
|
||||
|
||||
@ -32,15 +32,6 @@
|
||||
driver: json-file
|
||||
register: logging_driver_2
|
||||
|
||||
- name: log_driver (idempotency, old name)
|
||||
docker_swarm_service:
|
||||
name: "{{ service_name }}"
|
||||
image: alpine:3.8
|
||||
resolve_image: no
|
||||
command: '/bin/sh -v -c "sleep 10m"'
|
||||
log_driver: json-file
|
||||
register: logging_driver_2b
|
||||
|
||||
- name: logging.driver (change)
|
||||
docker_swarm_service:
|
||||
name: "{{ service_name }}"
|
||||
@ -61,7 +52,6 @@
|
||||
that:
|
||||
- logging_driver_1 is changed
|
||||
- logging_driver_2 is not changed
|
||||
- logging_driver_2b is not changed
|
||||
- logging_driver_3 is changed
|
||||
|
||||
####################################################################
|
||||
@ -94,18 +84,6 @@
|
||||
labels: production_status
|
||||
register: logging_options_2
|
||||
|
||||
- name: log_driver_options (idempotency, old name)
|
||||
docker_swarm_service:
|
||||
name: "{{ service_name }}"
|
||||
image: alpine:3.8
|
||||
resolve_image: no
|
||||
command: '/bin/sh -v -c "sleep 10m"'
|
||||
log_driver: json-file
|
||||
log_driver_options:
|
||||
env: os,customer
|
||||
labels: production_status
|
||||
register: logging_options_2b
|
||||
|
||||
- name: logging_options (change)
|
||||
docker_swarm_service:
|
||||
name: "{{ service_name }}"
|
||||
@ -152,7 +130,6 @@
|
||||
that:
|
||||
- logging_options_1 is changed
|
||||
- logging_options_2 is not changed
|
||||
- logging_options_2b is not changed
|
||||
- logging_options_3 is changed
|
||||
- logging_options_4 is changed
|
||||
- logging_options_5 is not changed
|
||||
|
||||
@ -119,17 +119,6 @@
|
||||
register: constraints_2
|
||||
ignore_errors: yes
|
||||
|
||||
- name: constraints (idempotency, old name)
|
||||
docker_swarm_service:
|
||||
name: "{{ service_name }}"
|
||||
image: alpine:3.8
|
||||
resolve_image: no
|
||||
command: '/bin/sh -v -c "sleep 10m"'
|
||||
constraints:
|
||||
- "node.role == manager"
|
||||
register: constraints_2b
|
||||
ignore_errors: yes
|
||||
|
||||
- name: placement.constraints (change)
|
||||
docker_swarm_service:
|
||||
name: "{{ service_name }}"
|
||||
@ -200,7 +189,6 @@
|
||||
that:
|
||||
- constraints_1 is changed
|
||||
- constraints_2 is not changed
|
||||
- constraints_2b is not changed
|
||||
- constraints_3 is changed
|
||||
- constraints_4 is changed
|
||||
- constraints_5 is not changed
|
||||
|
||||
@ -32,15 +32,6 @@
|
||||
cpus: 1
|
||||
register: limit_cpu_2
|
||||
|
||||
- name: limit_cpu (idempotency, old name)
|
||||
docker_swarm_service:
|
||||
name: "{{ service_name }}"
|
||||
image: alpine:3.8
|
||||
resolve_image: no
|
||||
command: '/bin/sh -v -c "sleep 10m"'
|
||||
limit_cpu: 1
|
||||
register: limit_cpu_2b
|
||||
|
||||
- name: limits.cpus (change)
|
||||
docker_swarm_service:
|
||||
name: "{{ service_name }}"
|
||||
@ -61,7 +52,6 @@
|
||||
that:
|
||||
- limit_cpu_1 is changed
|
||||
- limit_cpu_2 is not changed
|
||||
- limit_cpu_2b is not changed
|
||||
- limit_cpu_3 is changed
|
||||
|
||||
###################################################################
|
||||
@ -88,22 +78,14 @@
|
||||
memory: 64M
|
||||
register: limit_memory_2
|
||||
|
||||
- name: limit_memory (idempotency, old name)
|
||||
docker_swarm_service:
|
||||
name: "{{ service_name }}"
|
||||
image: alpine:3.8
|
||||
resolve_image: no
|
||||
command: '/bin/sh -v -c "sleep 10m"'
|
||||
limit_memory: "67108864"
|
||||
register: limit_memory_2b
|
||||
|
||||
- name: limits.memory (change)
|
||||
docker_swarm_service:
|
||||
name: "{{ service_name }}"
|
||||
image: alpine:3.8
|
||||
resolve_image: no
|
||||
command: '/bin/sh -v -c "sleep 10m"'
|
||||
limit_memory: 32M
|
||||
limits:
|
||||
memory: 32M
|
||||
register: limit_memory_3
|
||||
|
||||
- name: cleanup
|
||||
@ -116,7 +98,6 @@
|
||||
that:
|
||||
- limit_memory_1 is changed
|
||||
- limit_memory_2 is not changed
|
||||
- limit_memory_2b is not changed
|
||||
- limit_memory_3 is changed
|
||||
|
||||
###################################################################
|
||||
@ -143,15 +124,6 @@
|
||||
cpus: 1
|
||||
register: reserve_cpu_2
|
||||
|
||||
- name: reserve_cpu (idempotency, old name)
|
||||
docker_swarm_service:
|
||||
name: "{{ service_name }}"
|
||||
image: alpine:3.8
|
||||
resolve_image: no
|
||||
command: '/bin/sh -v -c "sleep 10m"'
|
||||
reserve_cpu: 1
|
||||
register: reserve_cpu_2b
|
||||
|
||||
- name: reserve_cpu (change)
|
||||
docker_swarm_service:
|
||||
name: "{{ service_name }}"
|
||||
@ -172,7 +144,6 @@
|
||||
that:
|
||||
- reserve_cpu_1 is changed
|
||||
- reserve_cpu_2 is not changed
|
||||
- reserve_cpu_2b is not changed
|
||||
- reserve_cpu_3 is changed
|
||||
|
||||
###################################################################
|
||||
@ -195,25 +166,18 @@
|
||||
image: alpine:3.8
|
||||
resolve_image: no
|
||||
command: '/bin/sh -v -c "sleep 10m"'
|
||||
reserve_memory: 64M
|
||||
reservations:
|
||||
memory: 64M
|
||||
register: reserve_memory_2
|
||||
|
||||
- name: reserve_memory (idempotency, old name)
|
||||
docker_swarm_service:
|
||||
name: "{{ service_name }}"
|
||||
image: alpine:3.8
|
||||
resolve_image: no
|
||||
command: '/bin/sh -v -c "sleep 10m"'
|
||||
reserve_memory: "67108864"
|
||||
register: reserve_memory_2b
|
||||
|
||||
- name: reservations.memory (change)
|
||||
docker_swarm_service:
|
||||
name: "{{ service_name }}"
|
||||
image: alpine:3.8
|
||||
resolve_image: no
|
||||
command: '/bin/sh -v -c "sleep 10m"'
|
||||
reserve_memory: 32M
|
||||
reservations:
|
||||
memory: 32M
|
||||
register: reserve_memory_3
|
||||
|
||||
- name: cleanup
|
||||
@ -226,5 +190,4 @@
|
||||
that:
|
||||
- reserve_memory_1 is changed
|
||||
- reserve_memory_2 is not changed
|
||||
- reserve_memory_2b is not changed
|
||||
- reserve_memory_3 is changed
|
||||
|
||||
@ -32,15 +32,6 @@
|
||||
condition: "on-failure"
|
||||
register: restart_policy_2
|
||||
|
||||
- name: restart_policy (idempotency, old name)
|
||||
docker_swarm_service:
|
||||
name: "{{ service_name }}"
|
||||
image: alpine:3.8
|
||||
resolve_image: no
|
||||
command: '/bin/sh -v -c "sleep 10m"'
|
||||
restart_policy: "on-failure"
|
||||
register: restart_policy_2b
|
||||
|
||||
- name: restart_config.condition (change)
|
||||
docker_swarm_service:
|
||||
name: "{{ service_name }}"
|
||||
@ -61,7 +52,6 @@
|
||||
that:
|
||||
- restart_policy_1 is changed
|
||||
- restart_policy_2 is not changed
|
||||
- restart_policy_2b is not changed
|
||||
- restart_policy_3 is changed
|
||||
|
||||
###################################################################
|
||||
@ -88,15 +78,6 @@
|
||||
max_attempts: 1
|
||||
register: restart_policy_attempts_2
|
||||
|
||||
- name: restart_policy_attempts (idempotency, old name)
|
||||
docker_swarm_service:
|
||||
name: "{{ service_name }}"
|
||||
image: alpine:3.8
|
||||
resolve_image: no
|
||||
command: '/bin/sh -v -c "sleep 10m"'
|
||||
restart_policy_attempts: 1
|
||||
register: restart_policy_attempts_2b
|
||||
|
||||
- name: restart_config.max_attempts (change)
|
||||
docker_swarm_service:
|
||||
name: "{{ service_name }}"
|
||||
@ -117,7 +98,6 @@
|
||||
that:
|
||||
- restart_policy_attempts_1 is changed
|
||||
- restart_policy_attempts_2 is not changed
|
||||
- restart_policy_attempts_2b is not changed
|
||||
- restart_policy_attempts_3 is changed
|
||||
|
||||
###################################################################
|
||||
@ -144,15 +124,6 @@
|
||||
delay: 5s
|
||||
register: restart_policy_delay_2
|
||||
|
||||
- name: restart_policy_delay (idempotency, old name)
|
||||
docker_swarm_service:
|
||||
name: "{{ service_name }}"
|
||||
image: alpine:3.8
|
||||
resolve_image: no
|
||||
command: '/bin/sh -v -c "sleep 10m"'
|
||||
restart_policy_delay: 5000000000
|
||||
register: restart_policy_delay_2b
|
||||
|
||||
- name: restart_config.delay (change)
|
||||
docker_swarm_service:
|
||||
name: "{{ service_name }}"
|
||||
@ -173,7 +144,6 @@
|
||||
that:
|
||||
- restart_policy_delay_1 is changed
|
||||
- restart_policy_delay_2 is not changed
|
||||
- restart_policy_delay_2b is not changed
|
||||
- restart_policy_delay_3 is changed
|
||||
|
||||
###################################################################
|
||||
@ -200,15 +170,6 @@
|
||||
window: 10s
|
||||
register: restart_policy_window_2
|
||||
|
||||
- name: restart_policy_window (idempotency, old name)
|
||||
docker_swarm_service:
|
||||
name: "{{ service_name }}"
|
||||
image: alpine:3.8
|
||||
resolve_image: no
|
||||
command: '/bin/sh -v -c "sleep 10m"'
|
||||
restart_policy_window: 10000000000
|
||||
register: restart_policy_window_2b
|
||||
|
||||
- name: restart_config.window (change)
|
||||
docker_swarm_service:
|
||||
name: "{{ service_name }}"
|
||||
@ -229,5 +190,4 @@
|
||||
that:
|
||||
- restart_policy_window_1 is changed
|
||||
- restart_policy_window_2 is not changed
|
||||
- restart_policy_window_2b is not changed
|
||||
- restart_policy_window_3 is changed
|
||||
|
||||
@ -32,15 +32,6 @@
|
||||
delay: 5s
|
||||
register: update_delay_2
|
||||
|
||||
- name: update_delay (idempotency, old name)
|
||||
docker_swarm_service:
|
||||
name: "{{ service_name }}"
|
||||
image: alpine:3.8
|
||||
resolve_image: no
|
||||
command: '/bin/sh -v -c "sleep 10m"'
|
||||
update_delay: 5000000000
|
||||
register: update_delay_2b
|
||||
|
||||
- name: update_config.delay (change)
|
||||
docker_swarm_service:
|
||||
name: "{{ service_name }}"
|
||||
@ -61,7 +52,6 @@
|
||||
that:
|
||||
- update_delay_1 is changed
|
||||
- update_delay_2 is not changed
|
||||
- update_delay_2b is not changed
|
||||
- update_delay_3 is changed
|
||||
|
||||
###################################################################
|
||||
@ -88,15 +78,6 @@
|
||||
failure_action: "pause"
|
||||
register: update_failure_action_2
|
||||
|
||||
- name: update_failure_action (idempotency, old name)
|
||||
docker_swarm_service:
|
||||
name: "{{ service_name }}"
|
||||
image: alpine:3.8
|
||||
resolve_image: no
|
||||
command: '/bin/sh -v -c "sleep 10m"'
|
||||
update_failure_action: "pause"
|
||||
register: update_failure_action_2b
|
||||
|
||||
- name: update_config.failure_action (change)
|
||||
docker_swarm_service:
|
||||
name: "{{ service_name }}"
|
||||
@ -138,7 +119,6 @@
|
||||
that:
|
||||
- update_failure_action_1 is changed
|
||||
- update_failure_action_2 is not changed
|
||||
- update_failure_action_2b is not changed
|
||||
- update_failure_action_3 is changed
|
||||
|
||||
- assert:
|
||||
@ -179,16 +159,6 @@
|
||||
register: update_max_failure_ratio_2
|
||||
ignore_errors: yes
|
||||
|
||||
- name: update_max_failure_ratio (idempotency, old name)
|
||||
docker_swarm_service:
|
||||
name: "{{ service_name }}"
|
||||
image: alpine:3.8
|
||||
resolve_image: no
|
||||
command: '/bin/sh -v -c "sleep 10m"'
|
||||
update_max_failure_ratio: 0.25
|
||||
register: update_max_failure_ratio_2b
|
||||
ignore_errors: yes
|
||||
|
||||
- name: update_config.max_failure_ratio (change)
|
||||
docker_swarm_service:
|
||||
name: "{{ service_name }}"
|
||||
@ -210,7 +180,6 @@
|
||||
that:
|
||||
- update_max_failure_ratio_1 is changed
|
||||
- update_max_failure_ratio_2 is not changed
|
||||
- update_max_failure_ratio_2b is not 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', '>=')
|
||||
- assert:
|
||||
@ -245,16 +214,6 @@
|
||||
register: update_monitor_2
|
||||
ignore_errors: yes
|
||||
|
||||
- name: update_monitor (idempotency, old name)
|
||||
docker_swarm_service:
|
||||
name: "{{ service_name }}"
|
||||
image: alpine:3.8
|
||||
resolve_image: no
|
||||
command: '/bin/sh -v -c "sleep 10m"'
|
||||
update_monitor: 10s
|
||||
register: update_monitor_2b
|
||||
ignore_errors: yes
|
||||
|
||||
- name: update_config.monitor (change)
|
||||
docker_swarm_service:
|
||||
name: "{{ service_name }}"
|
||||
@ -276,7 +235,6 @@
|
||||
that:
|
||||
- update_monitor_1 is changed
|
||||
- update_monitor_2 is not changed
|
||||
- update_monitor_2b is not changed
|
||||
- update_monitor_3 is changed
|
||||
when: docker_api_version is version('1.25', '>=') and docker_py_version is version('2.1.0', '>=')
|
||||
- assert:
|
||||
@ -311,16 +269,6 @@
|
||||
register: update_order_2
|
||||
ignore_errors: yes
|
||||
|
||||
- name: update_order (idempotency, old name)
|
||||
docker_swarm_service:
|
||||
name: "{{ service_name }}"
|
||||
image: alpine:3.8
|
||||
resolve_image: no
|
||||
command: '/bin/sh -v -c "sleep 10m"'
|
||||
update_order: "start-first"
|
||||
register: update_order_2b
|
||||
ignore_errors: yes
|
||||
|
||||
- name: update_config.order (change)
|
||||
docker_swarm_service:
|
||||
name: "{{ service_name }}"
|
||||
@ -342,7 +290,6 @@
|
||||
that:
|
||||
- update_order_1 is changed
|
||||
- update_order_2 is not changed
|
||||
- update_order_2b is not changed
|
||||
- update_order_3 is changed
|
||||
when: docker_api_version is version('1.29', '>=') and docker_py_version is version('2.7.0', '>=')
|
||||
- assert:
|
||||
@ -375,15 +322,6 @@
|
||||
parallelism: 2
|
||||
register: update_parallelism_2
|
||||
|
||||
- name: update_parallelism (idempotency, old name)
|
||||
docker_swarm_service:
|
||||
name: "{{ service_name }}"
|
||||
image: alpine:3.8
|
||||
resolve_image: no
|
||||
command: '/bin/sh -v -c "sleep 10m"'
|
||||
update_parallelism: 2
|
||||
register: update_parallelism_2b
|
||||
|
||||
- name: update_config.parallelism (change)
|
||||
docker_swarm_service:
|
||||
name: "{{ service_name }}"
|
||||
@ -404,5 +342,4 @@
|
||||
that:
|
||||
- update_parallelism_1 is changed
|
||||
- update_parallelism_2 is not changed
|
||||
- update_parallelism_2b is not changed
|
||||
- update_parallelism_3 is changed
|
||||
|
||||
Loading…
Reference in New Issue
Block a user