From 3b7ab63a19b4836e399a422e153770425e88d2d7 Mon Sep 17 00:00:00 2001
From: Eduardo Gonzalez <dabarren@gmail.com>
Date: Thu, 29 Jun 2017 09:18:33 +0100
Subject: [PATCH] Fix prechecks fail with docker not in deployment host

This changes only evaluates baremetal host group
to look for docker versions.

Change-Id: I64a7314b332958d003f88a00aa73ba79a760a051
Closes-Bug: #1700986
---
 ansible/roles/prechecks/tasks/package_checks.yml | 1 +
 ansible/roles/prechecks/tasks/service_checks.yml | 1 +
 2 files changed, 2 insertions(+)

diff --git a/ansible/roles/prechecks/tasks/package_checks.yml b/ansible/roles/prechecks/tasks/package_checks.yml
index 4da8264afd..35b78bcab9 100644
--- a/ansible/roles/prechecks/tasks/package_checks.yml
+++ b/ansible/roles/prechecks/tasks/package_checks.yml
@@ -3,6 +3,7 @@
   command: "{{ ansible_python.executable }} -c \"import docker; print docker.__version__\""
   register: result
   changed_when: false
+  when: inventory_hostname in groups['baremetal']
   failed_when: result | failed or
                result.stdout | version_compare(docker_py_version_min, '<')
 
diff --git a/ansible/roles/prechecks/tasks/service_checks.yml b/ansible/roles/prechecks/tasks/service_checks.yml
index 79614881e7..c05b317234 100644
--- a/ansible/roles/prechecks/tasks/service_checks.yml
+++ b/ansible/roles/prechecks/tasks/service_checks.yml
@@ -3,6 +3,7 @@
   command: docker version
   register: result
   changed_when: false
+  when: inventory_hostname in groups['baremetal']
   failed_when: result | failed
                or (result.stdout | from_yaml).Server.Version | regex_replace('(\\d+\\.\\d+\\.\\d+).*', '\\1') | version_compare(docker_version_min, '<')