From 1f3564b491734b0d92bd6aa6710a699ac37e7b6c Mon Sep 17 00:00:00 2001 From: Andrea Dell'Amico Date: Wed, 5 Sep 2018 10:51:51 +0200 Subject: [PATCH] Introduce the new variable smartgears_force_remove_state and a task that removes the local state. --- smartgears/smartgears/defaults/main.yml | 2 +- smartgears/smartgears/tasks/smartgears-app.yml | 17 +++++++---------- 2 files changed, 8 insertions(+), 11 deletions(-) diff --git a/smartgears/smartgears/defaults/main.yml b/smartgears/smartgears/defaults/main.yml index 9d0bbd6..ef7afec 100644 --- a/smartgears/smartgears/defaults/main.yml +++ b/smartgears/smartgears/defaults/main.yml @@ -5,7 +5,7 @@ smartgears_gcube_repository: '{{ gcube_repository }}' # distribution version smartgears_upgrade: False smartgears_force_install: False -smartgears_remove_state: False +smartgears_force_remove_state: False smartgears_node: True smartgears_install_generic_virthost: True diff --git a/smartgears/smartgears/tasks/smartgears-app.yml b/smartgears/smartgears/tasks/smartgears-app.yml index ebd7f71..799c297 100644 --- a/smartgears/smartgears/tasks/smartgears-app.yml +++ b/smartgears/smartgears/tasks/smartgears-app.yml @@ -166,19 +166,16 @@ become: True become_user: '{{ smartgears_user }}' shell: /usr/local/bin/get-scopes {{ gcube_admin_token | default('') }} -# when: gcube_admin_token is defined or ( smartgears_download is changed ) -# register: smartgears_remove_state notify: Restart smartgears tags: [ 'smartgears', 'smartgears_distribution', 'smartgears_conf', 'tomcat' ] -# Don't needed anymore. The get-scopes script takes care of everything -# - name: Remove the smartgears application state if requested -# become: True -# become_user: '{{ smartgears_user }}' -# shell: . {{ smartgears_user_home }}/.bashrc ; cd {{ smartgears_user_home }}/SmartGears/scripts ; ./clean-container-state -s old_saved_scopes.xml -# when: smartgears_remove_state is changed -# notify: Restart smartgears -# tags: [ 'smartgears', 'smartgears_distribution', 'smartgears_conf', 'tomcat' ] +- name: Remove the smartgears application state if requested + become: True + become_user: '{{ smartgears_user }}' + file: dest={{ smartgears_install_path }}/state state=absent + when: smartgears_force_remove_state + notify: Restart smartgears + tags: [ 'smartgears', 'smartgears_distribution', 'smartgears_conf', 'tomcat' ] - name: Force a smartgears restart service: name='tomcat-instance-{{ smartgears_http_port }}' state=restarted