mirror of https://gitlab.crans.org/bde/nk20
Install PSQL and init DB
This commit is contained in:
parent
3f0208a664
commit
084d22d33f
|
@ -1,9 +1,10 @@
|
||||||
#!/usr/bin/env ansible-playbook
|
#!/usr/bin/env ansible-playbook
|
||||||
---
|
---
|
||||||
|
|
||||||
- hosts: bde-nk20-beta.adh.crans.org
|
- hosts: dt.adh.crans.org
|
||||||
roles:
|
roles:
|
||||||
- 1-apt-basic
|
- 1-apt-basic
|
||||||
- 2-nk20
|
- 2-nk20
|
||||||
- 3-pip
|
- 3-pip
|
||||||
- 4-nginx
|
- 4-nginx
|
||||||
|
- 5-psql
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
[server]
|
[server]
|
||||||
bde-nk20-beta.adh.crans.org
|
dt.adh.crans.org
|
||||||
|
|
||||||
[all:vars]
|
[all:vars]
|
||||||
ansible_python_interpreter=/usr/bin/python3
|
ansible_python_interpreter=/usr/bin/python3
|
||||||
|
|
|
@ -13,6 +13,7 @@
|
||||||
dest: /var/www/note_kfet
|
dest: /var/www/note_kfet
|
||||||
version: beta-soon
|
version: beta-soon
|
||||||
track_submodules: yes
|
track_submodules: yes
|
||||||
|
force: true
|
||||||
|
|
||||||
- name: Update permissions for note_kfet dir
|
- name: Update permissions for note_kfet dir
|
||||||
file:
|
file:
|
||||||
|
|
|
@ -4,9 +4,11 @@
|
||||||
requirements: /var/www/note_kfet/requirements/base.txt
|
requirements: /var/www/note_kfet/requirements/base.txt
|
||||||
virtualenv: /var/www/note_kfet/env
|
virtualenv: /var/www/note_kfet/env
|
||||||
virtualenv_command: /usr/bin/python3 -m venv
|
virtualenv_command: /usr/bin/python3 -m venv
|
||||||
|
become_user: www-data
|
||||||
|
|
||||||
- name: Install PIP production dependencies
|
- name: Install PIP production dependencies
|
||||||
pip:
|
pip:
|
||||||
requirements: /var/www/note_kfet/requirements/production.txt
|
requirements: /var/www/note_kfet/requirements/production.txt
|
||||||
virtualenv: /var/www/note_kfet/env
|
virtualenv: /var/www/note_kfet/env
|
||||||
virtualenv_command: /usr/bin/python3 -m venv
|
virtualenv_command: /usr/bin/python3 -m venv
|
||||||
|
become_user: www-data
|
||||||
|
|
|
@ -19,3 +19,13 @@
|
||||||
src: /var/www/note_kfet/uwsgi_note.ini
|
src: /var/www/note_kfet/uwsgi_note.ini
|
||||||
dest: /etc/uwsgi/apps-enabled/uwsgi_note.ini
|
dest: /etc/uwsgi/apps-enabled/uwsgi_note.ini
|
||||||
state: link
|
state: link
|
||||||
|
|
||||||
|
- name: Reload Nginx
|
||||||
|
systemd:
|
||||||
|
name: nginx
|
||||||
|
state: reloaded
|
||||||
|
|
||||||
|
- name: Restart UWSGI
|
||||||
|
systemd:
|
||||||
|
name: uwsgi
|
||||||
|
state: restarted
|
||||||
|
|
|
@ -0,0 +1,27 @@
|
||||||
|
---
|
||||||
|
- name: Install PostgreSQL APT packages
|
||||||
|
apt:
|
||||||
|
update_cache: true
|
||||||
|
name:
|
||||||
|
- postgresql
|
||||||
|
- postgresql-contrib
|
||||||
|
- libpq-dev
|
||||||
|
register: pkg_result
|
||||||
|
retries: 3
|
||||||
|
until: pkg_result is succeeded
|
||||||
|
|
||||||
|
- name: Install Psycopg2
|
||||||
|
pip:
|
||||||
|
name: psycopg2-binary
|
||||||
|
|
||||||
|
- name: Create role note
|
||||||
|
postgresql_user:
|
||||||
|
name: note
|
||||||
|
password: note # Fix it!
|
||||||
|
become_user: postgres
|
||||||
|
|
||||||
|
- name: Create NK20 database
|
||||||
|
postgresql_db:
|
||||||
|
name: note_db
|
||||||
|
owner: note
|
||||||
|
become_user: postgres
|
Loading…
Reference in New Issue