Commit e9c3f577 authored by Steve Weber's avatar Steve Weber
Browse files

rt1188031

parent a14dc1e4
#!/bin/bash
# SYNC: {{vars.databases.default.HOST}}/{{vars.databases.default.NAME}}
# SYNC: {{vars.settings.databases.default.HOST}}/{{vars.settings.databases.default.NAME}}
# USING: {{vars.database_sync.HOST}}/{{vars.database_sync.NAME}}
command -v apt && apt -y install postgresql-client
#echo '{{vars.database_sync.HOST}}:{{vars.database_sync.PORT}}:{{vars.database_sync.NAME}}:{{vars.database_sync.USER}}:{{vars.database_sync.PASSWORD}}' > ./.pgpass
#echo '{{vars.databases.default.HOST}}:{{vars.databases.default.PORT}}:{{vars.databases.default.NAME}}:{{vars.databases.default.USER}}:{{vars.databases.default.PASSWORD}}' >> ./.pgpass
#echo '{{vars.settings.databases.default.HOST}}:{{vars.settings.databases.default.PORT}}:{{vars.settings.databases.default.NAME}}:{{vars.settings.databases.default.USER}}:{{vars.settings.databases.default.PASSWORD}}' >> ./.pgpass
#chmod 0700 ./.pgpass
#export PGPASSFILE=./.pgpass
echo ""
echo "**** WIPE DATABASE (tables) ****"
PGPASSWORD={{vars.databases.default.PASSWORD}} psql \
--host={{vars.databases.default.HOST}} \
--username={{vars.databases.default.USER}} \
--dbname={{vars.databases.default.NAME}} \
PGPASSWORD={{vars.settings.databases.default.PASSWORD}} psql \
--host={{vars.settings.databases.default.HOST}} \
--username={{vars.settings.databases.default.USER}} \
--dbname={{vars.settings.databases.default.NAME}} \
-t -c 'DROP SCHEMA public CASCADE; CREATE SCHEMA public; GRANT ALL ON SCHEMA public TO postgres; GRANT ALL ON SCHEMA public TO public;' \
| PGPASSWORD={{vars.databases.default.PASSWORD}} psql \
--host={{vars.databases.default.HOST}} \
--username={{vars.databases.default.USER}} \
--dbname={{vars.databases.default.NAME}}
| PGPASSWORD={{vars.settings.databases.default.PASSWORD}} psql \
--host={{vars.settings.databases.default.HOST}} \
--username={{vars.settings.databases.default.USER}} \
--dbname={{vars.settings.databases.default.NAME}}
# another way to drop objects...
# -c "select 'drop table \"' || tablename || '\" cascade;' from pg_tables where schemaname='public'" \
# -c 'DROP SCHEMA public CASCADE; CREATE SCHEMA public; GRANT ALL ON SCHEMA public TO postgres; GRANT ALL ON SCHEMA public TO public;' \
......@@ -33,7 +33,7 @@ PGPASSWORD={{vars.database_sync.PASSWORD}} pg_dump \
--username={{vars.database_sync.USER}} \
--dbname={{vars.database_sync.NAME}} \
--no-owner --clean \
| PGPASSWORD={{vars.databases.default.PASSWORD}} psql \
--host={{vars.databases.default.HOST}} \
--username={{vars.databases.default.USER}} \
--dbname={{vars.databases.default.NAME}}
| PGPASSWORD={{vars.settings.databases.default.PASSWORD}} psql \
--host={{vars.settings.databases.default.HOST}} \
--username={{vars.settings.databases.default.USER}} \
--dbname={{vars.settings.databases.default.NAME}}
......@@ -190,12 +190,3 @@ include:
- require:
- file: {{sls}} service
{{sls}} check for security issues in packages:
cmd.run:
- name: bash -c "source '{{vars.dir_venv}}/bin/activate' && ( python -m pip install --upgrade safety ; safety check -r ./requirements.txt ; )"
- cwd: {{vars.dir_src}}
- runas: {{vars.user}}
- env:
- LC_ALL: C.UTF-8
- LANG: C.UTF-8
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment