Add role for backend

This commit is contained in:
nemunaire 2016-12-04 18:52:53 +01:00
parent 4a625bf3eb
commit 89120bdaef
5 changed files with 72 additions and 0 deletions

View File

@ -4,4 +4,5 @@
hosts: all
roles:
- nrpe
- fic-backend
- fic-frontend

View File

@ -0,0 +1 @@
../../../../backend/backend

View File

@ -0,0 +1,12 @@
[Unit]
Description=FIC Backend service
After=mysql.service
[Service]
User=fic
Group=nogroup
WorkingDirectory=/home/fic
ExecStart=/home/fic/backend -unlockedChallenges -teams ./TEAMS -submission ./submissions
[Install]
WantedBy=multi-user.target

View File

@ -0,0 +1 @@
../../../../admin/static/

View File

@ -0,0 +1,57 @@
---
- name: install mysql
apt: name=mariadb-server
- name: create fic user
user:
name=fic
home=/home/fic
group=nogroup
- name: copy backend binary
copy:
src=backend
mode=755
dest=/home/fic/backend
- name: copy admin htdocs
copy:
src=static/
dest=/home/fic/admin-htdocs
- name: copy admin binary
copy:
src=admin
mode=755
dest=/home/fic/admin
- name: enable and start mysql daemon
service: name=mysql enabled=yes state=started
- name: create fic database
mysql_db:
name=fic
state=present
- name: create fic user
mysql_user:
name=fic
password=fic
priv=fic.*:ALL
state=present
- name: add backend service
copy:
src=backend.service
dest=/lib/systemd/system/fic-backend.service
- name: reload systemd
command: systemctl daemon-reload
- name: enable and start fic-backend
service:
name=fic-backend
enabled=yes
state=started