forked from ISTI-ansible-roles/ansible-roles
library/roles/smartgears/smartgears/tasks/smartgears-app.yml: Add a new tag, so that we can install the smartgears distribution without touching anything else.
This commit is contained in:
parent
07d50186ab
commit
09aab98db3
|
@ -1,13 +1,13 @@
|
||||||
---
|
---
|
||||||
- name: Create a directory where to store all the smartgears related downloads to avoid cluttering the home directory
|
- name: Create a directory where to store all the smartgears related downloads to avoid cluttering the home directory
|
||||||
file: dest={{ smartgears_downloads_dir }} state=directory owner={{ smartgears_user }} group={{ smartgears_user }}
|
file: dest={{ smartgears_downloads_dir }} state=directory owner={{ smartgears_user }} group={{ smartgears_user }}
|
||||||
tags: [ 'smartgears', 'tomcat', 'smartgears_download_dir', 'smartgears_downloads_dir' ]
|
tags: [ 'smartgears', 'smartgears_distribution', 'tomcat', 'smartgears_download_dir', 'smartgears_downloads_dir' ]
|
||||||
|
|
||||||
- name: Remove the old smartgears-distribution files under the smartgears user home directory.
|
- name: Remove the old smartgears-distribution files under the smartgears user home directory.
|
||||||
shell: rm -fr {{ smartgears_user_home }}/smartgears-distribution-* ; touch {{ smartgears_user_home }}/.smartgears_distribution_cleaned
|
shell: rm -fr {{ smartgears_user_home }}/smartgears-distribution-* ; touch {{ smartgears_user_home }}/.smartgears_distribution_cleaned
|
||||||
args:
|
args:
|
||||||
creates: '{{ smartgears_user_home }}/.smartgears_distribution_cleaned'
|
creates: '{{ smartgears_user_home }}/.smartgears_distribution_cleaned'
|
||||||
tags: [ 'smartgears', 'tomcat' ]
|
tags: [ 'smartgears', 'smartgears_distribution', 'tomcat' ]
|
||||||
|
|
||||||
- name: Get the smartgears distribution
|
- name: Get the smartgears distribution
|
||||||
become: True
|
become: True
|
||||||
|
@ -16,12 +16,12 @@
|
||||||
with_items: '{{ tomcat_m_instances }}'
|
with_items: '{{ tomcat_m_instances }}'
|
||||||
register: smartgears_download
|
register: smartgears_download
|
||||||
when: not item.skip_smartgears
|
when: not item.skip_smartgears
|
||||||
tags: [ 'smartgears', 'tomcat' ]
|
tags: [ 'smartgears', 'smartgears_distribution', 'tomcat' ]
|
||||||
|
|
||||||
- name: Remove the smartgears-distribution files
|
- name: Remove the smartgears-distribution files
|
||||||
shell: find . -type d -name {{ smartgears_downloads_dir }}/smartgears-distribution-\* -exec rm -fr {} \;
|
shell: find . -type d -name {{ smartgears_downloads_dir }}/smartgears-distribution-\* -exec rm -fr {} \;
|
||||||
when: ( smartgears_download | changed )
|
when: ( smartgears_download | changed )
|
||||||
tags: [ 'smartgears', 'tomcat' ]
|
tags: [ 'smartgears', 'smartgears_distribution', 'tomcat' ]
|
||||||
|
|
||||||
- name: Unarchive the smartgears distribution
|
- name: Unarchive the smartgears distribution
|
||||||
become: True
|
become: True
|
||||||
|
@ -31,7 +31,7 @@
|
||||||
when:
|
when:
|
||||||
- not item.skip_smartgears
|
- not item.skip_smartgears
|
||||||
- ( smartgears_download | changed )
|
- ( smartgears_download | changed )
|
||||||
tags: [ 'smartgears', 'tomcat' ]
|
tags: [ 'smartgears', 'smartgears_distribution', 'tomcat' ]
|
||||||
|
|
||||||
- name: Check if the smartgears stop script exists
|
- name: Check if the smartgears stop script exists
|
||||||
become: True
|
become: True
|
||||||
|
@ -39,7 +39,7 @@
|
||||||
stat: path=/home/{{ smartgears_user }}/stopContainer.sh
|
stat: path=/home/{{ smartgears_user }}/stopContainer.sh
|
||||||
when: smartgears_upgrade or ( smartgears_download | changed )
|
when: smartgears_upgrade or ( smartgears_download | changed )
|
||||||
register: smartgears_stop_script
|
register: smartgears_stop_script
|
||||||
tags: [ 'smartgears', 'tomcat', 'stop_smartgears_service' ]
|
tags: [ 'smartgears', 'smartgears_distribution', 'tomcat', 'stop_smartgears_service' ]
|
||||||
|
|
||||||
- name: Stop the smartgears container before launching the upgrade script
|
- name: Stop the smartgears container before launching the upgrade script
|
||||||
become: True
|
become: True
|
||||||
|
@ -48,14 +48,14 @@
|
||||||
when:
|
when:
|
||||||
- smartgears_upgrade or ( smartgears_download | changed )
|
- smartgears_upgrade or ( smartgears_download | changed )
|
||||||
- smartgears_stop_script.stat.exists
|
- smartgears_stop_script.stat.exists
|
||||||
tags: [ 'smartgears', 'tomcat', 'stop_smartgears_service' ]
|
tags: [ 'smartgears', 'smartgears_distribution', 'tomcat', 'stop_smartgears_service' ]
|
||||||
|
|
||||||
- name: Install the additional tomcat default file
|
- name: Install the additional tomcat default file
|
||||||
template: src=tomcat-instance-default.j2 dest=/etc/default/tomcat-instance-{{ item.http_port }}.local
|
template: src=tomcat-instance-default.j2 dest=/etc/default/tomcat-instance-{{ item.http_port }}.local
|
||||||
with_items: '{{ tomcat_m_instances }}'
|
with_items: '{{ tomcat_m_instances }}'
|
||||||
when: not item.skip_smartgears
|
when: not item.skip_smartgears
|
||||||
notify: Restart smartgears
|
notify: Restart smartgears
|
||||||
tags: [ 'smartgears', 'tomcat', 'smartgears_env' ]
|
tags: [ 'smartgears', 'smartgears_distribution', 'tomcat', 'smartgears_env' ]
|
||||||
|
|
||||||
- name: Set the additional tomcat default file as the smartgears user .bashrc
|
- name: Set the additional tomcat default file as the smartgears user .bashrc
|
||||||
become: True
|
become: True
|
||||||
|
@ -63,7 +63,7 @@
|
||||||
template: src=tomcat-instance-default.j2 dest={{ item.user_home }}/.bashrc mode=0444
|
template: src=tomcat-instance-default.j2 dest={{ item.user_home }}/.bashrc mode=0444
|
||||||
with_items: '{{ tomcat_m_instances }}'
|
with_items: '{{ tomcat_m_instances }}'
|
||||||
when: not item.skip_smartgears
|
when: not item.skip_smartgears
|
||||||
tags: [ 'smartgears', 'tomcat', 'smartgears_env' ]
|
tags: [ 'smartgears', 'smartgears_distribution', 'tomcat', 'smartgears_env' ]
|
||||||
|
|
||||||
- name: Install the smartgears app
|
- name: Install the smartgears app
|
||||||
become: True
|
become: True
|
||||||
|
@ -75,39 +75,39 @@
|
||||||
- not item.skip_smartgears
|
- not item.skip_smartgears
|
||||||
register: install_smartgears_app
|
register: install_smartgears_app
|
||||||
notify: Restart smartgears
|
notify: Restart smartgears
|
||||||
tags: [ 'smartgears', 'tomcat' ]
|
tags: [ 'smartgears', 'smartgears_distribution', 'tomcat' ]
|
||||||
|
|
||||||
- name: Get the real smartgears version from the exploded distribution filename
|
- name: Get the real smartgears version from the exploded distribution filename
|
||||||
shell: /bin/ls -1 {{ smartgears_downloads_dir }} | grep smartgears-distribution | grep -v tar.gz | sed -e 's/smartgears-distribution-//g'
|
shell: /bin/ls -1 {{ smartgears_downloads_dir }} | grep smartgears-distribution | grep -v tar.gz | sed -e 's/smartgears-distribution-//g'
|
||||||
register: smartgears_real_version
|
register: smartgears_real_version
|
||||||
tags: [ 'smartgears', 'tomcat' ]
|
tags: [ 'smartgears', 'smartgears_distribution', 'tomcat' ]
|
||||||
|
|
||||||
- name: Set the real smartgears distribution version
|
- name: Set the real smartgears distribution version
|
||||||
set_fact: smartgears_real_distribution_version="{{ smartgears_real_version.stdout }}"
|
set_fact: smartgears_real_distribution_version="{{ smartgears_real_version.stdout }}"
|
||||||
tags: [ 'smartgears', 'tomcat' ]
|
tags: [ 'smartgears', 'smartgears_distribution', 'tomcat' ]
|
||||||
|
|
||||||
- name: Create the directory where we put the smartgears configuration snippets
|
- name: Create the directory where we put the smartgears configuration snippets
|
||||||
become: True
|
become: True
|
||||||
become_user: '{{ smartgears_user }}'
|
become_user: '{{ smartgears_user }}'
|
||||||
file: dest={{ smartgears_user_home }}/.containerxml state=directory
|
file: dest={{ smartgears_user_home }}/.containerxml state=directory
|
||||||
tags: [ 'smartgears', 'smartgears_conf', 'tomcat' ]
|
tags: [ 'smartgears', 'smartgears_distribution', 'smartgears_conf', 'tomcat' ]
|
||||||
|
|
||||||
- name: Install the token generator class
|
- name: Install the token generator class
|
||||||
copy: src=TokenGenerator.class dest=/usr/local/lib/TokenGenerator.class owner=root group=root mode=0644
|
copy: src=TokenGenerator.class dest=/usr/local/lib/TokenGenerator.class owner=root group=root mode=0644
|
||||||
tags: [ 'smartgears', 'smartgears_conf', 'tomcat' ]
|
tags: [ 'smartgears', 'smartgears_distribution', 'smartgears_conf', 'tomcat' ]
|
||||||
|
|
||||||
- name: Install the script that manages the smartgears loglevel
|
- name: Install the script that manages the smartgears loglevel
|
||||||
template: src=change-logback-loglevel.sh.j2 dest=/usr/local/bin/change-logback-loglevel owner=root group=root mode=0755
|
template: src=change-logback-loglevel.sh.j2 dest=/usr/local/bin/change-logback-loglevel owner=root group=root mode=0755
|
||||||
with_items: '{{ tomcat_m_instances }}'
|
with_items: '{{ tomcat_m_instances }}'
|
||||||
when: not item.skip_smartgears
|
when: not item.skip_smartgears
|
||||||
tags: [ 'smartgears', 'smartgears_loglevel', 'tomcat', 'logback_conf' ]
|
tags: [ 'smartgears', 'smartgears_distribution', 'smartgears_loglevel', 'tomcat', 'logback_conf' ]
|
||||||
|
|
||||||
- name: Change the smartgears log level
|
- name: Change the smartgears log level
|
||||||
become: True
|
become: True
|
||||||
become_user: '{{ smartgears_user }}'
|
become_user: '{{ smartgears_user }}'
|
||||||
shell: /usr/local/bin/change-logback-loglevel
|
shell: /usr/local/bin/change-logback-loglevel
|
||||||
when: not smartgears_logback_template
|
when: not smartgears_logback_template
|
||||||
tags: [ 'smartgears', 'tomcat', 'smartgears_loglevel', 'logback_conf' ]
|
tags: [ 'smartgears', 'smartgears_distribution', 'tomcat', 'smartgears_loglevel', 'logback_conf' ]
|
||||||
|
|
||||||
- name: Install the smartgears logback configuration
|
- name: Install the smartgears logback configuration
|
||||||
become: True
|
become: True
|
||||||
|
@ -115,37 +115,37 @@
|
||||||
template: src=logback.xml.j2 dest={{ smartgears_instance_path }}/lib/logback.xml
|
template: src=logback.xml.j2 dest={{ smartgears_instance_path }}/lib/logback.xml
|
||||||
when: smartgears_logback_template
|
when: smartgears_logback_template
|
||||||
notify: Restart smartgears
|
notify: Restart smartgears
|
||||||
tags: [ 'smartgears', 'smartgears_conf', 'tomcat', 'logback_conf' ]
|
tags: [ 'smartgears', 'smartgears_distribution', 'smartgears_conf', 'tomcat', 'logback_conf' ]
|
||||||
|
|
||||||
- name: Remove some wrong symbolic links created by the install/upgrade script
|
- name: Remove some wrong symbolic links created by the install/upgrade script
|
||||||
file: dest={{ item }} state=absent
|
file: dest={{ item }} state=absent
|
||||||
with_items:
|
with_items:
|
||||||
- '{{ smartgears_install_path }}/lib/lib'
|
- '{{ smartgears_install_path }}/lib/lib'
|
||||||
- '{{ smartgears_install_path }}/apps/webapps'
|
- '{{ smartgears_install_path }}/apps/webapps'
|
||||||
tags: [ 'smartgears', 'smartgears_conf', 'tomcat' ]
|
tags: [ 'smartgears', 'smartgears_distribution', 'smartgears_conf', 'tomcat' ]
|
||||||
|
|
||||||
- name: Install the script that fetches the scope tokens
|
- name: Install the script that fetches the scope tokens
|
||||||
template: src=get-scopes.j2 dest=/usr/local/bin/get-scopes owner=root group={{ smartgears_user }} mode=0750
|
template: src=get-scopes.j2 dest=/usr/local/bin/get-scopes owner=root group={{ smartgears_user }} mode=0750
|
||||||
with_items: '{{ tomcat_m_instances }}'
|
with_items: '{{ tomcat_m_instances }}'
|
||||||
tags: [ 'smartgears', 'smartgears_conf', 'tomcat' ]
|
tags: [ 'smartgears', 'smartgears_distribution', 'smartgears_conf', 'tomcat' ]
|
||||||
|
|
||||||
- name: Install the file containing the scopes list
|
- name: Install the file containing the scopes list
|
||||||
template: src=scopes.list.j2 dest=/usr/local/etc/scopes.list owner=root group={{ smartgears_user }} mode=0444
|
template: src=scopes.list.j2 dest=/usr/local/etc/scopes.list owner=root group={{ smartgears_user }} mode=0444
|
||||||
tags: [ 'smartgears', 'smartgears_conf', 'tomcat' ]
|
tags: [ 'smartgears', 'smartgears_distribution', 'smartgears_conf', 'tomcat' ]
|
||||||
|
|
||||||
- name: Install the smartgears template configuration. First part
|
- name: Install the smartgears template configuration. First part
|
||||||
become: True
|
become: True
|
||||||
become_user: '{{ smartgears_user }}'
|
become_user: '{{ smartgears_user }}'
|
||||||
template: src=container.xml.j2 dest={{ smartgears_user_home }}/.containerxml/1-container.xml
|
template: src=container.xml.j2 dest={{ smartgears_user_home }}/.containerxml/1-container.xml
|
||||||
with_items: '{{ tomcat_m_instances }}'
|
with_items: '{{ tomcat_m_instances }}'
|
||||||
tags: [ 'smartgears', 'smartgears_conf', 'tomcat' ]
|
tags: [ 'smartgears', 'smartgears_distribution', 'smartgears_conf', 'tomcat' ]
|
||||||
|
|
||||||
- name: Install the smartgears template configuration file. Third part
|
- name: Install the smartgears template configuration file. Third part
|
||||||
become: True
|
become: True
|
||||||
become_user: '{{ smartgears_user }}'
|
become_user: '{{ smartgears_user }}'
|
||||||
template: src=container-end.xml.j2 dest={{ smartgears_user_home }}/.containerxml/3-container.xml
|
template: src=container-end.xml.j2 dest={{ smartgears_user_home }}/.containerxml/3-container.xml
|
||||||
with_items: '{{ tomcat_m_instances }}'
|
with_items: '{{ tomcat_m_instances }}'
|
||||||
tags: [ 'smartgears', 'smartgears_conf', 'tomcat' ]
|
tags: [ 'smartgears', 'smartgears_distribution', 'smartgears_conf', 'tomcat' ]
|
||||||
|
|
||||||
- name: Get the scope tokens from the authorization service and assemble the container.xml file when whe have an authorization token or we are upgrading
|
- name: Get the scope tokens from the authorization service and assemble the container.xml file when whe have an authorization token or we are upgrading
|
||||||
become: True
|
become: True
|
||||||
|
@ -153,7 +153,7 @@
|
||||||
shell: /usr/local/bin/get-scopes {{ gcube_admin_token | default('') }}
|
shell: /usr/local/bin/get-scopes {{ gcube_admin_token | default('') }}
|
||||||
when: gcube_admin_token is defined or ( smartgears_download | changed )
|
when: gcube_admin_token is defined or ( smartgears_download | changed )
|
||||||
notify: Restart smartgears
|
notify: Restart smartgears
|
||||||
tags: [ 'smartgears', 'smartgears_conf', 'tomcat' ]
|
tags: [ 'smartgears', 'smartgears_distribution', 'smartgears_conf', 'tomcat' ]
|
||||||
|
|
||||||
- name: Remove the smartgears application state if requested
|
- name: Remove the smartgears application state if requested
|
||||||
become: True
|
become: True
|
||||||
|
@ -161,16 +161,16 @@
|
||||||
shell: . {{ smartgears_user_home }}/.bashrc ; cd {{ smartgears_user_home }}/SmartGears/scripts ; ./clean-container-state -s old_saved_scopes.xml
|
shell: . {{ smartgears_user_home }}/.bashrc ; cd {{ smartgears_user_home }}/SmartGears/scripts ; ./clean-container-state -s old_saved_scopes.xml
|
||||||
when: smartgears_remove_state and not smartgears_upgrade
|
when: smartgears_remove_state and not smartgears_upgrade
|
||||||
notify: Restart smartgears
|
notify: Restart smartgears
|
||||||
tags: [ 'smartgears', 'smartgears_conf', 'tomcat' ]
|
tags: [ 'smartgears', 'smartgears_distribution', 'smartgears_conf', 'tomcat' ]
|
||||||
|
|
||||||
- name: Force a smartgears restart
|
- name: Force a smartgears restart
|
||||||
service: name='tomcat-instance-{{ smartgears_http_port }}' state=restarted
|
service: name='tomcat-instance-{{ smartgears_http_port }}' state=restarted
|
||||||
when: smartgears_force_restart is defined and smartgears_force_restart
|
when: smartgears_force_restart is defined and smartgears_force_restart
|
||||||
tags: [ 'smartgears', 'smartgears_conf', 'tomcat' ]
|
tags: [ 'smartgears', 'smartgears_distribution', 'smartgears_conf', 'tomcat' ]
|
||||||
|
|
||||||
- name: Install the Nagios NRPE configuration for smartgears
|
- name: Install the Nagios NRPE configuration for smartgears
|
||||||
template: src=smartgears-nrpe.cfg.j2 dest=/etc/nagios/nrpe.d/smartgears-nrpe.cfg owner=root group=root mode=444
|
template: src=smartgears-nrpe.cfg.j2 dest=/etc/nagios/nrpe.d/smartgears-nrpe.cfg owner=root group=root mode=444
|
||||||
notify: Reload NRPE server
|
notify: Reload NRPE server
|
||||||
when: nagios_enabled
|
when: nagios_enabled
|
||||||
tags: [ 'smartgears', 'smartgears_nrpe', 'nagios', 'nagios_nrpe' ]
|
tags: [ 'smartgears', 'smartgears_distribution', 'smartgears_nrpe', 'nagios', 'nagios_nrpe' ]
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue