Debian Codegraph @

ansible_collections/community/docker/plugins/doc_fragments/_compose_v2.py

raw
1 # Copyright (c) 2023, Felix Fontein <[email protected]>
2 # GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
3 # SPDX-License-Identifier: GPL-3.0-or-later
4
5 # Note that this module util is **PRIVATE** to the collection. It can have breaking changes at any time.
6 # Do not use this from other collections or standalone plugins/modules!
7
8 from __future__ import annotations
9
10
11 class ModuleDocFragment:
12
13 # Docker doc fragment
14 DOCUMENTATION = r"""
15 options:
16 project_src:
17 description:
18 - Path to a directory containing a Compose file (C(compose.yml), C(compose.yaml), C(docker-compose.yml), or C(docker-compose.yaml)).
19 - If O(files) is provided, will look for these files in this directory instead.
20 - Mutually exclusive with O(definition). One of O(project_src) and O(definition) must be provided.
21 type: path
22 project_name:
23 description:
24 - Provide a project name. If not provided, the project name is taken from the basename of O(project_src).
25 - Required when O(definition) is provided.
26 type: str
27 files:
28 description:
29 - List of Compose file names relative to O(project_src) to be used instead of the main Compose file (C(compose.yml),
30 C(compose.yaml), C(docker-compose.yml), or C(docker-compose.yaml)).
31 - Files are loaded and merged in the order given.
32 - Mutually exclusive with O(definition).
33 type: list
34 elements: path
35 version_added: 3.7.0
36 definition:
37 description:
38 - Compose file describing one or more services, networks and volumes.
39 - Mutually exclusive with O(project_src) and O(files). One of O(project_src) and O(definition) must be provided.
40 - If provided, PyYAML must be available to this module, and O(project_name) must be specified.
41 - Note that a temporary directory will be created and deleted afterwards when using this option.
42 type: dict
43 version_added: 3.9.0
44 env_files:
45 description:
46 - By default environment files are loaded from a C(.env) file located directly under the O(project_src) directory.
47 - O(env_files) can be used to specify the path of one or multiple custom environment files instead.
48 - The path is relative to the O(project_src) directory.
49 type: list
50 elements: path
51 profiles:
52 description:
53 - List of profiles to enable when starting services.
54 - Equivalent to C(docker compose --profile).
55 type: list
56 elements: str
57 check_files_existing:
58 description:
59 - If set to V(false), the module will not check whether one of the files C(compose.yaml), C(compose.yml), C(docker-compose.yaml),
60 or C(docker-compose.yml) exists in O(project_src) if O(files) is not provided.
61 - This can be useful if environment files with C(COMPOSE_FILE) are used to configure a different filename. The module
62 currently does not check for C(COMPOSE_FILE) in environment files or the current environment.
63 type: bool
64 default: true
65 version_added: 3.9.0
66 requirements:
67 - "PyYAML if O(definition) is used"
68 notes:
69 - |-
70 The Docker compose CLI plugin has no stable output format (see for example U(https://github.com/docker/compose/issues/10872)),
71 and for the main operations also no machine friendly output format. The module tries to accomodate this with various
72 version-dependent behavior adjustments and with testing older and newer versions of the Docker compose CLI plugin.
73 Currently the module is tested with multiple plugin versions between 2.18.1 and 2.23.3. The exact list of plugin versions
74 will change over time. New releases of the Docker compose CLI plugin can break this module at any time.
75 """
76
77 # The following needs to be kept in sync with the compose_v2 module utils
78 MINIMUM_VERSION = r"""
79 options: {}
80 requirements:
81 - "Docker CLI with Docker compose plugin 2.18.0 or later"
82 """