docker_volume
Create and remove named Docker volumes
Collection: community.docker
Full Name: parallax.community.general.docker_volume
Aliases: community.general.docker_volume, docker_volume, community.docker.docker_volume
Synopsis
Create and remove named Docker volumes
Parameters
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
| name | string | yes | Name of the Docker volume | |
| state | string | present | State of the volume Choices: present, absent | |
| driver | string | local | Volume driver to use | |
| driver_options | raw | Dictionary of driver options; legacy comma-separated key=value pairs are also accepted | ||
| labels | raw | Dictionary of labels; legacy comma-separated key=value pairs are also accepted | ||
| recreate | string | never | When to recreate the volume Choices: never, options-changed, always | |
| force | bool | false | Force removal of volume even if in use | |
| docker_host | string | Docker socket or TCP URL; defaults to DOCKER_HOST or unix:///var/run/docker.sock | ||
| api_version | string | Docker API version; defaults to DOCKER_API_VERSION or auto | ||
| timeout | int | Request timeout in seconds; defaults to DOCKER_TIMEOUT or 60 | ||
| tls | bool | Enable TLS without server verification; defaults to DOCKER_TLS | ||
| validate_certs | bool | Verify TLS certificates; defaults to DOCKER_TLS_VERIFY | ||
| tls_hostname | string | Expected TLS server name; defaults to DOCKER_TLS_HOSTNAME | ||
| ca_path | string | CA certificate file | ||
| client_cert | string | TLS client certificate | ||
| client_key | string | TLS client private key | ||
| use_ssh_client | bool | false | Select OpenSSH for SSH Docker transports | |
| debug | bool | false | Enable diagnostic mode |
Example
yaml
- name: Create a named volume for the database
docker_volume:
name: pgdata
state: present