From 2c564eb187c6d38ef8803188e5f4f28c6324fea6 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Herv=C3=A9=20=20MENAGER?= <herve.menager@pasteur.fr>
Date: Thu, 3 Aug 2017 15:13:09 +0200
Subject: [PATCH] WIP ansible, disable apache service and handle ippidb service

Former-commit-id: c5dbe4d46b015442f0f482d4d969ea7e833eb52b
---
 ansible/deploy.yaml | 20 ++++++++++++++------
 1 file changed, 14 insertions(+), 6 deletions(-)

diff --git a/ansible/deploy.yaml b/ansible/deploy.yaml
index 595edc4a..50fb69b7 100644
--- a/ansible/deploy.yaml
+++ b/ansible/deploy.yaml
@@ -1,19 +1,18 @@
 ---
 - hosts: all
   become: yes
-  become_user: ippidb
   gather_facts: no
   tasks:
+  - name: stop "generic" httpd service if relevant
+    systemd: state=stopped name=httpd
+  - name: stop iPPIDB service if relevant
+    systemd: state=stopped name=ippidb-web
   - name: pull branch master
+    become_user: ippidb
     git:
       repo=git@gitlab.pasteur.fr:odoppelt/iPPIDB.git
       dest=/home/ippidb/iPPIDB
       accept_hostkey=yes
-
-- hosts: all
-  become: yes
-  gather_facts: no
-  tasks:
   - name: install python requirements
     pip: requirements=/home/ippidb/iPPIDB/ippisite/requirements.txt extra_args=--upgrade executable=pip3
   - name: collect static files
@@ -24,3 +23,12 @@
     django_manage:
       command: "runmodwsgi --setup-only --port=80 --user ippidb --group wheel --server-root=/etc/ippidb-80"
       app_path: "/home/ippidb/iPPIDB/ippisite"
+  - name: copy systemd service file for IPPIDB-web
+    copy: 
+      remote_src: true
+      src: /home/ippidb/iPPIDB/ansible/ippidb-web.service 
+      dest: /lib/systemd/system/ippidb-web.service
+      owner: root
+      group: root
+  - name: start iPPIDB service if relevant
+    systemd: state=started name=ippidb-web enabled=true
-- 
GitLab