-
Notifications
You must be signed in to change notification settings - Fork 74
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[CP4BA] Cleaning PostgreSQL scripts #835
Merged
Merged
Conversation
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
proj2 database is already created in previous ansible task `ADP proj DBs` Signed-off-by: Pierre DANIEL <[email protected]>
Replace `CREATE ROLE` syntax with its equivalent USER syntax with clearer intent. Signed-off-by: Pierre DANIEL <[email protected]>
Remove some unnecessary commands like `GRANT ...` for database/tablespace OWNERs, as they already have those permissions. Signed-off-by: Pierre DANIEL <[email protected]>
Some `CREATE TABLESPACE` commands are declared after and/or forgotten in the `CREATE DATABASE` command. Databases that didn't already declare a tablespace will continue to use the default tablespace `pg_default` Signed-off-by: Pierre DANIEL <[email protected]>
Fix other `CREATE DATABASE` commands using the `pg_default` tablespace Signed-off-by: Pierre DANIEL <[email protected]>
Remove the `AUTHORIZATION` as the schema is already owned by the basdb `USER` creating it. Signed-off-by: Pierre DANIEL <[email protected]>
Remove `CONNECT` priviledges for all `PUBLIC` accounts on databases. This prevents any `USER`s outside the db ower and database superuser to use the db. Signed-off-by: Pierre DANIEL <[email protected]>
719097c
to
10edbf7
Compare
- Remove "_tbs" suffix from ansible tasklist `remove-postgresql-tablespace.yml` for better variable meaning `common_postgresql_tablespace_name` (and not database name) - Add "_tbs" suffix back to the "with_items" list used by the removal role to index tablespaces - To normalize tablespaces naming on filesystem and folder removal, "_tbs" suffix is also added in tablespace folder location Signed-off-by: Pierre DANIEL <[email protected]>
Fix naming in ansible task responsible for tablespace folder creation. Signed-off-by: Pierre DANIEL <[email protected]>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hello again cpd team!
As I was working on PR #826 , I noticed a lot of possible improvements in the scripts creating the Postgres DB.
Here are my submissions ; I think this should improve the global readability of the ansible scripts.
I also have a question about a part of the scripts, cf. to this other question at end of this PR description.
TL;DR
This patch fix multiple discrepancies between some identical pg SQL snippets, some incoherence/useless code and simplify the global readability of those scrips (in my opinion — Feel free to debate with me on this! 😄 )
List of Changes
CREATE ROLE
with the simplerCREATE USER
that has better intent on the expected usage for thisROLE
GRANT
as the database/tablespace OWNERs already have those permissionCREATE TABLESPACE
not used during database creationAUTHORIZATION
forbasdb
users owning the created schemapublic
users.I'm waiting for your feedback! 😄