publik-devinst/roles/base/tasks/main.yml

212 lines
4.6 KiB
YAML

---
- name: Install system packages dependencies
apt:
name:
- acl
- gettext
- graphicsmagick
- graphviz
- inkscape
- libjs-leaflet
- libldap2-dev
- libmagic1
- libpq-dev
- libreoffice
- libsasl2-dev
- libssl-dev
- libsystemd-dev
- make
- memcached
- nginx
- pkg-config
- postgresql
- python3-apt
- python3-dev
- python3-lasso
- python3-pip
- python3-psycopg2
- python3-uwsgidecorators
- rabbitmq-server
- sassc
- supervisor
- uwsgi
- uwsgi-plugin-python3
- virtualenv
state: present
become: yes
- name: "create the postgresql user named {{user}}"
postgresql_user:
name: "{{user}}"
role_attr_flags: SUPERUSER,LOGIN
port: "{{postgresql_port}}"
become: yes
become_user: postgres
- name: clean the virtualenv
file:
path: "{{venv_py3}}"
state: absent
when: clean_venv
- name: create the virtualenvs and install django
pip:
name: django
version: "{{django_version}}"
virtualenv: "{{venv_py3}}"
virtualenv_python: "python3"
- name: install django-debug-toolbar
pip:
name: "django-debug-toolbar<3"
virtualenv: "{{venv_py3}}"
- name: install pytest
pip:
name: pytest
virtualenv: "{{venv_py3}}"
- name: "create {{src_dir}} directory"
file:
path: "{{src_dir}}"
state: directory
owner: "{{user}}"
group: "{{user}}"
- name: "create misc directory"
file:
path: "{{venv_py3}}/misc"
state: directory
- name: "create conf directory"
file:
path: "{{publik_conf}}"
state: directory
- name: "create settings directory"
file:
path: "{{publik_settings}}"
state: directory
- name: "create base run directory"
file:
path: "{{base_run_dir}}"
state: directory
- name: create getlasso scripts
template:
src: getlasso.j2
dest: "{{venv_py3_bin}}/getlasso.sh"
mode: "u=rwx,g=rx,o=rx"
vars:
virtualenv_python: "{{venv_py3_python}}"
system_python: "/usr/bin/python3"
- name: execute getlasso
command: "{{venv_py3_bin}}/getlasso.sh"
- name: clean psycopg2 pip installation
ansible.builtin.pip:
name:
- psycopg2-binary
- psycopg2
state: absent
virtualenv: "{{venv_py3}}"
- name: create getpsycopg2 scripts
ansible.builtin.template:
src: getpsycopg2.j2
dest: "{{venv_py3_bin}}/getpsycopg2.sh"
mode: "u=rwx,g=rx,o=rx"
vars:
virtualenv_python: "{{venv_py3_python}}"
- name: execute getpsycopg2
ansible.builtin.command: "{{venv_py3_bin}}/getpsycopg2.sh"
- name: create get-uwsgidecorators scripts
template:
src: get-uwsgidecorators.j2
dest: "{{venv_py3_bin}}/get-uwsgidecorators.sh"
mode: "u=rwx,g=rx,o=rx"
vars:
virtualenv_python: "{{venv_py3_python}}"
system_python: "/usr/bin/python3"
- name: execute get-uwsgidecorators
command: "{{venv_py3_bin}}/get-uwsgidecorators.sh"
- name: source install eopayment
include_tasks: install_source.yml
vars:
repo: "eopayment"
repo_dir: "{{ src_dir }}/eopayment"
virtualenv: "{{venv_py3}}"
- name: source install django-tenant-schemas
include_tasks: install_source.yml
vars:
repo: "debian/django-tenant-schemas"
repo_dir: "{{ src_dir }}/django-tenant-schemas"
virtualenv: "{{venv_py3}}"
- name: source install django-mellon
include_tasks: install_source.yml
vars:
repo: "django-mellon"
repo_dir: "{{ src_dir }}/django-mellon"
virtualenv: "{{venv_py3}}"
- name: source install gadjo
include_tasks: install_source.yml
vars:
repo: "gadjo"
repo_dir: "{{ src_dir }}/gadjo"
virtualenv: "{{venv_py3}}"
- name: install python-memcached
pip:
name: python-memcached
virtualenv: "{{venv_py3}}"
- name: source install django-ckeditor
include_tasks: install_source.yml
vars:
repo: "debian/django-ckeditor"
repo_dir: "{{ src_dir }}/django-ckeditor"
virtualenv: "{{venv_py3}}"
- name: install theme
import_tasks: tasks/install_theme.yml
vars:
src_theme_dir: "{{src_dir}}/{{theme_repo}}"
tags:
- theme
- name: create cert directory
file:
path: "{{certs_dir}}"
state: directory
become: yes
tags:
- tls
- name: Download fullchain.pem
get_url:
url: https://doc-publik.entrouvert.com/media/certificates/dev.publik.love/fullchain.pem
dest: "{{certs_dir}}/dev.publik.love-fullchain.pem"
force: yes
become: yes
tags:
- tls
- name: Download privkey.pem
get_url:
url: https://doc-publik.entrouvert.com/media/certificates/dev.publik.love/privkey.pem
dest: "{{certs_dir}}/dev.publik.love-privkey.pem"
force: yes
become: yes
tags:
- tls