etherpad/tasks/modules.yml
meaz a82884ee15 Update how modules are deployed (#13)
From last deployment, I discovered that you can not loop with `npm install --no-save --legacy-peer-deps ep_whatever` like we used to do, because it removes every other installed modules for some reason. So you have to do all at once like `npm install --no-save --legacy-peer-deps ep_whatever ep_whatever1 ep_whatever2 ep_whatever3`.

This fixes this.

Co-authored-by: meaz <meaz@disroot.org>
Reviewed-on: #13
Reviewed-by: muppeth <muppeth@no-reply@disroot.org>
2023-09-02 05:55:02 +00:00

28 lines
No EOL
1.1 KiB
YAML

---
# The following command get the etherpad_plugins_list dictionnary
# selects only the enabled plugins
# then uses filter to get all plugins names in one line, without comas or quotes as needed for npm
- name: '[Modules] - Install modules'
shell:
cmd: "npm install --no-save --legacy-peer-deps {{ etherpad_plugins_list| dict2items | selectattr('value', 'eq', 'enabled') | map(attribute='key') |join(',') | replace(\",\", \" \") }}"
args:
chdir: "{{ etherpad_app_dir }}/app"
become: yes
become_user: "{{ etherpad_username }}"
when: etherpad_plugins_list| dict2items | selectattr('value', 'eq', 'enabled') |length > 0
notify:
restart etherpad
tags: modules
- name: '[Modules] - Uninstall modules'
shell:
cmd: "npm uninstall {{ etherpad_plugins_list| dict2items | selectattr('value', 'eq', 'disabled') | map(attribute='key') |join(',') | replace(\",\", \" \") }}"
args:
chdir: "{{ etherpad_app_dir }}/app"
become: yes
become_user: "{{ etherpad_username }}"
when: etherpad_plugins_list| dict2items | selectattr('value', 'eq', 'disabled') |length > 0
notify:
restart etherpad
tags: modules