Extract mastodon db backup to its own recipe

This commit is contained in:
Greg Karékinian
2022-11-07 16:18:32 +01:00
parent 4188b2976b
commit 4bfb7d5f5d
4 changed files with 23 additions and 15 deletions

View File

@@ -0,0 +1,18 @@
#
# Cookbook Name:: kosmos-mastodon
# Recipe:: backup
#
postgresql_data_bag_item = data_bag_item('credentials', 'postgresql')
unless node.chef_environment == "development"
unless node["backup"]["postgresql"]["databases"].keys.include? 'mastodon'
node.override["backup"]["postgresql"]["host"] = "pg.kosmos.local"
node.override["backup"]["postgresql"]["databases"]["mastodon"] = {
username: "mastodon",
password: postgresql_data_bag_item['mastodon_user_password']
}
end
include_recipe "backup"
end

View File

@@ -14,18 +14,3 @@ postgresql_database 'mastodon' do
owner 'mastodon'
action :create
end
#
# Backup
#
unless node.chef_environment == "development"
unless node["backup"]["postgresql"]["databases"].keys.include? 'mastodon'
node.override["backup"]["postgresql"]["databases"]["mastodon"] = {
username: "mastodon",
password: postgresql_data_bag_item['mastodon_user_password']
}
end
include_recipe "backup"
end