From 029de18d0bd3f4df95f1ae165b1c9c9733884fd0 Mon Sep 17 00:00:00 2001
From: Eduardo Gonzalez <dabarren@gmail.com>
Date: Fri, 28 Apr 2017 01:49:02 +0200
Subject: [PATCH] Add ssh-keyscan to unblock kolla-ansible gate

As a change to remove puppet from infra nodepool,
ssh-keyscan is needed for each node.[0]

Host key checking was disabled by default by jenkins
user. [1]

Refs:
[0] http://lists.openstack.org/pipermail/openstack-dev/2017-April/116036.html
[1] https://review.openstack.org/#/c/460731/
Change-Id: I0f4000f18b7a2b3266c95c3f7a5109e3603c94a7
---
 tools/setup_gate.sh | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/tools/setup_gate.sh b/tools/setup_gate.sh
index d0e6921e4..c5340d766 100755
--- a/tools/setup_gate.sh
+++ b/tools/setup_gate.sh
@@ -128,6 +128,7 @@ function setup_inventory {
         # wordround fix for the rabbitmq failed when deploy on CentOS in the CI
         # gate. the ideal fix should set the hostname in setup_gate.sh script.
         # But it do not work as expect with unknown reason
+        ssh-keyscan "${ip}" >> ~/.ssh/known_hosts
         echo -e "${ip}\tnode${counter}" >> /tmp/hosts
         echo -e "${ip}\t$(ssh ${ip} hostname)" >> /tmp/hosts
         echo "node${counter}" >> ${RAW_INVENTORY}
@@ -148,14 +149,16 @@ function setup_ansible {
 
     setup_inventory
 
-    # Record the running state of the environment as seen by the setup module
-    ansible all -i ${RAW_INVENTORY} -m setup > /tmp/logs/ansible/initial-setup
 
     sudo mkdir /etc/ansible
     sudo tee /etc/ansible/ansible.cfg<<EOF
 [defaults]
 callback_plugins = /usr/lib/python2.7/site-packages/ara/plugins/callbacks:\$VIRTUAL_ENV/lib/python2.7/site-packages/ara/plugins/callbacks
+host_key_checking = False
 EOF
+
+    # Record the running state of the environment as seen by the setup module
+    ansible all -i ${RAW_INVENTORY} -m setup > /tmp/logs/ansible/initial-setup
 }
 
 function setup_node {
-- 
GitLab