From b3d1fe6630d2415629dc581766e2a98877aa4796 Mon Sep 17 00:00:00 2001 From: Malpractis <31232305+Malpractis@users.noreply.github.com> Date: Thu, 23 Jan 2020 08:37:39 +1100 Subject: [PATCH] add check and remove for docker-py --- tasks/docker.yml | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/tasks/docker.yml b/tasks/docker.yml index 7ec0ab6f..8ac88ecb 100644 --- a/tasks/docker.yml +++ b/tasks/docker.yml @@ -5,6 +5,19 @@ state: present register: result until: result is succeeded + +- name: 'Check if docker-py is installed' + shell: pip3 show docker-py + ignore_errors: true + register: docker_py_check + +- name: 'Remove docker-py if installed' + pip: + name: docker-py + state: absent + when: docker_py_check.stdout.find('docker-py') != -1 + register: result + until: result is succeeded - name: 'Install docker python module' pip: