-
Notifications
You must be signed in to change notification settings - Fork 59
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
128 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
# -*- coding: utf-8 -*- | ||
# vim: ft=sls syntax=yaml softtabstop=2 tabstop=2 shiftwidth=2 expandtab autoindent | ||
{% from "vault/map.jinja" import vault with context %} | ||
|
||
vault-config-clean-file-absent: | ||
file.absent: | ||
- name: /etc/vault | ||
- name: {{ vault.config_path }}/vault |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
{% from "vault/map.jinja" import vault with context -%} | ||
#!/bin/sh | ||
|
||
# PROVIDE: vault | ||
# REQUIRE: DAEMON | ||
# KEYWORD: shutdown | ||
# | ||
# Add the following lines to /etc/rc.conf.local or /etc/rc.conf | ||
# to enable this service: | ||
# | ||
# vault_enable (bool):boolSet it to YES to enable vault. | ||
#toDefault is "NO". | ||
# vault_user (user):userSet user to run vault. | ||
#toDefault is "vault". | ||
# vault_group (group):groupSet group to run vault. | ||
#toDefault is "vault". | ||
# vault_config (dir):dirSet vault config file. | ||
#vaultDefault is "/usr/local/etc/vault/conf.d/vault.json". | ||
# vault_syslog_output_enable (bool):boolSet to enable syslog output. | ||
#boolSetDefault is "NO". See daemon(8). | ||
# vault_syslog_output_priority (str):strSet syslog priority if syslog enabled. | ||
#strSetDefault is "info". See daemon(8). | ||
# vault_syslog_output_facility (str):strSet syslog facility if syslog enabled. | ||
#strSetDefault is "daemon". See daemon(8). | ||
|
||
. /etc/rc.subr | ||
|
||
name=vault | ||
rcvar=vault_enable | ||
|
||
load_rc_config $name | ||
|
||
: ${vault_enable:="NO"} | ||
: ${vault_user:="vault"} | ||
: ${vault_group:="vault"} | ||
: ${vault_config:="{{ vault.config_path }}/vault/conf.d/config.json"} | ||
: ${vault_env:="HOME=/var/lib/vault"} | ||
|
||
DAEMON=$(/usr/sbin/daemon 2>&1 | grep -q syslog ; echo $?) | ||
if [ ${DAEMON} -eq 0 ]; then | ||
: ${vault_syslog_output_enable:="NO"} | ||
: ${vault_syslog_output_priority:="info"} | ||
: ${vault_syslog_output_facility:="daemon"} | ||
if checkyesno vault_syslog_output_enable; then | ||
vault_syslog_output_flags="-t ${name} -T ${name}" | ||
|
||
if [ -n "${vault_syslog_output_priority}" ]; then | ||
vault_syslog_output_flags="${vault_syslog_output_flags} -s ${vault_syslog_output_priority}" | ||
fi | ||
|
||
if [ -n "${vault_syslog_output_facility}" ]; then | ||
vault_syslog_output_flags="${vault_syslog_output_flags} -l ${vault_syslog_output_facility}" | ||
fi | ||
fi | ||
else | ||
vault_syslog_output_enable="NO" | ||
vault_syslog_output_flags="" | ||
fi | ||
|
||
pidfile=/var/run/vault.pid | ||
procname="/usr/local/bin/vault" | ||
command="/usr/sbin/daemon" | ||
command_args="-f ${vault_syslog_output_flags} -p ${pidfile} /usr/bin/env ${vault_env} ${procname} server {% if vault.dev_mode %} -dev {% else %} -config=${vault_config} {% endif %}" | ||
|
||
extra_commands="reload monitor" | ||
monitor_cmd=vault_monitor | ||
start_precmd=vault_startprecmd | ||
{% if not vault.dev_mode %} | ||
required_files="$vault_config" | ||
{% endif %} | ||
|
||
vault_monitor() | ||
{ | ||
sig_reload=USR1 | ||
run_rc_command "reload" | ||
} | ||
|
||
vault_startprecmd() | ||
{ | ||
if [ ! -e ${pidfile} ]; then | ||
install -o ${vault_user} -g ${vault_group} /dev/null ${pidfile}; | ||
fi | ||
|
||
if [ ! -d ${vault_dir} ]; then | ||
install -d -o ${vault_user} -g ${vault_group} ${vault_dir} | ||
fi | ||
} | ||
|
||
run_rc_command "$1" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters