Last active
August 29, 2015 14:18
-
-
Save iggy/366611900342234aa184 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Tell each db server to run the pgsql command to coalesce the database | |
coalesce_db: | |
salt.function: | |
- name: postgres.psql_query | |
- tgt: 'tags:db' | |
- tgt_type: grain | |
- arg: | |
- "select pg_start_backup('foo');" | |
# we want our salt master to run the cloud snapshot script | |
# TODO at some point move this to use salt.cloud.* functionality | |
db_snapshot: | |
salt.function: | |
- name: cmd.run | |
# FIXME switch to complex match, but it wasn't working | |
- tgt: 'tags:master' | |
- tgt_type: grain | |
- arg: | |
- /path/to/cloud.py snapshot --tags db -- {{ salt['grains.get']('ocsenv') }} | |
# now that the master has snapshotted the volumes, unfreeze the DB servers | |
unfreeze_db: | |
salt.function: | |
- name: postgres.psql_query | |
- tgt: 'tags:db' | |
- tgt_type: grain | |
- arg: | |
- "select pg_stop_backup();" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
croniter: | |
pip.installed | |
db-backup-job: | |
schedule.present: | |
- function: state.orchestrate | |
- args: | |
- backups.db.orchestrate | |
- cron: '0 3 * * *' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment