Commit a0f695a9 authored by rexxnor's avatar rexxnor

updated playbook

parent bb816f16
---
- name: Install PPM with MariaDB
hosts: prepaidmatedb
become: True
become: true
tasks:
- name: Install required packages
apt:
name: [mariadb-server, python3-mysqldb, python3-dev, libmysqlclient-dev, apache2, libapache2-mod-wsgi-py3, python3-venv, git, virtualenv]
name: [mariadb-server, python3-mysqldb, python3-dev,
default-libmysqlclient-dev, apache2, libapache2-mod-wsgi-py3,
python3-venv, git, virtualenv, build-essential, python3-pymysql]
state: present
update_cache: yes
update_cache: true
- name: Clone repository
git:
repo: https://git.chaostreffbern.ch/rexxnor/prepaid-mate-website
dest: /var/www/html/ppm/
force: yes
- name: Install Virtualenv and requirements.txt
pip:
requirements: /var/www/html/ppm/requirements.txt
virtualenv: /var/www/prepaidmatevenv/
virtualenv_python: python3
ignore_errors: yes
requirements: /var/www/html/ppm/requirements.txt
virtualenv: /var/www/prepaidmatevenv/
virtualenv_python: python3
- name: Adding prepaidmate config for apache
template:
src: templates/prepaidmate.conf.j2
......@@ -37,7 +39,7 @@
systemd:
name: apache2
state: restarted
enabled: yes
enabled: true
- name: Activate apache2 site for Prepaidmate
file:
src: /etc/apache2/sites-available/prepaidmate.conf
......@@ -48,7 +50,7 @@
dest: /var/www/html/
owner: www-data
group: www-data
recurse: yes
recurse: true
- name: Generating run secret with script
shell: bash gen_safe_secret.sh
args:
......@@ -58,7 +60,7 @@
systemd:
name: mariadb
state: started
enabled: yes
enabled: true
- name: Creating prepaidmate database
mysql_db:
name: prepaidmate
......@@ -94,13 +96,10 @@
virtualenv: /var/www/prepaidmatevenv/
command: collectstatic
app_path: /var/www/html/ppm/prepaidmatewebsite/
- name: Django - Create database by migrations
django_manage:
virtualenv: /var/www/prepaidmatevenv/
command: migrate
app_path: /var/www/html/ppm/prepaidmatewebsite/
- name: Django - Apply database migrations
shell: "/var/www/prepaidmatevenv/bin/python /var/www/html/ppm/prepaidmatewebsite/manage.py migrate --fake-initial"
- name: Restarting apache and enabling it
systemd:
name: apache2
state: reloaded
enabled: yes
enabled: true
......@@ -93,6 +93,7 @@ DATABASES = {
'NAME': 'prepaidmate',
'ENGINE': 'django.db.backends.mysql',
'OPTIONS': {
'init_command': "SET sql_mode='STRICT_TRANS_TABLES'",
'read_default_file': '/var/www/prepaidmatevenv/.my.cnf',
},
}
......
......@@ -8,8 +8,11 @@ drf-generators==0.3.0
Jinja2==2.10
MarkupSafe==1.1.0
mysqlclient==1.3.13
pathspec==0.5.9
py-moneyed==0.7.0
PyMySQL==0.9.3
pytz==2018.7
PyYAML==3.13
six==1.11.0
spidev==3.2
typed-ast==1.1.0
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment