-
-
Save billfehring/3f15e050415e1615ccb7 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
# temp start postgres | |
from subprocess import Popen | |
def init_and_start_db(): | |
cmd_str = '/usr/local/etc/rc.d/postgresql initdb && /usr/local/etc/rc.d/postgresql start' | |
proc = Popen([cmd_str], shell=True, | |
stdin=None, stdout=None, stderr=None, close_fds=True) | |
return cmd_str |
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
postgres-server-pkg: | |
pkg.installed: | |
- name: postgresql-server | |
/etc/rc.conf: | |
file.append: | |
- text: | |
- postgresql_enable="YES" | |
- postgresql_data="/zpath/db" | |
- postgresql_flags="-m fast" | |
- postgresql_initdb_flags="--encoding=utf-8 --lc-collate=C" | |
- postgresql_class="default" | |
- postgresql_profiles="" | |
- require_in: | |
- service: postgresql | |
- cmd: init_postgres_db | |
init_postgres_db: | |
cmd.call: | |
- name: bsdpg | |
- func: init_and_start_db | |
- unless: stat /zpath/db/postgresql.conf | |
- require: | |
- pkg: postgres-server-pkg | |
- require_in: | |
- service: postgresql | |
postgresql: | |
service: | |
- running | |
- sig: postgres | |
- require: | |
- pkg: postgres-server-pkg | |
include: | |
- zpath.postgres.database |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment