Merge branch 'master' of adellam/ansible-roles into master

This commit is contained in:
Andrea Dell'Amico 2019-12-16 14:11:13 +01:00 committed by Gitea
commit e570108007
3 changed files with 54 additions and 9 deletions

View File

@ -0,0 +1,4 @@
---
- name: systemd reload
command: systemctl daemon-reload

View File

@ -1,13 +1,24 @@
--- ---
- block: - name: Springboot startup files management
- name: Install the springboot app upstart init file block:
template: src=springboot-upstart.conf.j2 dest=/etc/init/{{ item.name }}.conf owner=root group=root mode=0644 - name: Install the springboot app upstart init file
with_items: '{{ springboot_apps }}' template: src=springboot-upstart.conf.j2 dest=/etc/init/{{ item.name }}.conf owner=root group=root mode=0644
when: is_trusty with_items: '{{ springboot_apps }}'
when: ansible_service_mgr != 'systemd'
- name: Install the springboot logrotate configuration - name: Install the springboot systemd service unit
template: src=springboot-logrotate.j2 dest=/etc/logrotate.d/{{ item.name }} owner=root group=root mode=0444 template: src=springboot.service.systemd.j2 dest=/etc/systemd/system/{{ item.name }}.service mode=0644 owner=root group=root
with_items: '{{ springboot_apps }}' with_items: '{{ springboot_apps }}'
when: ansible_service_mgr == 'systemd'
notify: systemd reload
when: springboot_config - 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 }}'
- name: Ensure that the springboot service is running and enabled
service: name={{ item.name }} state=started enabled=yes
with_items: '{{ springboot_apps }}'
when: springboot_config | bool
tags: [ 'springboot', 'springboot_config' ] tags: [ 'springboot', 'springboot_config' ]

View File

@ -0,0 +1,30 @@
[Unit]
Description={{ item.name }}
After=network.target
[Service]
{% if item.envfile is defined %}
EnvironmentFile=/etc/myapp/environmentfile
{% endif %}
Type=simple
User={{ item.user }}
Group={{ item.user }}
WorkingDirectory={{ item.install_dir }}
{% if item.envfile is defined %}
ExecStart=/usr/bin/java $JAVA_OPTS -jar $EXEC_JAR
{% else %}
ExecStart=/usr/bin/java {{ item.java_opts }} -jar {{ item.install_dir }}/{{ item.name }}.jar
{% endif %}
StandardOutput=journal
StandardError=journal
SyslogIdentifier={{ item.name }}
SuccessExitStatus=143
TimeoutStopSec=10
Restart=on-failure
RestartSec=60
[Install]
WantedBy=multi-user.target