From 32b3ec04119715d5a978ae2629925eb08ae6a8c1 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 10:51:44 +0200 Subject: [PATCH] WIP on ansible Former-commit-id: 0c0564f2c9c7cb3aee721c8b1200505c3045ffcc --- ansible/deploy.yaml | 29 ++++------------------------- ansible/system.yaml | 24 +++++++++++++++++++----- 2 files changed, 23 insertions(+), 30 deletions(-) diff --git a/ansible/deploy.yaml b/ansible/deploy.yaml index 79881e35..01df34c9 100644 --- a/ansible/deploy.yaml +++ b/ansible/deploy.yaml @@ -16,28 +16,7 @@ tasks: - name: install python requirements pip: requirements=/home/ippidb/iPPIDB/ippisite/requirements.txt extra_args=--upgrade executable=pip3 - -- hosts: all - become: yes - become_user: ippidb - gather_facts: no - #environment: - #DJANGO_SETTINGS_MODULE: "{{ django_project }}.settings.production" - #DATABASE_URL: postgres://{{ dbuser }}:{{ dbpassword }}@localhost/{{ dbname }} - #STATIC_ROOT: "{{ static_dir }}" - - tasks: - - name: create static_root dir - file: path={{ static_dir }} state=directory mode=0755 - - name: django collectstatic - shell: ./manage.py collectstatic --noinput chdir={{ django_dir }} - - name: django migrate - shell: ./manage.py migrate --noinput chdir={{ django_dir }} - - name: django loaddata - shell: ./manage.py loaddata user chdir={{ django_dir }} - -- hosts: all - gather_facts: no - tasks: - - name: uwsgi restart - service: name=uwsgi state=restarted + - name: create mod_wsgi configuration + django_manage: + command: "runmodwsgi --setup-only --port=80 --user ippidb --group wheel --server-root=/etc/ippidb-80" + app_path: "/home/ippidb/iPPIDB/ippisite" diff --git a/ansible/system.yaml b/ansible/system.yaml index 94f5aac1..446f229d 100644 --- a/ansible/system.yaml +++ b/ansible/system.yaml @@ -5,11 +5,6 @@ - name: Create {{ deploy_user_name }} user user: name={{ deploy_user_name }} generate_ssh_key=yes ssh_key_bits=2048 ssh_key_file=.ssh/id_rsa become: true - #- name: Read SSH public key - # slurp: src=/home/ippidb/.ssh/id_rsa.pub - # register: public_key - # become: true - #- debug: msg="{{ public_key['content'] | b64decode }}" - name: install git yum: name=git state=present become: true @@ -20,6 +15,16 @@ description: EPEL YUM repo gpgcheck: no baseurl: https://download.fedoraproject.org/pub/epel/$releasever/$basearch/ + - name: disable SELinux + become: true + selinux: + state: disabled + - name: Open firewall to HTTP traffic + firewalld: + service: http + permanent: true + state: enabled + become: true - name: install python3 yum: name=python34 state=present update_cache=yes become: true @@ -35,6 +40,15 @@ - name: install graphviz yum: name=graphviz state=present update_cache=yes become: true + - name: install httpd + yum: name=httpd state=present update_cache=yes + become: true + - name: install httpd-devel + yum: name=httpd-devel state=present update_cache=yes + become: true + - name: install mod_wsgi + pip: name=mod_wsgi extra_args=--upgrade executable=pip3 + become: true - name: install graphviz-devel yum: name=graphviz-devel state=present update_cache=yes become: true -- GitLab