From 42e9bc58dfe5202ea091d30169d96d4827efee4d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Herv=C3=A9=20=20MENAGER?= <herve.menager@pasteur.fr>
Date: Sat, 5 Aug 2017 23:20:41 +0200
Subject: [PATCH] ansible wip

Former-commit-id: 53715befb8b9dc36a5f79c90abcb6ddaf904108d
---
 .gitlab-ci.yml | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index af1fe9d4..51533893 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -14,10 +14,21 @@ test-centos7:
   - python3 manage.py test
 deploy-webserver:
   stage: deploy
+  before_script:
+    # install ssh-agent
+    - 'which ssh-agent || ( yum -y install openssh-clients )'
+    # run ssh-agent
+    - eval $(ssh-agent -s)
+    # add ssh key stored in SSH_PRIVATE_KEY variable to the agent store
+    - ssh-add <(echo "$SSH_PRIVATE_KEY")
+    # disable host key checking (NOTE: makes you susceptible to man-in-the-middle attacks)
+    # WARNING: use only in docker container, if you use it with shell you will overwrite your user's ssh config
+    - mkdir -p ~/.ssh
+    - echo -e "Host *\n\tStrictHostKeyChecking no\n\n" > ~/.ssh/config
   script:
     - yum install -y epel-release
     - yum install -y gcc
-    - yum install install -y python34-pip python34-devel
+    - yum install python34-pip python34-devel
     - pip3 install ansible
     - cd ansible
     - ansible-playbook -vvv -i ./hosts deploy.yaml --extra-vars "deploy_user_name=ippidb repo_api_token=JZS-4cH7bWkFkHa2rAVf"
\ No newline at end of file
-- 
GitLab