Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DEVOPS-420: Added a way to remove/delete a module/theme. #57

Open
wants to merge 1 commit into
base: devel
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
25 changes: 23 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,27 @@
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
when: ssp_mods_extra_disabled is defined

- name: Remove/Disable SSP modules (2/2)
file:
path: "{{ item.dest_config_path }}"
state: absent
become: yes
with_items: "{{ ssp_mods_extra_disabled }}"
when: (ssp_mods_extra_disabled is defined) and (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 +97,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