diff --git a/plugins/module_utils/podman/podman_container_lib.py b/plugins/module_utils/podman/podman_container_lib.py index efecc30a..bb2bc95a 100644 --- a/plugins/module_utils/podman/podman_container_lib.py +++ b/plugins/module_utils/podman/podman_container_lib.py @@ -1791,7 +1791,11 @@ def make_started(self): self.update_container_result() return if self.container.exists and self.restart: - if self.container.running: + if self.container.different: + self.container.recreate_run() + self.results['actions'].append('recreated %s' % + self.container.name) + elif self.container.running: self.container.restart() self.results['actions'].append('restarted %s' % self.container.name) @@ -1808,13 +1812,8 @@ def make_started(self): self.container.name) self.update_container_result() return - elif self.container.running and not self.container.different: - if self.restart: - self.container.restart() - self.results['actions'].append('restarted %s' % - self.container.name) - self.update_container_result() - return + elif self.container.running and not self.container.different \ + and not self.restart: self.update_container_result(changed=False) return elif not self.container.exists: