Skip to content

Commit

Permalink
Added a way to remove/delete a module/theme.
Browse files Browse the repository at this point in the history
A way (first) delete the directory of an module/theme plus the configuration file of that module/theme.
* [X] `ssp_mods_extra_disabled` : The list of modules/themes to be removed.
  • Loading branch information
Tas-sos committed Jun 4, 2021
1 parent 42d0921 commit 00f00e4
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 2 deletions.
28 changes: 28 additions & 0 deletions roles/ssp-modules/defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,17 @@ ssp_modules_db: []
# Examples of use cases:

## Modules
#ssp_mods_extra_disabled:
# - name: module-a
# module_path: "{{ ssp_path }}/modules/module_directory_name"
# - name: module-x
# module_path: "{{ ssp_path }}/modules/module-x"
# dest_config_path: "{{ ssp_path }}/config/module_x.php"
# - name: module-x
# module_path: "{{ ssp_path }}/modules/module-x-v2.1.1"
# dest_config_path: "{{ ssp_path }}/config/module_x.php"
#
#
#ssp_mods_extra_enabled:
# - name: "module1"
# path: "{{ ssp_path }}/modules/module1_directory"
Expand Down Expand Up @@ -42,6 +53,23 @@ ssp_modules_db: []
# # or for example :
# src_config_path: "{{ inventory_dir }}/files/templates/config/module_theme2_config.php.j2"
# dest_config_path: "{{ ssp_path }}/config/module_theme2_config.php"
# - name: "theme3"
# fullname: "simplesamlphp-module-theme3 - 1st level of unziped directory"
# path: "{{ ssp_path }}/modules/theme3"
# zip_url: "https://github.com/example/simplesamlphp-module-theme3/releases/download/1.0.0/theme3.zip"
# version: "1.0.0"
# src_config_path: "{{ role_path }}/templates/config/module_theme3_config.php.j2"
# src_config_path: "{{ inventory_dir }}/files/templates/config/module_theme3_config.php.j2"
# dest_config_path: "{{ ssp_path }}/config/module_theme3_config.php"
# Same module/theme but in a different directory ( different version )
# - name: "theme3"
# fullname: "simplesamlphp-module-theme3 - 1st level of unziped directory"
# path: "{{ ssp_path }}/modules/theme3-v2.1.1" # The different directory!
# zip_url: "https://github.com/example/simplesamlphp-module-theme3/releases/download/2.1.1/theme3.zip"
# version: "2.1.1"
# src_config_path: "{{ role_path }}/templates/config/module_theme3_config.php.j2"
# src_config_path: "{{ inventory_dir }}/files/templates/config/module_theme3_config.php.j2"
# dest_config_path: "{{ ssp_path }}/config/module_theme3_config.php"
#
#
## Extra dictionaries
Expand Down
24 changes: 22 additions & 2 deletions roles/ssp-modules/tasks/install-common.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,26 @@
when: item.repo_url is defined


- name: Remove/Disable SSP modules (1/2)
file:
path: "{{ item.module_path }}"
state: absent
become: yes
with_items: "{{ ssp_mods_extra_disabled }}"
tags:
- ssp_modules:config:remove

- name: Remove/Disable SSP modules (2/2)
file:
path: "{{ item.dest_config_path }}"
state: absent
become: yes
with_items: "{{ ssp_mods_extra_disabled }}"
when: item.dest_config_path is defined
tags:
- ssp_modules:config:remove


- name: Download & unarchive to /tmp/ ( zip only )
unarchive:
src: "{{ item.zip_url }}"
Expand Down Expand Up @@ -76,5 +96,5 @@
failed_when: "postgresql_result is failed and 'already exists' not in postgresql_result.msg"
with_items: "{{ ssp_modules_db }}"
when: "ssp_modules_db is defined"
tags:
- ssp_modules:install:db


0 comments on commit 00f00e4

Please sign in to comment.