Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add renew_anon_volumes parameter to docker compose up #977

Merged
merged 5 commits into from
Oct 19, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions plugins/modules/docker_compose_v2.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,12 @@
- always
- never
- auto
renew_anon_volumes:
description:
- Whether to recreate instead of reuse anonymous volumes from previous containers
- V(true) is equivalent to the C(--renew-anon-volumes) or C(-V) option of C(docker compose up)
z-bsod marked this conversation as resolved.
Show resolved Hide resolved
type: bool
default: false
z-bsod marked this conversation as resolved.
Show resolved Hide resolved
remove_images:
description:
- Use with O(state=absent) to remove all images or only local images.
Expand Down Expand Up @@ -437,6 +443,7 @@ def __init__(self, client):
self.remove_images = parameters['remove_images']
self.remove_volumes = parameters['remove_volumes']
self.remove_orphans = parameters['remove_orphans']
self.renew_anon_volumes = parameters['renew_anon_volumes']
self.timeout = parameters['timeout']
self.services = parameters['services'] or []
self.scale = parameters['scale'] or {}
Expand Down Expand Up @@ -479,6 +486,8 @@ def get_up_cmd(self, dry_run, no_start=False):
args.append('--force-recreate')
if self.recreate == 'never':
args.append('--no-recreate')
if self.renew_anon_volumes:
args.append('--renew-anon-volumes')
if not self.dependencies:
args.append('--no-deps')
if self.timeout is not None:
Expand Down Expand Up @@ -621,6 +630,7 @@ def main():
pull=dict(type='str', choices=['always', 'missing', 'never', 'policy'], default='policy'),
build=dict(type='str', choices=['always', 'never', 'policy'], default='policy'),
recreate=dict(type='str', default='auto', choices=['always', 'never', 'auto']),
renew_anon_volumes=dict(type='bool',default=False),
z-bsod marked this conversation as resolved.
Show resolved Hide resolved
remove_images=dict(type='str', choices=['all', 'local']),
remove_volumes=dict(type='bool', default=False),
remove_orphans=dict(type='bool', default=False),
Expand Down
Loading