♻: move koillection to app dir
All checks were successful
ansible-lint / lint-everything (push) Successful in 4s
All checks were successful
ansible-lint / lint-everything (push) Successful in 4s
This commit is contained in:
23
roles/koillection/tasks/api.yml
Normal file
23
roles/koillection/tasks/api.yml
Normal file
@@ -0,0 +1,23 @@
|
||||
---
|
||||
|
||||
- name: Create API config dir
|
||||
ansible.builtin.file:
|
||||
state: directory
|
||||
dest: "{{ koillection_data_home }}/config/jwt"
|
||||
owner: www-data
|
||||
group: www-data
|
||||
mode: "0o750"
|
||||
|
||||
- name: Link JWT config dir
|
||||
ansible.builtin.file:
|
||||
state: link
|
||||
src: "{{ koillection_data_home }}/config/jwt"
|
||||
dest: "{{ koillection_app_home }}/config/jwt"
|
||||
|
||||
- name: Run lexik jwt
|
||||
become: true
|
||||
become_user: www-data
|
||||
ansible.builtin.command:
|
||||
cmd: "php bin/console lexik:jwt:generate-keypair"
|
||||
chdir: "{{ koillection_app_home }}"
|
||||
creates: "{{ koillection_app_home }}/config/jwt/private.pem"
|
@@ -3,10 +3,16 @@
|
||||
- name: Init db
|
||||
ansible.builtin.include_tasks: db.yml
|
||||
|
||||
- name: Create application directory
|
||||
## Remove the previous app & install the new version
|
||||
- name: Remove Koillection previous version
|
||||
ansible.builtin.file:
|
||||
state: absent
|
||||
dest: "{{ koillection_app_home }}"
|
||||
|
||||
- name: Create app home
|
||||
ansible.builtin.file:
|
||||
state: directory
|
||||
dest: "{{ koillection_home }}"
|
||||
dest: "{{ koillection_app_home }}"
|
||||
owner: root
|
||||
group: www-data
|
||||
mode: "0o750"
|
||||
@@ -15,19 +21,17 @@
|
||||
ansible.builtin.unarchive:
|
||||
remote_src: true
|
||||
src: "{{ koillection_url }}"
|
||||
dest: "{{ koillection_home }}"
|
||||
dest: "{{ koillection_app_home }}"
|
||||
owner: root
|
||||
group: www-data
|
||||
mode: "a-rwx,u+rwX,g+rX"
|
||||
extra_opts: ['--strip-components=1']
|
||||
exclude:
|
||||
- .env
|
||||
- config/jwt
|
||||
exclude: "{{ koillection_userdata_app_dirs }}"
|
||||
|
||||
- name: Put config file
|
||||
ansible.builtin.template:
|
||||
src: "env.j2"
|
||||
dest: "{{ koillection_home }}/.env"
|
||||
dest: "{{ koillection_app_home }}/.env"
|
||||
owner: root
|
||||
group: www-data
|
||||
mode: "0o640"
|
||||
@@ -35,21 +39,45 @@
|
||||
- name: Check writable dirs
|
||||
ansible.builtin.file:
|
||||
state: directory
|
||||
dest: "{{ koillection_home }}/{{ item }}"
|
||||
dest: "{{ koillection_app_home }}/{{ item }}"
|
||||
owner: root
|
||||
group: www-data
|
||||
mode: "g+w"
|
||||
recurse: true
|
||||
loop:
|
||||
- "var"
|
||||
- "config/jwt"
|
||||
- "public/uploads"
|
||||
- "public/tmp"
|
||||
loop: "{{ koillection_writable_app_dirs }}"
|
||||
|
||||
- name: Run lexik jwt
|
||||
become: true
|
||||
become_user: www-data
|
||||
ansible.builtin.command:
|
||||
cmd: "php bin/console lexik:jwt:generate-keypair"
|
||||
chdir: "{{ koillection_home }}"
|
||||
creates: "{{ koillection_home }}/config/jwt/private.pem"
|
||||
## Ensure the data dirs exist, populate them if not
|
||||
- name: Create data home
|
||||
ansible.builtin.file:
|
||||
state: directory
|
||||
path: "{{ koillection_data_home }}"
|
||||
owner: www-data
|
||||
group: www-data
|
||||
mode: "0o750"
|
||||
|
||||
- name: Get data dir
|
||||
ansible.builtin.stat:
|
||||
path: "{{ koillection_data_home }}/{{ koillection_userdata_app_dirs[0] }}"
|
||||
register: _koillection_userdata_dir_stat
|
||||
|
||||
- name: Install Koillection data dir
|
||||
ansible.builtin.unarchive:
|
||||
remote_src: true
|
||||
src: "{{ koillection_url }}"
|
||||
dest: "{{ koillection_data_home }}"
|
||||
owner: www-data
|
||||
group: www-data
|
||||
mode: "a-rwx,u+rwX,g+rX"
|
||||
extra_opts: ['--strip-components=1']
|
||||
include: "{{ koillection_userdata_app_dirs | map('regex_replace', '^', 'public/') }}"
|
||||
when: not _koillection_userdata_dir_stat.stat.exists
|
||||
|
||||
- name: Link Koillection userdata dirs
|
||||
ansible.builtin.file:
|
||||
state: link
|
||||
src: "{{ koillection_data_home }}/{{ item }}"
|
||||
dest: "{{ koillection_app_home }}/{{ item }}"
|
||||
loop: "{{ koillection_userdata_app_dirs }}"
|
||||
|
||||
- name: Include API activation task
|
||||
ansible.builtin.include_tasks: api.yml
|
||||
|
@@ -5,4 +5,13 @@ koillection_url: "https://giteu.be/koillection/koillection/releases/download/{{
|
||||
|
||||
koillection_access_url: "{{ web_hostname | selectattr('type', 'defined') | selectattr('type', '==', 'koillection') | map(attribute='host') | first }}"
|
||||
|
||||
koillection_home: "/srv/http/{{ koillection_access_url }}"
|
||||
# Access path
|
||||
koillection_app_home: "/var/www/{{ koillection_access_url }}"
|
||||
koillection_data_home: "/srv/www-data/{{ koillection_access_url }}"
|
||||
|
||||
# App dirs
|
||||
koillection_writable_app_dirs:
|
||||
- var
|
||||
- public/tmp
|
||||
koillection_userdata_app_dirs:
|
||||
- public/uploads
|
||||
|
@@ -1,7 +1,7 @@
|
||||
server {
|
||||
{% include './templates/header.conf.j2' %}
|
||||
|
||||
root /srv/http/koi.libertus.eu/public;
|
||||
root /var/www/koi.libertus.eu/public;
|
||||
|
||||
index index.html index.htm index.php;
|
||||
|
||||
|
Reference in New Issue
Block a user