diff --git a/changelogs/fragments/docker_volume-force-change-detection.yaml b/changelogs/fragments/docker_volume-force-change-detection.yaml new file mode 100644 index 0000000000..968ddc3103 --- /dev/null +++ b/changelogs/fragments/docker_volume-force-change-detection.yaml @@ -0,0 +1,2 @@ +bugfixes: +- "docker_volume - fix ``force`` and change detection logic. If not both evaluated to ``True``, the volume was not recreated." diff --git a/lib/ansible/modules/cloud/docker/docker_volume.py b/lib/ansible/modules/cloud/docker/docker_volume.py index 3403ec085e..f1f480e7e8 100644 --- a/lib/ansible/modules/cloud/docker/docker_volume.py +++ b/lib/ansible/modules/cloud/docker/docker_volume.py @@ -223,7 +223,7 @@ class DockerVolumeManager(object): if self.existing_volume: differences = self.has_different_config() - if differences and self.parameters.force: + if differences or self.parameters.force: self.remove_volume() self.existing_volume = None