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>
This commit is contained in:
parent
37f497d096
commit
a82884ee15
5 changed files with 44 additions and 70 deletions
|
@ -56,43 +56,26 @@ etherpad_apt:
|
|||
- nodejs
|
||||
- git
|
||||
|
||||
etherpad_plugins:
|
||||
- name: ep_adminpads2
|
||||
install: true
|
||||
- name: ep_comments_page
|
||||
install: true
|
||||
- name: ep_desktop_notifications
|
||||
install: true
|
||||
- name: ep_font_color
|
||||
install: true
|
||||
- name: ep_headings2
|
||||
install: true
|
||||
- name: ep_markdown
|
||||
install: true
|
||||
- name: ep_previewimages
|
||||
install: true
|
||||
- name: ep_spellcheck
|
||||
install: true
|
||||
- name: ep_real_time_chat
|
||||
install: true
|
||||
- name: ep_delete_after_delay
|
||||
install: true
|
||||
- name: ep_align
|
||||
install: true
|
||||
- name: ep_font_size
|
||||
install: true
|
||||
- name: ep_table_of_contents
|
||||
install: true
|
||||
- name: ep_author_follow
|
||||
install: true
|
||||
- name: ep_cursortrace
|
||||
install: true
|
||||
- name: ep_prompt_for_name
|
||||
install: true
|
||||
- name: ep_user_fontsize_version_2
|
||||
install: true
|
||||
- name: ep_author_hover
|
||||
install: true
|
||||
etherpad_plugins_list:
|
||||
ep_adminpads2: enabled
|
||||
ep_comments_page: enabled
|
||||
ep_desktop_notifications: enabled
|
||||
ep_font_color: enabled
|
||||
ep_headings2: enabled
|
||||
ep_markdown: enabled
|
||||
ep_previewimages: enabled
|
||||
ep_spellcheck: enabled
|
||||
ep_real_time_chat: enabled
|
||||
ep_delete_after_delay: enabled
|
||||
ep_align: enabled
|
||||
ep_font_size: enabled
|
||||
ep_table_of_contents: enabled
|
||||
ep_author_follow: enabled
|
||||
ep_cursortrace: enabled
|
||||
ep_prompt_for_name: enabled
|
||||
ep_user_fontsize_version_2: enabled
|
||||
ep_author_hover: enabled
|
||||
|
||||
# ep_delete_after_delay
|
||||
# Etherpad-Lite plugin that deletes your pads after a configured delay
|
||||
delay: '7776000' # one day, in seconds Default is 86400
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
owner: "{{ etherpad_username }}"
|
||||
group: "{{ etherpad_group }}"
|
||||
mode: 0755
|
||||
tags: configuration
|
||||
|
||||
- name: '[CONFIGURE] - Deploy config'
|
||||
template:
|
||||
|
@ -17,3 +18,4 @@
|
|||
mode: 0644
|
||||
notify:
|
||||
restart etherpad
|
||||
tags: configuration
|
||||
|
|
|
@ -11,6 +11,7 @@
|
|||
|
||||
- name: Deploy configuration
|
||||
include_tasks: configure.yml
|
||||
tags: configuration
|
||||
|
||||
- name: Install Modules
|
||||
include_tasks: modules.yml
|
||||
|
|
|
@ -1,40 +1,28 @@
|
|||
---
|
||||
|
||||
#- name: '[Modules] - Install modules'
|
||||
# npm:
|
||||
# name: "{{ item.name }}"
|
||||
# path: "{{ etherpad_app_dir }}/app"
|
||||
# state: latest
|
||||
# with_items: "{{ etherpad_plugins }}"
|
||||
# become: yes
|
||||
# become_user: "{{ etherpad_username }}"
|
||||
# when: item.install|lower == 'true'
|
||||
# notify:
|
||||
# restart etherpad
|
||||
# tags: modules
|
||||
|
||||
# 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 {{ item.name }}"
|
||||
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"
|
||||
with_items: "{{ etherpad_plugins }}"
|
||||
become: yes
|
||||
become_user: "{{ etherpad_username }}"
|
||||
when: item.install|lower == 'true'
|
||||
when: etherpad_plugins_list| dict2items | selectattr('value', 'eq', 'enabled') |length > 0
|
||||
notify:
|
||||
restart etherpad
|
||||
tags: modules
|
||||
|
||||
- name: '[Modules] - Uninstall modules'
|
||||
npm:
|
||||
name: "{{ item.name }}"
|
||||
path: "{{ etherpad_app_dir }}/app"
|
||||
state: absent
|
||||
with_items: "{{ etherpad_plugins }}"
|
||||
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: item.install|lower == 'false'
|
||||
when: etherpad_plugins_list| dict2items | selectattr('value', 'eq', 'disabled') |length > 0
|
||||
notify:
|
||||
restart etherpad
|
||||
tags: modules
|
|
@ -532,20 +532,20 @@
|
|||
*/
|
||||
},
|
||||
|
||||
{% for item in etherpad_plugins %}
|
||||
{% if item.name == 'ep_delete_after_delay' and item.install %}
|
||||
/* This adds delete_after_delay config vars
|
||||
*/
|
||||
"ep_delete_after_delay": {
|
||||
"delay": {{ delay }}, // one day, in seconds
|
||||
"loop": {{ loopdeletion }},
|
||||
"loopDelay": {{ loopDelay }}, // one hour, in seconds
|
||||
"deleteAtStart": {{ deleteAtStart }},
|
||||
"text": "{{ text }}"
|
||||
{% for key, value in etherpad_plugins_list.items() %}
|
||||
{% if key == "ep_delete_after_delay" and value == "enabled" %}
|
||||
"ep_delete_after_delay": {
|
||||
"delay": {{ delay }}, // one day, in seconds
|
||||
"loop": {{ loopdeletion }},
|
||||
"loopDelay": {{ loopDelay }}, // one hour, in seconds
|
||||
"deleteAtStart": {{ deleteAtStart }},
|
||||
"text": "{{ text }}"
|
||||
},
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* Restrict socket.io transport methods
|
||||
*/
|
||||
|
|
Loading…
Reference in a new issue