arillso.container.docker_compose_v2 role – Configure and manage Docker Compose environment using Ansible
Note
This role is part of the arillso.container collection (version 0.0.7).
It is not included in ansible-core
.
To check whether it is installed, run ansible-galaxy collection list
.
To install it use: ansible-galaxy collection install arillso.container
.
To use it in a playbook, specify: arillso.container.docker_compose_v2
.
Entry point main
– Configure and manage Docker Compose environment using Ansible
Synopsis
This spec outlines parameters for configuring Docker Compose with Ansible.
It includes Docker Compose version, package names, directory paths, configuration methods, and project name.
Parameters
Parameter |
Comments |
---|---|
Docker API version to use. Set to ‘auto’ for automatic selection of the latest supported version. ‘auto’ automatically selects the latest supported API version. Default: |
|
Path to the CA certificate for server verification. |
|
Specify the Docker CLI context to use with Docker Compose v2. |
|
Path to the client’s TLS certificate for Docker daemon communication. |
|
Path to the client’s TLS key for Docker daemon communication. |
|
Inline configuration for Docker Compose, defined as an array of multi-line YAML strings. Default: |
|
Enable or disable debug mode. Choices:
|
|
Include or exclude linked services. Choices:
|
|
Full path to the Docker Compose project directory, constructed from docker_compose_v2_directory_path and docker_compose_v2_project. Default: |
|
Base directory path for storing Docker Compose configuration files. Ensure the specified path exists and is writable. Default: |
|
Path to the Docker CLI executable, if not in standard PATH. |
|
Docker host URL or Unix socket path for API connection. Defaults to the standard Unix socket. Default: |
|
Custom path to an environment file, relative to the project source directory. |
|
List of Compose file names, relative to project_src, to override default docker-compose.yml. |
|
Check Docker daemon’s hostname against the name provided in the client certificate. Default is ‘false’. Choices:
|
|
Control the use of cache during the image build. Set to ‘true’ to ignore cache. Choices:
|
|
List of Docker Compose packages for installation. Appends the specified version to the package name if docker_compose_v2_version is set. Useful for ensuring consistency across environments by locking to a specific version. Default: |
|
List of profiles to enable when starting services, applicable for docker-compose v1.28.0 or later. |
|
Name of the Docker Compose project, utilized to construct the full Docker Compose directory path. Default: |
|
Custom name for the Docker Compose project. If not set, the default name is derived from the project directory. |
|
Always pull images before starting the application. Set to ‘true’ to enable. |
|
Strategy for container recreation: ‘always’, ‘never’, or ‘smart’ (default). Default: |
|
Option to remove images when state is ‘absent’. Choices are ‘all’ or ‘local’. |
|
Remove containers for services not defined in the current Compose file. Default is ‘false’. Useful for cleaning up containers that are no longer needed. Choices:
|
|
Remove data volumes when state is ‘absent’. Default is ‘false’. Choices:
|
|
Restart all containers when state is ‘present’. Default is ‘false’. Choices:
|
|
Dictionary defining service scaling: service name as key, number of containers as value. |
|
List of specific services to operate on. If empty, applies to all services in the Compose file. |
|
Specify a valid SSL version number for secure communication. Uses the default value determined by the SSL Python module if not set. |
|
Desired state of the Docker Compose project: ‘present’ (default) or ‘absent’. ‘present’ ensures the project is running, ‘absent’ removes it. Default: |
|
Stop all containers when state is ‘present’. Default is ‘false’. Choices:
|
|
Timeout in seconds for container shutdown operations. Set a specific value to override the default timeout. |
|
Use TLS for API connection without verifying the Docker host server’s authenticity. Default is ‘false’. Choices:
|
|
Expected hostname of the Docker Host server for TLS verification. |
|
Boolean flag to choose Docker Compose execution method: ‘true’ for file-based, ‘false’ for inline configuration. ‘true’ uses a file for configuration, while ‘false’ utilizes an inline configuration. Choices:
|
|
Verify the Docker host server’s authenticity when using TLS. Default is ‘false’. Choices:
|
|
Specifies the version of Docker Compose to install. Leave blank for the latest version. Specify a specific version to install an older or specific release. Default: |