etherpad/tasks/modules.yml
2023-08-23 08:37:23 +02:00

28 lines
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