summaryrefslogtreecommitdiffstats
path: root/ansible_collections/community/docker/plugins
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-06-26 06:22:15 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-06-26 06:22:15 +0000
commit0202b47f95a87598276869ab7f07f57e8a4c8a87 (patch)
tree21f101dcceb98166b117c40dab3d79d5b2ad8eed /ansible_collections/community/docker/plugins
parentAdding upstream version 10.0.1+dfsg. (diff)
downloadansible-0202b47f95a87598276869ab7f07f57e8a4c8a87.tar.xz
ansible-0202b47f95a87598276869ab7f07f57e8a4c8a87.zip
Adding upstream version 10.1.0+dfsg.upstream/10.1.0+dfsgupstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'ansible_collections/community/docker/plugins')
-rw-r--r--ansible_collections/community/docker/plugins/doc_fragments/compose_v2.py4
-rw-r--r--ansible_collections/community/docker/plugins/module_utils/compose_v2.py3
-rw-r--r--ansible_collections/community/docker/plugins/modules/docker_compose.py3
-rw-r--r--ansible_collections/community/docker/plugins/modules/docker_compose_v2.py2
4 files changed, 9 insertions, 3 deletions
diff --git a/ansible_collections/community/docker/plugins/doc_fragments/compose_v2.py b/ansible_collections/community/docker/plugins/doc_fragments/compose_v2.py
index 234a94fe2..58ea7dc28 100644
--- a/ansible_collections/community/docker/plugins/doc_fragments/compose_v2.py
+++ b/ansible_collections/community/docker/plugins/doc_fragments/compose_v2.py
@@ -18,7 +18,7 @@ options:
- Path to a directory containing a Compose file
(C(compose.yml), C(compose.yaml), C(docker-compose.yml), or C(docker-compose.yaml)).
- If O(files) is provided, will look for these files in this directory instead.
- - Mutually exclusive with O(definition).
+ - Mutually exclusive with O(definition). One of O(project_src) and O(definition) must be provided.
type: path
project_name:
description:
@@ -37,7 +37,7 @@ options:
definition:
description:
- Compose file describing one or more services, networks and volumes.
- - Mutually exclusive with O(project_src) and O(files).
+ - Mutually exclusive with O(project_src) and O(files). One of O(project_src) and O(definition) must be provided.
- If provided, PyYAML must be available to this module, and O(project_name) must be specified.
- Note that a temporary directory will be created and deleted afterwards when using this option.
type: dict
diff --git a/ansible_collections/community/docker/plugins/module_utils/compose_v2.py b/ansible_collections/community/docker/plugins/module_utils/compose_v2.py
index 85fbd5d80..80d6be66f 100644
--- a/ansible_collections/community/docker/plugins/module_utils/compose_v2.py
+++ b/ansible_collections/community/docker/plugins/module_utils/compose_v2.py
@@ -518,6 +518,9 @@ def common_compose_argspec_ex():
('definition', 'project_src'),
('definition', 'files')
],
+ required_one_of=[
+ ('definition', 'project_src'),
+ ],
required_by={
'definition': ('project_name', ),
},
diff --git a/ansible_collections/community/docker/plugins/modules/docker_compose.py b/ansible_collections/community/docker/plugins/modules/docker_compose.py
index 3af3bebb1..dcba5adfb 100644
--- a/ansible_collections/community/docker/plugins/modules/docker_compose.py
+++ b/ansible_collections/community/docker/plugins/modules/docker_compose.py
@@ -675,6 +675,9 @@ class ContainerManager(DockerBaseClass):
for key, value in client.module.params.items():
setattr(self, key, value)
+ if self.api_version:
+ os.environ['COMPOSE_API_VERSION'] = self.api_version
+
self.check_mode = client.check_mode
if not self.debug:
diff --git a/ansible_collections/community/docker/plugins/modules/docker_compose_v2.py b/ansible_collections/community/docker/plugins/modules/docker_compose_v2.py
index 9972d45f6..921294bf9 100644
--- a/ansible_collections/community/docker/plugins/modules/docker_compose_v2.py
+++ b/ansible_collections/community/docker/plugins/modules/docker_compose_v2.py
@@ -169,7 +169,7 @@ EXAMPLES = '''
ansible.builtin.debug:
var: output
- - name: Run `docker-compose up` again
+ - name: Run `docker compose up` again
community.docker.docker_compose_v2:
project_src: flask
register: output