arillso.container.docker_compose 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.

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_compose_api_version

string

Docker API version to use, set to ‘auto’ for automatic version selection.

Default: "auto"

docker_compose_build

boolean

Option to build images before starting services.

Choices:

  • false ← (default)

  • true

docker_compose_ca_cert

string

Path to the CA certificate for server verification.

docker_compose_client_cert

string

Path to the client’s TLS certificate for Docker communication.

docker_compose_client_key

string

Path to the client’s TLS key for Docker communication.

docker_compose_config

any

Inline Docker Compose configuration, defined as a multi-line YAML string.

Default: []

docker_compose_debug

boolean

Enable or disable debug mode.

Choices:

  • false ← (default)

  • true

docker_compose_dependencies

boolean

Include or exclude linked services.

Choices:

  • false

  • true ← (default)

docker_compose_directory

string

Full path to the Docker Compose project directory.

Default: "{{ docker_compose_directory_path }}/{{ docker_compose_project }}"

docker_compose_directory_path

string

Base path for Docker Compose configuration files.

Default: "/etc/docker/compose"

docker_compose_docker_host

string

Docker host URL or Unix socket path for API connection.

Default: "unix://var/run/docker.sock"

docker_compose_env_file

string

Custom path to an environment file.

docker_compose_files

list / elements=string

List of Compose file names to override the default docker-compose.yml.

docker_compose_hostname_check

boolean

Check Docker daemon’s hostname against client certificate.

Choices:

  • false ← (default)

  • true

docker_compose_nocache

boolean

Control the use of cache during image build.

Choices:

  • false ← (default)

  • true

docker_compose_package

list / elements=string

List of Docker Compose packages to install, appending the version if specified.

Default: ["{{ 'docker-compose-plugin=' + docker_compose_version if docker_compose_version != '' else 'docker-compose-plugin' }}"]

docker_compose_profiles

list / elements=string

List of profiles to enable when starting services.

docker_compose_project

string

The name of the Docker Compose project, used in the full path construction.

Default: ""

docker_compose_project_name

string

Custom name for the Docker Compose project.

docker_compose_pull

boolean

Always pull images before starting the application.

Choices:

  • false ← (default)

  • true

docker_compose_recreate

string

Strategy for container recreation: ‘always’, ‘never’, or ‘smart’.

Default: "smart"

docker_compose_remove_images

string

Option to remove images when state is ‘absent’.

docker_compose_remove_orphans

boolean

Remove containers for services not defined in the Compose file.

Choices:

  • false ← (default)

  • true

docker_compose_remove_volumes

boolean

Remove data volumes when state is ‘absent’.

Choices:

  • false ← (default)

  • true

docker_compose_restarted

boolean

Restart all containers when state is ‘present’.

Choices:

  • false ← (default)

  • true

docker_compose_scale

dictionary

Dictionary defining service scaling.

docker_compose_services

list / elements=string

List of specific services to operate on.

docker_compose_ssl_version

string

Specify a valid SSL version number for secure communication.

docker_compose_state

string

Desired state of the Docker Compose project.

Default: "present"

docker_compose_stopped

boolean

Stop all containers when state is ‘present’.

Choices:

  • false ← (default)

  • true

docker_compose_timeout

integer

Timeout in seconds for container shutdown operations.

docker_compose_tls

boolean

Use TLS for API connection without verifying Docker host server’s authenticity.

Choices:

  • false ← (default)

  • true

docker_compose_tls_hostname

string

Expected hostname of the Docker Host server for TLS verification.

docker_compose_use_file

boolean

Flag to use a Docker Compose file (true) or inline configuration (false).

Choices:

  • false

  • true ← (default)

docker_compose_use_ssh_client

boolean

Flag to enable SSH client usage for Docker API communication.

Choices:

  • false ← (default)

  • true

docker_compose_validate_certs

boolean

Verify the Docker host server’s authenticity when using TLS.

Choices:

  • false ← (default)

  • true

docker_compose_version

string

The desired Docker Compose version. Leave empty for the latest version.

Default: ""