From f460f890daa4a7b6a33f28392c2b73413a31b400 Mon Sep 17 00:00:00 2001 From: Ian Fijolek Date: Thu, 21 Jul 2022 19:03:40 -0700 Subject: [PATCH] Use vault for backups jobs --- backups/backup.nomad | 32 +++++++++++++++++++++++++------- vault_hashi_vault_values.yml | 9 ++++++--- 2 files changed, 31 insertions(+), 10 deletions(-) diff --git a/backups/backup.nomad b/backups/backup.nomad index b23d3f9..09d5b68 100644 --- a/backups/backup.nomad +++ b/backups/backup.nomad @@ -10,6 +10,7 @@ job "backup" { constraint { attribute = "${node.unique.name}" # Only node with a backup job so far + # Remove when backing up all nodes value = "n2" } @@ -85,19 +86,36 @@ job "backup" { } } + vault { + policies = [ + "access-tables", + "nomad-task", + ] + } + env = { "MYSQL_HOST" = "${NOMAD_UPSTREAM_IP_mysql_server}" "MYSQL_PORT" = "${NOMAD_UPSTREAM_PORT_mysql_server}" - # TODO: Add user with access to all databases or variables for each user - "MYSQL_DATABASE" = "nextcloud" - "MYSQL_USER" = "nextcloud" - "MYSQL_PASSWORD" = "nextcloud" - - # TODO: Something from vault - "BACKUP_PASSPHRASE" = "secretpass" } template { + # Probably want to use database credentials that have access to dump all tables + data = <