From a48856a9604b8cec7aeba8118425efa478a3e5fe Mon Sep 17 00:00:00 2001 From: TheTechromancer Date: Mon, 11 Dec 2023 21:28:29 -0500 Subject: [PATCH] don't try to install docker if it's already installed --- bbot/modules/deadly/dastardly.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/bbot/modules/deadly/dastardly.py b/bbot/modules/deadly/dastardly.py index 471314f1c..8face65ab 100644 --- a/bbot/modules/deadly/dastardly.py +++ b/bbot/modules/deadly/dastardly.py @@ -10,11 +10,17 @@ class dastardly(BaseModule): deps_pip = ["lxml~=4.9.2"] deps_ansible = [ + { + "name": "Check if Docker is already installed", + "command": "docker --version", + "register": "docker_installed", + "ignore_errors": True, + }, { "name": "Install Docker (Non-Debian)", "package": {"name": "docker", "state": "present"}, "become": True, - "when": "ansible_facts['os_family'] != 'Debian'", + "when": "ansible_facts['os_family'] != 'Debian' and docker_installed.rc != 0", }, { "name": "Install Docker (Debian)", @@ -23,7 +29,7 @@ class dastardly(BaseModule): "state": "present", }, "become": True, - "when": "ansible_facts['os_family'] == 'Debian'", + "when": "ansible_facts['os_family'] == 'Debian' and docker_installed.rc != 0", }, ] per_host_only = True