forked from ISTI-ansible-roles/ansible-roles
library/roles/springboot-config: Installs a startup script (upstart only right now) and a logrotate file to support springboot applications.
This commit is contained in:
parent
2681e0574d
commit
94672dbdb9
|
@ -0,0 +1,6 @@
|
||||||
|
---
|
||||||
|
springboot_config: False
|
||||||
|
springboot_apps:
|
||||||
|
- { name: 'foo', log_dir: '/var/log/foo', install_dir: '/usr/lib/foo', state: 'present', user: 'foo', java_opts: '' }
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,13 @@
|
||||||
|
---
|
||||||
|
- block:
|
||||||
|
- name: Install the springboot app upstart init file
|
||||||
|
template: src=springboot-upstart.conf.j2 dest=/etc/init/{{ item.name }}.conf owner=root group=root mode=0644
|
||||||
|
with_items: '{{ springboot_apps }}'
|
||||||
|
when: is_trusty
|
||||||
|
|
||||||
|
- name: Install the springboot logrotate configuration
|
||||||
|
template: src=springboot-logrotate.j2 dest=/etc/logrotate.d/{{ item.name }} owner=root group=root mode=0444
|
||||||
|
with_items: '{{ springboot_apps }}'
|
||||||
|
|
||||||
|
when: springboot_config
|
||||||
|
tags: [ 'springboot', 'springboot_config' ]
|
|
@ -0,0 +1,8 @@
|
||||||
|
{{ item.log_dir }}/{{ item.name }}.log {
|
||||||
|
copytruncate
|
||||||
|
daily
|
||||||
|
rotate 10
|
||||||
|
compress
|
||||||
|
missingok
|
||||||
|
create 640 {{ item.user }} adm
|
||||||
|
}
|
|
@ -0,0 +1,17 @@
|
||||||
|
# {{ item.name }}
|
||||||
|
|
||||||
|
description "{{ item.name }}"
|
||||||
|
|
||||||
|
start on runlevel [2345]
|
||||||
|
stop on runlevel [!2345]
|
||||||
|
respawn
|
||||||
|
respawn limit 10 5
|
||||||
|
|
||||||
|
setuid {{ item.user }}
|
||||||
|
setgid {{ item.user }}
|
||||||
|
|
||||||
|
script
|
||||||
|
cd {{ item.install_dir }}
|
||||||
|
exec java {{ item.java_opts }} -jar ./{{ item.name }}.jar
|
||||||
|
end script
|
||||||
|
|
Loading…
Reference in New Issue