[add] role:postgresql-for-vikunja

This commit is contained in:
roydfalk 2024-06-04 10:03:33 +02:00
parent 70bd2098b0
commit e442272e18
2 changed files with 54 additions and 0 deletions

View file

@ -0,0 +1,5 @@
{
"var_postgresql_for_vikunja_username": "vikunja_user",
"var_postgresql_for_vikunja_password": "REPLACE_ME",
"var_postgresql_for_vikunja_schema": "vikunja"
}

View file

@ -0,0 +1,49 @@
[
{
"name": "packages",
"become": true,
"ansible.builtin.apt": {
"update_cache": true,
"pkg": [
"acl",
"python3-psycopg2"
]
}
},
{
"name": "user",
"become": true,
"become_user": "postgres",
"community.postgresql.postgresql_user": {
"state": "present",
"name": "{{var_postgresql_for_vikunja_username}}",
"password": "{{var_postgresql_for_vikunja_password}}"
},
"environment": {
"PGOPTIONS": "-c password_encryption=scram-sha-256"
}
},
{
"name": "schema",
"become": true,
"become_user": "postgres",
"community.postgresql.postgresql_db": {
"state": "present",
"name": "{{var_postgresql_for_vikunja_schema}}",
"owner": "{{var_postgresql_for_vikunja_username}}"
}
},
{
"name": "rights",
"become": true,
"become_user": "postgres",
"community.postgresql.postgresql_privs": {
"state": "present",
"db": "{{var_postgresql_for_vikunja_schema}}",
"objs": "ALL_IN_SCHEMA",
"roles": "{{var_postgresql_for_vikunja_username}}",
"privs": "ALL",
"grant_option": true
}
}
]