diff --git a/manifests/init.pp b/manifests/init.pp index 6d302a1a..e015ee46 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -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` @@ -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, diff --git a/templates/vault.initd.erb b/templates/vault.initd.erb index 94eb4bdc..10db97cf 100644 --- a/templates/vault.initd.erb +++ b/templates/vault.initd.erb @@ -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 @@ -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 diff --git a/templates/vault.systemd.erb b/templates/vault.systemd.erb index 9cb1d711..45887fa5 100644 --- a/templates/vault.systemd.erb +++ b/templates/vault.systemd.erb @@ -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 diff --git a/templates/vault.upstart.erb b/templates/vault.upstart.erb index 36ecd26a..20fa2c04 100644 --- a/templates/vault.upstart.erb +++ b/templates/vault.upstart.erb @@ -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] @@ -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