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 00000000000..968ddc31036 --- /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 3403ec085ef..f1f480e7e81 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