84 lines
2.2 KiB
YAML
84 lines
2.2 KiB
YAML
---
|
|
|
|
- name: Init db
|
|
ansible.builtin.include_tasks: db.yml
|
|
|
|
## 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_app_home }}"
|
|
owner: root
|
|
group: www-data
|
|
mode: "0o750"
|
|
|
|
- name: Install koillection application
|
|
ansible.builtin.unarchive:
|
|
remote_src: true
|
|
src: "{{ koillection_url }}"
|
|
dest: "{{ koillection_app_home }}"
|
|
owner: root
|
|
group: www-data
|
|
mode: "a-rwx,u+rwX,g+rX"
|
|
extra_opts: ['--strip-components=1']
|
|
exclude: "{{ koillection_userdata_app_dirs | map('regex_replace', '^', 'public/') }}"
|
|
|
|
- name: Put config file
|
|
ansible.builtin.template:
|
|
src: "env.j2"
|
|
dest: "{{ koillection_app_home }}/.env"
|
|
owner: root
|
|
group: www-data
|
|
mode: "0o640"
|
|
|
|
- name: Check writable dirs
|
|
ansible.builtin.file:
|
|
state: directory
|
|
dest: "{{ koillection_app_home }}/{{ item }}"
|
|
owner: root
|
|
group: www-data
|
|
mode: "g+w"
|
|
recurse: true
|
|
loop: "{{ koillection_writable_app_dirs }}"
|
|
|
|
## 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
|