Create and use ansible.cfg for engine

ansible.cfg lets us configure various options such as ssh and others
and it makes sense to ship this together with engine rather than
asking users to modify ~/.ssh/config files or configure Jenkins slaves
in advance.

Created ansible.cfg file is taken from kubespray as it already ships
its own ansible.cfg.

By default, Ansible looks at various places for ansible.cfg so we place
engine ansible.cfg into root of engine repo and run all the playbooks
from there. It also helps us to get rid of StrictHostKeyChecking by
moving it to ansible.cfg.

Created ansible.cfg is only used for engine itself as other tools might
come with their own ansible.cfg as it can be seen for kubespray.

Change-Id: Ida201e0815858401f5adc23cc0936e23c6edaf87
diff --git a/ansible.cfg b/ansible.cfg
new file mode 100644
index 0000000..8082630
--- /dev/null
+++ b/ansible.cfg
@@ -0,0 +1,8 @@
+[ssh_connection]
+ssh_args = -o ControlMaster=auto -o ControlPersist=60m -o ConnectionAttempts=100 -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no
+[defaults]
+host_key_checking=False
+deprecation_warnings=False
+inventory_ignore_extensions = ~, .orig, .bak, .ini, .cfg, .retry, .pyc, .pyo, .creds
+[inventory]
+ignore_patterns = artifacts, credentials
diff --git a/engine/deploy.sh b/engine/deploy.sh
index 3985260..7a1b514 100755
--- a/engine/deploy.sh
+++ b/engine/deploy.sh
@@ -67,10 +67,10 @@
 #-------------------------------------------------------------------------------
 echo "Info: Bootstrapping hardware and software configuration"
 echo "-------------------------------------------------------------------------"
-cd ${ENGINE_PATH}/engine
+cd ${ENGINE_PATH}
 ansible-playbook ${ENGINE_ANSIBLE_PARAMS} \
   -i localhost, \
-  playbooks/bootstrap-configuration.yml
+  engine/playbooks/bootstrap-configuration.yml
 echo "-------------------------------------------------------------------------"
 
 #-------------------------------------------------------------------------------
diff --git a/engine/infra/bifrost/provision.sh b/engine/infra/bifrost/provision.sh
index bc065fa..69808d7 100755
--- a/engine/infra/bifrost/provision.sh
+++ b/engine/infra/bifrost/provision.sh
@@ -34,6 +34,7 @@
 if [[ "$BAREMETAL" != "true" ]]; then
   echo "Info: Create libvirt resources for virtual deployment"
   echo "-------------------------------------------------------------------------"
+  cd ${ENGINE_PATH}
   ansible-playbook ${ENGINE_ANSIBLE_PARAMS} \
     -i localhost, \
     ${BIFROST_ROOT_DIR}/playbooks/create-libvirt-resources.yml
@@ -43,6 +44,7 @@
 echo "-------------------------------------------------------------------------"
 echo "Info: Prepare bifrost installation and create bifrost inventory"
 echo "-------------------------------------------------------------------------"
+cd ${ENGINE_PATH}
 ansible-playbook ${ENGINE_ANSIBLE_PARAMS} \
   -i localhost, \
   ${BIFROST_ROOT_DIR}/playbooks/install-configure-bifrost.yml
diff --git a/engine/installer/kubespray/deploy.sh b/engine/installer/kubespray/deploy.sh
index 9d1d67a..af4121f 100755
--- a/engine/installer/kubespray/deploy.sh
+++ b/engine/installer/kubespray/deploy.sh
@@ -29,29 +29,28 @@
 echo "-------------------------------------------------------------------------"
 echo "Info: Configure target hosts"
 echo "-------------------------------------------------------------------------"
-cd ${ENGINE_PATH}/engine/installer/kubespray
+cd ${ENGINE_PATH}
 ansible-playbook ${ENGINE_ANSIBLE_PARAMS} \
-  --ssh-extra-args='-o StrictHostKeyChecking=no' \
   -i ${ENGINE_CACHE}/repos/bifrost/playbooks/inventory/bifrost_inventory.py \
-  playbooks/configure-targethosts.yml
+  ${INSTALLER_ROOT_DIR}/playbooks/configure-targethosts.yml
 
 # configure installer
 echo "-------------------------------------------------------------------------"
 echo "Info: Configure installer"
 echo "-------------------------------------------------------------------------"
-cd ${ENGINE_PATH}/engine/installer/kubespray
+cd ${ENGINE_PATH}
 ansible-playbook ${ENGINE_ANSIBLE_PARAMS} \
-  -i localhost, \
-  playbooks/configure-installer.yml
+  -i ${ENGINE_CACHE}/repos/bifrost/playbooks/inventory/bifrost_inventory.py \
+  ${INSTALLER_ROOT_DIR}/playbooks/configure-installer.yml
 
 # bootstrap scenario
 echo "-------------------------------------------------------------------------"
 echo "Info: Bootstrap scenario"
 echo "-------------------------------------------------------------------------"
-cd ${ENGINE_PATH}/engine/installer/kubespray
+cd ${ENGINE_PATH}
 ansible-playbook ${ENGINE_ANSIBLE_PARAMS} \
-  -i localhost, \
-  playbooks/bootstrap-scenario.yml
+  -i ${ENGINE_CACHE}/repos/bifrost/playbooks/inventory/bifrost_inventory.py \
+  ${INSTALLER_ROOT_DIR}/playbooks/bootstrap-scenario.yml
 
 # install Kubernetes scenario
 echo "-------------------------------------------------------------------------"
@@ -68,10 +67,9 @@
 echo "-------------------------------------------------------------------------"
 echo "Info: Running post deployment tasks"
 echo "-------------------------------------------------------------------------"
-cd ${ENGINE_PATH}/engine/installer/kubespray
+cd ${ENGINE_PATH}
 ansible-playbook ${ENGINE_ANSIBLE_PARAMS} \
-  --ssh-extra-args='-o StrictHostKeyChecking=no' \
   -i ${ENGINE_CACHE}/repos/kubespray/inventory/engine/bifrost_inventory.py \
-  playbooks/post-deployment.yml
+  ${INSTALLER_ROOT_DIR}/playbooks/post-deployment.yml
 
 # vim: set ts=2 sw=2 expandtab: