Skip to content

Commit

Permalink
Added state to configure Cerebro systemd unit
Browse files Browse the repository at this point in the history
  • Loading branch information
psmiraglia committed Jun 30, 2017
1 parent 62f1741 commit 1995835
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 0 deletions.
20 changes: 20 additions & 0 deletions cerebro/service.sls
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{% from 'cerebro/map.jinja' import cerebro with context %}
cerebro_systemd_unit:
file.managed:
- name: /etc/systemd/system/{{ cerebro.service }}.service
- source: salt://cerebro/templates/cerebro.service.jinja
- template: jinja
- context:
cerebro: {{ cerebro }}
module.run:
- name: service.systemctl_reload
- onchanges:
- file: cerebro_systemd_unit
cerebro_running:
service.running:
- name: {{ cerebro.service }}
- enable: True
- require:
- file: cerebro_systemd_unit
21 changes: 21 additions & 0 deletions cerebro/templates/cerebro.service.jinja
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
[Unit]
Description=Cerebro
Documentation=https://github.com/lmenezes/cerebro
Requires=network.target remote-fs.target
After=network.target remote-fs.target

[Service]
Type=simple
PIDFile={{ cerebro.home }}/cerebro.pid
User={{ cerebro.user }}
Group={{ cerebro.group }}
{%- if cerebro.java_home %}
Environment=JAVA_HOME={{ cerebro.java_home }}
{%- endif %}
ExecStart={{ cerebro.home }}/bin/cerebro -Dconfig.file={{ cerebro.home }}/conf/application.conf
Restart=on-failure
SyslogIdentifier={{ cerebro.service }}
WorkingDirectory={{ cerebro.home }}

[Install]
WantedBy=multi-user.target

0 comments on commit 1995835

Please sign in to comment.