Support node-specific borg repo config
This commit is contained in:
@@ -7,6 +7,14 @@ apt_package "borgbackup"
|
||||
|
||||
borg_credentials = data_bag_item("credentials", "borg")
|
||||
|
||||
if borg_credentials["nodes"].keys.include?(node.name)
|
||||
passphrase = borg_credentials["nodes"][node.name]["passphrase"]
|
||||
repository = borg_credentials["nodes"][node.name]["repository"]
|
||||
else
|
||||
passphrase = borg_credentials["passphrase"]
|
||||
repository = borg_credentials["repository"]
|
||||
end
|
||||
|
||||
file "/root/.ssh/borg_rsa" do
|
||||
content borg_credentials["ssh_key"]
|
||||
mode '0600'
|
||||
@@ -15,8 +23,8 @@ end
|
||||
file "/root/.borg_credentials.env" do
|
||||
content <<-EOF
|
||||
BORG_RSH='ssh -i /root/.ssh/borg_rsa'
|
||||
BORG_PASSPHRASE=#{borg_credentials["passphrase"]}
|
||||
BORG_REPO='#{borg_credentials["repository"]}'
|
||||
BORG_PASSPHRASE=#{passphrase}
|
||||
BORG_REPO='#{repository}'
|
||||
EOF
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user