Sha256: f255afa83cab00551751b7a01d82c381f512637795a02cc2b7d1cac4d010c645

Contents?: true

Size: 1.02 KB

Versions: 15

Compression:

Stored size: 1.02 KB

Contents

#!/bin/bash

# This file was generated by Ansible for {{ ansible_fqdn }}
# Do NOT modify this file by hand!

WORKDIR={{backup_work}}/{{item.name}}

{% if item.source.startswith('postgresql://') %}

DBNAME={{item.source.split('postgresql://')[-1]}}
psql -U {{backup_postgres_user}} {{ '-h ' + backup_postgres_host  if backup_postgres_host else ''}} {{ ('-p %s' % backup_postgres_port)  if backup_postgres_port else ''}} $DBNAME < $WORKDIR/dump
rm -rf $WORKDIR/dump

{% elif item.source.startswith('mysql://') %}

{% if item.source == 'mysql://' %}
# Restore all databases
mysql -u {{backup_mysql_user}} -p{{backup_mysql_pass}} < ${WORKDIR}/dump
{% else %}
# Restore the passed database
DBNAME={{item.source.split('mysql://')[-1]}}
mysql -u {{backup_mysql_user}} -p{{backup_mysql_pass}} $DBNAME  < ${WORKDIR}/dump
rm -rf $WORKDIR/dump
{% endif %}

{% elif item.source.startswith('mongo://') %}

mongorestore --drop $WORKDIR/dump
rm -rf $WORKDIR/dump

{% endif %}

{% for action in item.restore_actions|default([]) %}
{{ action }}
{% endfor %}

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
taperole-2.1.1 vendor/Stouts.backup/templates/restore.j2
taperole-2.1.0 vendor/Stouts.backup/templates/restore.j2
taperole-2.0.7 vendor/Stouts.backup/templates/restore.j2
taperole-2.0.6 vendor/Stouts.backup/templates/restore.j2
taperole-2.0.5 vendor/Stouts.backup/templates/restore.j2
taperole-2.0.4 vendor/Stouts.backup/templates/restore.j2
taperole-2.0.3 vendor/Stouts.backup/templates/restore.j2
taperole-2.0.2 vendor/Stouts.backup/templates/restore.j2
taperole-2.0.1 vendor/Stouts.backup/templates/restore.j2
taperole-2.0.0 vendor/Stouts.backup/templates/restore.j2
taperole-1.8.2 vendor/Stouts.backup/templates/restore.j2
taperole-1.8.1 vendor/Stouts.backup/templates/restore.j2
taperole-1.8.0 vendor/Stouts.backup/templates/restore.j2
taperole-1.7.1 vendor/Stouts.backup/templates/restore.j2
taperole-1.7.0 vendor/Stouts.backup/templates/restore.j2