From 20dba8b388432a33b1040e0299613484f637b411 Mon Sep 17 00:00:00 2001 From: Brad Beam Date: Sat, 23 Jun 2018 15:14:40 -0500 Subject: [PATCH] Adding uuidfile for rkt based vault to properly cleanup after itself --- roles/vault/templates/rkt.service.j2 | 46 ++++++++++++++++------------ 1 file changed, 27 insertions(+), 19 deletions(-) diff --git a/roles/vault/templates/rkt.service.j2 b/roles/vault/templates/rkt.service.j2 index 6a4c3d77a..e92221161 100644 --- a/roles/vault/templates/rkt.service.j2 +++ b/roles/vault/templates/rkt.service.j2 @@ -12,26 +12,34 @@ LimitNOFILE=40000 # Container has the following internal mount points: # /vault/file/ # File backend storage location # /vault/logs/ # Log files +ExecStartPre=-/usr/bin/rkt rm --uuid-file=/var/run/vault.uuid + ExecStart=/usr/bin/rkt run \ ---insecure-options=image \ ---volume hosts,kind=host,source=/etc/hosts,readOnly=true \ ---mount volume=hosts,target=/etc/hosts \ ---volume=volume-vault-file,kind=host,source=/var/lib/vault \ ---volume=volume-vault-logs,kind=host,source={{ vault_log_dir }} \ ---volume=vault-cert-dir,kind=host,source={{ vault_cert_dir }} \ ---mount=volume=vault-cert-dir,target={{ vault_cert_dir }} \ ---volume=vault-conf-dir,kind=host,source={{ vault_config_dir }} \ ---mount=volume=vault-conf-dir,target={{ vault_config_dir }} \ ---volume=vault-secrets-dir,kind=host,source={{ vault_secrets_dir }} \ ---mount=volume=vault-secrets-dir,target={{ vault_secrets_dir }} \ ---volume=vault-roles-dir,kind=host,source={{ vault_roles_dir }} \ ---mount=volume=vault-roles-dir,target={{ vault_roles_dir }} \ ---volume=etcd-cert-dir,kind=host,source={{ etcd_cert_dir }} \ ---mount=volume=etcd-cert-dir,target={{ etcd_cert_dir }} \ -docker://{{ vault_image_repo }}:{{ vault_image_tag }} \ ---name={{ vault_container_name }} --net=host \ ---caps-retain=CAP_IPC_LOCK \ ---exec vault -- server --config={{ vault_config_dir }}/config.json + --insecure-options=image \ + --volume hosts,kind=host,source=/etc/hosts,readOnly=true \ + --mount volume=hosts,target=/etc/hosts \ + --volume=volume-vault-file,kind=host,source=/var/lib/vault \ + --volume=volume-vault-logs,kind=host,source={{ vault_log_dir }} \ + --volume=vault-cert-dir,kind=host,source={{ vault_cert_dir }} \ + --mount=volume=vault-cert-dir,target={{ vault_cert_dir }} \ + --volume=vault-conf-dir,kind=host,source={{ vault_config_dir }} \ + --mount=volume=vault-conf-dir,target={{ vault_config_dir }} \ + --volume=vault-secrets-dir,kind=host,source={{ vault_secrets_dir }} \ + --mount=volume=vault-secrets-dir,target={{ vault_secrets_dir }} \ + --volume=vault-roles-dir,kind=host,source={{ vault_roles_dir }} \ + --mount=volume=vault-roles-dir,target={{ vault_roles_dir }} \ + --volume=etcd-cert-dir,kind=host,source={{ etcd_cert_dir }} \ + --mount=volume=etcd-cert-dir,target={{ etcd_cert_dir }} \ + docker://{{ vault_image_repo }}:{{ vault_image_tag }} \ + --uuid-file-save=/var/run/vault.uuid \ + --name={{ vault_container_name }} \ + --net=host \ + --caps-retain=CAP_IPC_LOCK \ + --exec vault -- \ + server \ + --config={{ vault_config_dir }}/config.json + +ExecStop=-/usr/bin/rkt stop --uuid-file=/var/run/vault.uuid [Install] WantedBy=multi-user.target