mirror of
https://github.com/iiab/iiab.git
synced 2025-03-09 15:40:17 +00:00
Move 19 roles into roles/0-DEPRECATED-ROLES
This commit is contained in:
parent
0e39c42bbd
commit
2218d2334b
124 changed files with 5 additions and 1 deletions
17
roles/0-DEPRECATED-ROLES/pathagar/defaults/main.yml
Normal file
17
roles/0-DEPRECATED-ROLES/pathagar/defaults/main.yml
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
---
|
||||
# variables for pathagar
|
||||
|
||||
pathagar_subpath: /books
|
||||
|
||||
pathagar_dir: /usr/local/pathagar
|
||||
pathagar_media: /library/pathagar/media
|
||||
pathagar_src: '{{ pathagar_dir }}/pathagar'
|
||||
pathagar_venv: '{{ pathagar_dir }}/venv'
|
||||
pathagar_collectstatic: '{{ pathagar_dir }}/static'
|
||||
|
||||
pathagar_db_name: pathagar
|
||||
pathagar_db_user: pathagar
|
||||
pathagar_db_password: pathagar
|
||||
|
||||
pathagar_username: pathagar
|
||||
pathagar_password: "pbkdf2_sha256$10000$qkA7MPkQWHTY$AO5j/ByLC68qEt8X1c9QvieArbadYKhiBnlKe8uR6G8="
|
||||
228
roles/0-DEPRECATED-ROLES/pathagar/tasks/main.yml
Normal file
228
roles/0-DEPRECATED-ROLES/pathagar/tasks/main.yml
Normal file
|
|
@ -0,0 +1,228 @@
|
|||
- name: "Set PostgreSQL vars 'postgresql_install: True' and 'postgresql_enabled: True'"
|
||||
set_fact:
|
||||
postgresql_install: True
|
||||
postgresql_enabled: True
|
||||
|
||||
- name: POSTGRESQL - run the 'postgresql' role
|
||||
include_role:
|
||||
name: postgresql
|
||||
|
||||
- name: Remove package Pathagar (in case rpm?)
|
||||
package:
|
||||
name: pathagar
|
||||
state: absent
|
||||
|
||||
- name: "Install Pathagar prerequisites: python-virtualenv, python-pip, python-psycopg2"
|
||||
package:
|
||||
name: "{{ item }}"
|
||||
state: present
|
||||
with_items:
|
||||
- python-virtualenv
|
||||
- python-pip
|
||||
- python-psycopg2
|
||||
|
||||
- name: "Install Pathagar prerequisites: libapache2-mod-wsgi, libxml2-dev, libxslt-dev (debuntu)"
|
||||
package:
|
||||
name: "{{ item }}"
|
||||
state: present
|
||||
with_items:
|
||||
- libapache2-mod-wsgi
|
||||
- libxml2-dev
|
||||
- libxslt-dev
|
||||
when: is_debuntu | bool
|
||||
|
||||
- name: "Install Pathagar prerequisites: mod_wsgi, libxml2-devel, libxslt-devel (not debuntu)"
|
||||
package:
|
||||
name: "{{ item }}"
|
||||
state: present
|
||||
with_items:
|
||||
- mod_wsgi
|
||||
- libxml2-devel
|
||||
- libxslt-devel
|
||||
when: not is_debuntu
|
||||
|
||||
- name: "Create destination folder: {{ pathagar_src }}"
|
||||
file:
|
||||
path: "{{ pathagar_src }}"
|
||||
state: directory
|
||||
# owner: root
|
||||
# group: root
|
||||
# mode: '0755'
|
||||
|
||||
- name: "Create books destination folder: {{ pathagar_media }}"
|
||||
file:
|
||||
path: "{{ pathagar_media }}"
|
||||
state: directory
|
||||
owner: "{{ apache_user }}"
|
||||
group: "{{ apache_user }}"
|
||||
mode: '0755'
|
||||
|
||||
- name: Determine if Pathagar has already been downloaded from git
|
||||
stat:
|
||||
path: "{{ pathagar_src }}/settings.py"
|
||||
register: pathagar
|
||||
|
||||
- name: Clone Pathagar repo
|
||||
git:
|
||||
repo: https://github.com/PathagarBooks/pathagar.git
|
||||
dest: "{{ pathagar_src }}"
|
||||
update: yes
|
||||
version: master
|
||||
when: internet_available and pathagar.stat.exists is defined and not pathagar.stat.exists
|
||||
|
||||
- name: Install Pathagar requirements in a virtualenv
|
||||
pip:
|
||||
name: "{{ item }}"
|
||||
with_items:
|
||||
- Django==1.4.5
|
||||
- django-tagging==0.3.1
|
||||
- django-sendfile==0.3.6
|
||||
- lxml==3.4.4
|
||||
when: internet_available | bool
|
||||
|
||||
- name: Install Pathagar requirements in a virtualenv
|
||||
pip:
|
||||
name: "{{ item }}"
|
||||
extra_args: "--use-wheel"
|
||||
virtualenv: "{{ pathagar_venv }}"
|
||||
virtualenv_site_packages: yes
|
||||
with_items:
|
||||
- django-taggit==0.14
|
||||
|
||||
- name: Create Pathagar postgresql user
|
||||
postgresql_user:
|
||||
name: "{{ pathagar_db_user }}"
|
||||
password: "{{ pathagar_db_password }}"
|
||||
role_attr_flags: NOSUPERUSER,NOCREATEROLE,NOCREATEDB
|
||||
state: present
|
||||
become: yes
|
||||
become_user: postgres
|
||||
|
||||
- name: Start 'postgresql-iiab' systemd service
|
||||
systemd:
|
||||
name: postgresql-iiab
|
||||
state: started
|
||||
enabled: yes
|
||||
when: pathagar_enabled
|
||||
|
||||
- name: Enable Pathagar postgresql user access by md5 method
|
||||
lineinfile:
|
||||
backup: yes
|
||||
dest: /library/pgsql-iiab/pg_hba.conf
|
||||
regexp: '^host\s+pathagar'
|
||||
line: "host pathagar pathagar samehost md5"
|
||||
state: present
|
||||
insertafter: "^# IPv4 local connections"
|
||||
owner: postgres
|
||||
group: postgres
|
||||
register: enable_pathagar_md5_access
|
||||
|
||||
- name: Reload 'postgresql-iiab' systemd service
|
||||
systemd:
|
||||
name: postgresql-iiab
|
||||
state: reloaded
|
||||
when: enable_pathagar_md5_access.changed
|
||||
|
||||
- name: Create Pathagar postgresql database
|
||||
postgresql_db:
|
||||
name: "{{ pathagar_db_name }}"
|
||||
encoding: utf8
|
||||
owner: "{{ pathagar_db_user }}"
|
||||
state: present
|
||||
template: template0
|
||||
become: yes
|
||||
become_user: postgres
|
||||
|
||||
- name: Install IIAB custom settings for Pathagar
|
||||
template:
|
||||
src: prod_settings.py
|
||||
dest: "{{ pathagar_src }}/prod_settings.py"
|
||||
# owner: root
|
||||
# group: root
|
||||
# mode: '0644'
|
||||
|
||||
- name: Create Pathagar initial db
|
||||
django_manage:
|
||||
app_path: "{{ pathagar_src }}"
|
||||
command: syncdb
|
||||
virtualenv: "{{ pathagar_venv }}"
|
||||
settings: pathagar.prod_settings
|
||||
|
||||
- name: Upload Pathagar admin user
|
||||
template:
|
||||
src: auth.User.json
|
||||
dest: "{{ pathagar_dir }}/auth.User.json"
|
||||
owner: root
|
||||
group: root
|
||||
mode: '0600'
|
||||
|
||||
- name: Load Pathagar admin user
|
||||
django_manage:
|
||||
app_path: "{{ pathagar_src }}"
|
||||
command: loaddata
|
||||
virtualenv: "{{ pathagar_venv }}"
|
||||
settings: pathagar.prod_settings
|
||||
fixtures: "{{ pathagar_dir }}/auth.User.json"
|
||||
|
||||
- name: Collect Pathagar static files
|
||||
django_manage:
|
||||
app_path: "{{ pathagar_src }}"
|
||||
command: collectstatic
|
||||
virtualenv: "{{ pathagar_venv }}"
|
||||
settings: pathagar.prod_settings
|
||||
|
||||
- name: Install wsgi.py for Pathagar
|
||||
template:
|
||||
src: wsgi.py
|
||||
dest: "{{ pathagar_dir }}/wsgi.py"
|
||||
# owner: root
|
||||
# group: root
|
||||
# mode: '0644'
|
||||
|
||||
- name: Install /etc/{{ apache_config_dir }}/pathagar.conf from template
|
||||
template:
|
||||
src: pathagar.conf
|
||||
backup: yes
|
||||
dest: "/etc/{{ apache_config_dir }}/pathagar.conf"
|
||||
mode: 0644
|
||||
|
||||
- name: Enable Pathagar via Apache (debuntu)
|
||||
file:
|
||||
path: /etc/apache2/sites-enabled/pathagar.conf
|
||||
src: /etc/apache2/sites-available/pathagar.conf
|
||||
state: link
|
||||
when: pathagar_enabled and is_debuntu
|
||||
|
||||
- name: Disable Pathagar via Apache (debuntu)
|
||||
file:
|
||||
path: /etc/apache2/sites-enabled/pathagar.conf
|
||||
state: absent
|
||||
when: not pathagar_enabled and is_debuntu
|
||||
|
||||
- name: Reload '{{ apache_service }}' systemd service
|
||||
systemd:
|
||||
name: "{{ apache_service }}"
|
||||
state: reloaded
|
||||
|
||||
# if the only service using the backend db disable if not running
|
||||
- name: Disable 'postgresql-iiab' systemd service, if not moodle_enabled and not pathagar_enabled
|
||||
systemd:
|
||||
name: postgresql-iiab
|
||||
state: stopped
|
||||
enabled: no
|
||||
when: not moodle_enabled and not pathagar_enabled
|
||||
|
||||
|
||||
- name: Add 'pathagar' variable values to {{ iiab_ini_file }}
|
||||
ini_file:
|
||||
path: "{{ iiab_ini_file }}"
|
||||
section: pathagar
|
||||
option: "{{ item.option }}"
|
||||
value: "{{ item.value | string }}"
|
||||
with_items:
|
||||
- option: name
|
||||
value: pathagar
|
||||
- option: description
|
||||
value: '"Pathagar is a simple bookserver serving OPDS feeds"'
|
||||
- option: path
|
||||
value: /books
|
||||
20
roles/0-DEPRECATED-ROLES/pathagar/templates/auth.User.json
Normal file
20
roles/0-DEPRECATED-ROLES/pathagar/templates/auth.User.json
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
[
|
||||
{
|
||||
"pk": 1,
|
||||
"model": "auth.user",
|
||||
"fields": {
|
||||
"username": "{{ pathagar_username }}",
|
||||
"first_name": "",
|
||||
"last_name": "",
|
||||
"is_active": true,
|
||||
"is_superuser": true,
|
||||
"is_staff": true,
|
||||
"last_login": "2013-11-12T05:06:17.207",
|
||||
"groups": [],
|
||||
"user_permissions": [],
|
||||
"password": "{{ pathagar_password }}",
|
||||
"email": "{{ pathagar_username }}@{{ iiab_hostname }}.{{ iiab_domain }}",
|
||||
"date_joined": "2013-11-12T05:06:17.207"
|
||||
}
|
||||
}
|
||||
]
|
||||
30
roles/0-DEPRECATED-ROLES/pathagar/templates/pathagar.conf
Normal file
30
roles/0-DEPRECATED-ROLES/pathagar/templates/pathagar.conf
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
|
||||
Alias {{ pathagar_subpath }}/static/ {{ pathagar_collectstatic }}/
|
||||
Alias {{ pathagar_subpath }}/static_media/ {{ pathagar_media }}/
|
||||
|
||||
<Directory {{ pathagar_collectstatic }}>
|
||||
Order deny,allow
|
||||
Allow from all
|
||||
Require all granted
|
||||
</Directory>
|
||||
|
||||
<Directory {{ pathagar_media }}>
|
||||
Order deny,allow
|
||||
Allow from all
|
||||
Require all granted
|
||||
</Directory>
|
||||
|
||||
WSGIPythonPath {{ pathagar_dir }}:{{ pathagar_venv }}/lib/python2.7/site-packages
|
||||
WSGIScriptAlias {{ pathagar_subpath }} {{ pathagar_dir }}/wsgi.py
|
||||
|
||||
<Directory {{ pathagar_dir }}>
|
||||
<Files wsgi.py>
|
||||
Order allow,deny
|
||||
Allow from all
|
||||
Require all granted
|
||||
</Files>
|
||||
</Directory>
|
||||
|
||||
|
||||
CustomLog /var/log/{{ apache_service }}/pathagar-access.log combined
|
||||
ServerSignature On
|
||||
22
roles/0-DEPRECATED-ROLES/pathagar/templates/prod_settings.py
Normal file
22
roles/0-DEPRECATED-ROLES/pathagar/templates/prod_settings.py
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
from settings import *
|
||||
|
||||
FORCE_SCRIPT_NAME = '{{ pathagar_subpath }}'
|
||||
LOGIN_REDIRECT_URL = FORCE_SCRIPT_NAME
|
||||
|
||||
MEDIA_ROOT = '{{ pathagar_media }}'
|
||||
MEDIA_URL = '{{ pathagar_subpath }}/static_media/'
|
||||
|
||||
SECRET_KEY = '7ks@b7+gi^c4adff)6ka228#rd4f62v*g_dtmo*@i62k)qn=cs'
|
||||
DATABASES = {
|
||||
'default': {
|
||||
'ENGINE':'django.db.backends.postgresql_psycopg2',
|
||||
'NAME': '{{ pathagar_db_name }}',
|
||||
'USER': '{{ pathagar_db_user }}',
|
||||
'PASSWORD': '{{ pathagar_db_password }}',
|
||||
'HOST': '127.0.0.1',
|
||||
'PORT': '5432',
|
||||
}
|
||||
}
|
||||
|
||||
STATIC_ROOT = '{{ pathagar_collectstatic }}'
|
||||
STATIC_URL = '{{ pathagar_subpath }}/static/'
|
||||
11
roles/0-DEPRECATED-ROLES/pathagar/templates/wsgi.py
Normal file
11
roles/0-DEPRECATED-ROLES/pathagar/templates/wsgi.py
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
"""
|
||||
WSGI config for pathagar project.
|
||||
|
||||
It exposes the WSGI callable as a module-level variable named ``application``.
|
||||
"""
|
||||
|
||||
import os
|
||||
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "pathagar.prod_settings")
|
||||
|
||||
from django.core.wsgi import get_wsgi_application
|
||||
application = get_wsgi_application()
|
||||
Loading…
Add table
Add a link
Reference in a new issue