library/roles/gcube/authorization_service: Fix some properties. Manage the logs configuration installing a logback template.

d4science-ghn-cluster: Fix the authorization nginx virtualhost template.
d4science-ghn-cluster/group_vars/authorization_service: group hierarchy authorization_service -> (authorization_service_dev authorization_service_prod)
This commit is contained in:
Andrea Dell'Amico 2016-09-28 11:58:42 +02:00
parent 272c0eea0d
commit 55f2c70e52
4 changed files with 51 additions and 5 deletions

View File

@ -1,10 +1,15 @@
--- ---
authorization_service_install: False authorization_service_install: False
authorization_service_upgrade: False
authorization_service_name: authorization-service authorization_service_name: authorization-service
authorization_service_file: '{{ authorization_service_name }}-2.0.0-20160927.120833-1.war' authorization_service_file: '{{ authorization_service_name }}-2.0.0-20160927.120833-1.war'
authorization_service_url: 'http://maven.research-infrastructures.eu/nexus/content/repositories/gcube-snapshots/org/gcube/common/authorization-service/2.0.0-SNAPSHOT/{{ authorization_service_file }}' authorization_service_url: 'http://maven.research-infrastructures.eu/nexus/content/repositories/gcube-snapshots/org/gcube/common/authorization-service/2.0.0-SNAPSHOT/{{ authorization_service_file }}'
authorization_service_persistence_dest: WEB-INF/classes/META-INF/persistence.xml authorization_service_persistence_dest: WEB-INF/classes/META-INF/persistence.xml
authorization_service_config_dest: WEB-INF/AuthorizationConfiguration.xml authorization_service_config_dest: WEB-INF/AuthorizationConfiguration.xml
auth_user: '{{ d4science_user }}'
authorization_service_loglevel: INFO
authorization_service_root_loglevel: WARN
authorization_service_http_port: 8080
authorized_ips: authorized_ips:
- 127.0.0.1 - 127.0.0.1

View File

@ -0,0 +1,11 @@
---
- name: Restart the authorization service
service: name='tomcat-instance-{{ authorization_service_http_port }}' state=restarted
when: authorization_service_install
- name: Stop the authorization service
service: name='tomcat-instance-{{ authorization_service_http_port }}' state=stopped
- name: Start the authorization service
service: name='tomcat-instance-{{ authorization_service_http_port }}' state=started
when: authorization_service_install

View File

@ -1,11 +1,15 @@
--- ---
- block: - block:
- name: Stop the service when upgrading
service: name='tomcat-instance-{{ authorization_http_port }}' state=stopped
when: authorization_service_upgrade
- name: Remove the installed authorization service before upgrading - name: Remove the installed authorization service before upgrading
file: dest={{ item }} state=absent file: dest={{ item }} state=absent
with_items: with_items:
- '{{ auth_instance_path }}/webapps/authorization-service' - '{{ auth_instance_path }}/webapps/authorization-service'
- '{{ auth_instance_path }}/webapps/authorization-service.war' - '{{ auth_instance_path }}/webapps/authorization-service.war'
when: authorization_upgrade or not authorization_service_install when: authorization_service_upgrade or not authorization_service_install
- name: Get the authorization service war file - name: Get the authorization service war file
get_url: url={{ authorization_service_url }} dest={{ auth_instance_path }}/webapps/{{ authorization_service_file }} get_url: url={{ authorization_service_url }} dest={{ auth_instance_path }}/webapps/{{ authorization_service_file }}
@ -17,13 +21,15 @@
- name: Install the authorization service AuthorizationConfiguration.xml template - name: Install the authorization service AuthorizationConfiguration.xml template
template: src=AuthorizationConfiguration.xml.j2 dest={{ auth_instance_path }}/webapps/authorization-service/{{ authorization_service_config_dest }} mode=0440 template: src=AuthorizationConfiguration.xml.j2 dest={{ auth_instance_path }}/webapps/authorization-service/{{ authorization_service_config_dest }} mode=0440
with_items: '{{ tomcat_m_instances }}' notify: Restart the authorization service
notify: tomcat instances restart
- name: Install the authorization service persistence.xml template - name: Install the authorization service persistence.xml template
template: src=persistence.xml.j2 dest={{ auth_instance_path }}/webapps/authorization-service/{{ authorization_service_persistence_dest }} mode=0440 template: src=persistence.xml.j2 dest={{ auth_instance_path }}/webapps/authorization-service/{{ authorization_service_persistence_dest }} mode=0440
with_items: '{{ tomcat_m_instances }}' notify: Restart the authorization service
notify: tomcat instances restart
- name: Install the logback configuration
template: src=logback.xml.j2 dest={{ auth_instance_path }}/lib/logback.xml mode=0644
notify: Restart the authorization service
become: True become: True
become_user: '{{ auth_user }}' become_user: '{{ auth_user }}'

View File

@ -0,0 +1,24 @@
<configuration>
<appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>${catalina.base}/logs/ghn.log</file>
<append>true</append>
<encoder>
<pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{0}: %msg%n
</pattern>
</encoder>
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<fileNamePattern>${catalina.base}/logs/ghn.%d{yyyy-MM-dd}.log</fileNamePattern>
<maxHistory>30</maxHistory>
</rollingPolicy>
</appender>
<logger name="org.gcube" level="{{ authorization_service_loglevel }}" />
<logger name="org.gcube.common.authorizationservice" level="{{ authorization_service_loglevel }}" />
<logger name="org.gcube.common" level="{{ authorization_service_loglevel }}" />
<root level="{{ authorization_service_root_loglevel }}">
<appender-ref ref="FILE" />
</root>
</configuration>