Merge branch 'master' of roberto.cirillo/ansible-playbooks into master

This commit is contained in:
Andrea Dell'Amico 2019-05-08 15:42:36 +02:00 committed by Gitea
commit 8f77a4473b
2 changed files with 53 additions and 0 deletions

View File

@ -0,0 +1,7 @@
---
smartgears_generic_service_install: False
smartgears_generic_service_version: latest
smartgears_generic_service_extension: war
smartgears_generic_service_file: '{{ smartgears_generic_service_name }}-{{ smartgears_generic_service_version }}.{{ smartgears_generic_service_extension }}'

View File

@ -0,0 +1,46 @@
---
- block:
- name: Remove the old service files
file: path={{ item }} state=absent
with_items:
- '{{ smartgears_instance_path }}/webapps/{{ smartgears_generic_service_name }}'
- '{{ smartgears_instance_path }}/webapps/{{ smartgears_generic_service_name }}.{{ smartgears_generic_service_extension }}'
notify: Restart smartgears
check_mode: yes
become: True
become_user: '{{ d4science_user }}'
tags: [ 'smartgears_generic_service' ]
when: not smartgears_generic_service_install
- block:
- name: Get the smartgears-service war
maven_artifact: artifact_id={{ smartgears_generic_service_name }} version={{ smartgears_generic_service_version | default(omit) }} group_id={{ smartgears_generic_service_group_id }} extension={{ smartgears_generic_service_extension | default('war') }} repository_url={{ smartgears_global_base_url }} dest={{ smartgears_downloads_dir }}/{{ smartgears_generic_service_file }} verify_checksum=always
register: smartgears_generic_service_download
- name: Remove the old service files
file: path={{ smartgears_instance_path }}/webapps/{{ smartgears_generic_service_name }} state=absent
notify: Restart smartgears
when: smartgears_generic_service_download is changed
check_mode: yes
- name: Copy the service under the webapps directory
copy: src={{ smartgears_downloads_dir }}/{{ smartgears_generic_service_file }} dest={{ smartgears_instance_path }}/webapps/{{ smartgears_generic_service_name }}.{{ smartgears_generic_service_extension }} remote_src=yes force=yes
notify: Restart smartgears
check_mode: yes
- name: Create the service webapp directory
file: dest={{ smartgears_instance_path }}/webapps/{{ smartgears_generic_service_name }} state=directory
when: smartgears_generic_service_download
- name: Unarchive the service war file
unarchive: copy=no src={{ smartgears_downloads_dir }}/{{ smartgears_generic_service_file }} dest={{ smartgears_instance_path }}/webapps/{{ smartgears_generic_service_name }}
notify: Restart smartgears
become: True
become_user: '{{ d4science_user }}'
tags: [ 'smartgears_generic_service' ]
when: smartgears_generic_service_install
check_mode: yes