hcp-ansible/roles/hashicorp_vault/templates/vault.service.j2

38 lines
1.0 KiB
Django/Jinja

[Unit]
Description="HashiCorp Vault - A tool for managing secrets"
Documentation=https://www.vaultproject.io/docs/
Requires=network-online.target
After=network-online.target
ConditionFileNotEmpty={{ hashi_vault_config_dir }}/vault.json
StartLimitIntervalSec=60
StartLimitBurst=3
{% if hashi_vault_configuration.storage.consul is defined or hashi_vault_configuration.service_registration.consul is defined %}
Wants=consul.service
After=consul.service
{% endif %}
[Service]
Type=notify
EnvironmentFile=-{{ hashi_vault_config_dir }}/vault.env
User={{ hashi_vault_user }}
Group={{ hashi_vault_group }}
ProtectSystem=full
ProtectHome=read-only
PrivateTmp=yes
PrivateDevices=yes
SecureBits=keep-caps
AmbientCapabilities=CAP_IPC_LOCK
CapabilityBoundingSet=CAP_SYSLOG CAP_IPC_LOCK
NoNewPrivileges=yes
ExecStart=/usr/bin/vault server -config={{ hashi_vault_config_dir }}
ExecReload=/bin/kill --signal HUP $MAINPID
KillMode=process
KillSignal=SIGINT
Restart=on-failure
RestartSec=5
TimeoutStopSec=30
LimitNOFILE=65536
LimitMEMLOCK=infinity
[Install]
WantedBy=multi-user.target