Allow to pass extra attributes to backup PostgreSQL databases

This commit is contained in:
Greg Karékinian
2019-05-14 16:39:21 +02:00
parent c9547582b7
commit d398c167ca
4 changed files with 26 additions and 20 deletions

View File

@@ -24,16 +24,22 @@
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
postgresql_data_bag_item = data_bag_item('credentials', 'postgresql')
unless node.chef_environment == "development"
# backup the data dir and the config files
node.override["backup"]["archives"]["ejabberd"] = ["/opt/ejabberd", "/var/www/xmpp.kosmos.org", "/var/www/xmpp.5apps.com"]
unless node["backup"]["postgresql"]["databases"].include? "ejabberd"
node.override["backup"]["postgresql"]["databases"] =
node["backup"]["postgresql"]["databases"].to_a << "ejabberd"
unless node["backup"]["postgresql"]["databases"].keys.include? "ejabberd"
node.override["backup"]["postgresql"]["databases"]["ejabberd"] = {
username: "ejabberd",
password: postgresql_data_bag_item['ejabberd_user_password']
}
end
unless node["backup"]["postgresql"]["databases"].include? "ejabberd_5apps"
node.override["backup"]["postgresql"]["databases"] =
node["backup"]["postgresql"]["databases"].to_a << "ejabberd_5apps"
unless node["backup"]["postgresql"]["databases"].keys.include? "ejabberd_5apps"
node.override["backup"]["postgresql"]["databases"]["ejabberd_5apps"] = {
username: "ejabberd",
password: postgresql_data_bag_item['ejabberd_user_password']
}
end
include_recipe "backup"
end