diff --git a/smartgears/http-proxy-servlet/defaults/main.yml b/smartgears/http-proxy-servlet/defaults/main.yml new file mode 100644 index 0000000..5cea2c1 --- /dev/null +++ b/smartgears/http-proxy-servlet/defaults/main.yml @@ -0,0 +1,8 @@ +--- +http_proxy_servlet_install: False +maven_central_base_url: 'https://repo1.maven.org/maven2' +http_proxy_servlet_ver: latest +http_proxy_servlet_group_id: org.mitre.dsmiley.httpproxy +http_proxy_servlet_name: smiley-http-proxy-servlet +http_proxy_servlet_extension: jar +http_proxy_servlet_file: '{{ http_proxy_servlet_name }}-{{ http_proxy_servlet_ver }}.{{ http_proxy_servlet_extension }}' diff --git a/smartgears/http-proxy-servlet/tasks/main.yml b/smartgears/http-proxy-servlet/tasks/main.yml new file mode 100644 index 0000000..52ca141 --- /dev/null +++ b/smartgears/http-proxy-servlet/tasks/main.yml @@ -0,0 +1,29 @@ +--- +- block: + - name: Remove the old http-proxy-servlet files + file: path='{{ smartgears_instance_path }}/{{ http_proxy_servlet_name }}.{{ http_proxy_servlet_extension }}' state=absent + notify: Restart smartgears + + become: True + become_user: '{{ d4science_user }}' + tags: [ 'smartgears', 'http_proxy_servlet', 'tomcat' ] + when: not http_proxy_servlet_install + +- block: + - name: Get the http-proxy-servlet jar + maven_artifact: artifact_id={{ http_proxy_servlet_name }} version={{ http_proxy_servlet_version | default(omit) }} group_id='{{ http_proxy_servlet_group_id }}' extension={{ http_proxy_servlet_extension | default('war') }} repository_url={{ maven_central_base_url }} dest={{ smartgears_downloads_dir }}/{{ http_proxy_servlet_file }} verify_checksum=always + register: http_proxy_servlet_download + + - name: Remove the old http-proxy-servlet files + file: path='{{ smartgears_instance_path }}/{{ http_proxy_servlet_name }}.{{ http_proxy_servlet_extension }}' state=absent + notify: Restart smartgears + when: http_proxy_servlet_download is changed + + - name: Copy the http-proxy-servlet war file into the webapps directory + copy: src={{ smartgears_downloads_dir }}/{{ http_proxy_servlet_file }} dest={{ smartgears_instance_path }}/lib/{{ http_proxy_servlet_name }}.{{ http_proxy_servlet_extension }} remote_src=yes force=yes + notify: Restart smartgears + + become: True + become_user: '{{ d4science_user }}' + tags: [ 'smartgears', 'http_proxy_servlet', 'tomcat' ] + when: http_proxy_servlet_install