Skip to content
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

Set db_user permissions again after migration #38

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 45 additions & 1 deletion roles/app/tasks/run_django_tasks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
- deploy-web
- deploy-backend

- name: "Reassign all object in database bar owned by db_user to django_migrations"
- name: "Reassign all object in database owned by db_user to django_migrations"
community.postgresql.postgresql_owner:
db: "{{ db_name }}"
new_owner: django_migrations
Expand All @@ -58,6 +58,50 @@
become: true
become_user: "{{ gunicorn_user }}"

- name: "Set db_user privs"
community.postgresql.postgresql_privs:
db: "{{ db_name }}"
role: "{{ db_user }}"
objs: ALL_IN_SCHEMA
privs: ALL
grant_option: true
become: true
become_user: postgres
tags:
- django.migrate
- deploy-web
- deploy-backend

- name: "Set db_user schema privs"
community.postgresql.postgresql_privs:
db: "{{ db_name }}"
role: "{{ db_user }}"
objs: public
privs: ALL
grant_option: true
type: schema
become: true
become_user: postgres
tags:
- django.migrate
- deploy-web
- deploy-backend

- name: "Set db_user sequence privs"
community.postgresql.postgresql_privs:
db: "{{ db_name }}"
role: "{{ db_user }}"
objs: ALL_IN_SCHEMA
privs: USAGE
grant_option: true
type: sequence
become: true
become_user: postgres
tags:
- django.migrate
- deploy-web
- deploy-backend

- name: Run Django compilemessages
ansible.builtin.command: "{{ virtualenv_path }}/bin/python {{ virtualenv_path }}/fragdenstaat.de/manage.py compilemessages -l de --ignore **node_modules/**"
args:
Expand Down