Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save magicrobotmonkey/268520c8293fc8e53f87fd2f645232c1 to your computer and use it in GitHub Desktop.
Save magicrobotmonkey/268520c8293fc8e53f87fd2f645232c1 to your computer and use it in GitHub Desktop.
ansible and postgres starting and stopping
# handy for waiting for postgres to restore/catch up to master
- name: wait for db to come up
shell: until /usr/bin/pg_isready; do sleep 1; done
args:
executable: /bin/bash
changed_when: false
delegate_to: "{{ database_host }}"
become_user: postgres
run_once: true
# handy when waiting for postgres to shutdown so you can restore a wal-e backup
- name: wait for db to stop
shell: while /usr/bin/pg_isready; do sleep 1; done
args:
executable: /bin/bash
changed_when: false
delegate_to: "{{ database_host }}"
become_user: postgres
run_once: true
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment