Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

allow for server or agent unit file #188

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,9 @@
# Customise the name of the system service provider; this
# also controls the init configuration files that are installed.
#
# * `service_type`
# The type of service defaults to server, but can also be agent
#
# * `service_options`
# Extra argument to pass to `vault server`, as per:
# `vault server --help`
Expand Down Expand Up @@ -105,6 +108,7 @@
Optional[String] $max_lease_ttl = $::vault::params::max_lease_ttl,
$disable_mlock = $::vault::params::disable_mlock,
$manage_file_capabilities = $::vault::params::manage_file_capabilities,
$service_type = 'server',
$service_options = '',
$num_procs = $::vault::params::num_procs,
$install_method = $::vault::params::install_method,
Expand Down
4 changes: 2 additions & 2 deletions templates/vault.initd.erb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/sh
#
# vault - this script manages the vault server
# vault - this script manages the vault <%= scope['vault::service_type'] %>
#
# chkconfig: 3 85 15
# processname: vault
Expand Down Expand Up @@ -51,7 +51,7 @@ start() {
touch $logfile $pidfile
chown <%= scope['vault::user'] %> $logfile $pidfile
export GOMAXPROCS=${GOMAXPROCS:-<%= scope['vault::num_procs'] %>}
daemon --user <%= scope['vault::user'] %> "{ $exec server -config=$conffile $OPTIONS &>> $logfile & }; echo \$! >| $pidfile"
daemon --user <%= scope['vault::user'] %> "{ $exec <%= scope['vault::service_type'] %> -config=$conffile $OPTIONS &>> $logfile & }; echo \$! >| $pidfile"

RETVAL=$?
if [ $RETVAL -eq 0 ]; then
Expand Down
2 changes: 1 addition & 1 deletion templates/vault.systemd.erb
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ CapabilityBoundingSet=CAP_SYSLOG CAP_IPC_LOCK
<% end -%>
NoNewPrivileges=yes
Environment=GOMAXPROCS=<%= scope['vault::num_procs'] %>
ExecStart=<%= scope['vault::bin_dir'] %>/vault server -config=<%= scope['vault::config_dir'] %>/config.json <%= scope['vault::service_options'] %>
ExecStart=<%= scope['vault::bin_dir'] %>/vault <%= scope['vault::service_type'] %> -config=<%= scope['vault::config_dir'] %>/config.json <%= scope['vault::service_options'] %>
KillSignal=SIGINT
TimeoutStopSec=30s
Restart=on-failure
Expand Down
4 changes: 2 additions & 2 deletions templates/vault.upstart.erb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# this file has been put in place by the jsok/vault Puppet module (https://forge.puppetlabs.com/jsok/vault)
# any changes will be overwritten if Puppet is run again
###########################################################################################################
description "vault server"
description "vault <%= scope['vault::service_type'] %>"
start on (local-filesystems and net-device-up IFACE!=lo)
stop on runlevel [06]

Expand All @@ -18,7 +18,7 @@ script
export GOMAXPROCS=${GOMAXPROCS:-<%= scope['vault::num_procs'] %>}
[ -e /etc/default/$UPSTART_JOB ] && . /etc/default/$UPSTART_JOB
exec >> $LOG_FILE 2>&1
exec start-stop-daemon -u $USER -g $GROUP -p $PID_FILE -x $VAULT -S -- server -config=$CONFIG <%= scope['vault::service_options'] %>
exec start-stop-daemon -u $USER -g $GROUP -p $PID_FILE -x $VAULT -S -- <%= scope['vault::service_type'] %> -config=$CONFIG <%= scope['vault::service_options'] %>
end script

respawn
Expand Down