[add] role:postgresql-for-mastodon
This commit is contained in:
parent
4b31dbc90a
commit
15b68794eb
5
roles/postgresql-for-mastodon/defaults/main.json
Normal file
5
roles/postgresql-for-mastodon/defaults/main.json
Normal file
|
|
@ -0,0 +1,5 @@
|
||||||
|
{
|
||||||
|
"var_postgresql_for_mastodon_username": "mastodon_user",
|
||||||
|
"var_postgresql_for_mastodon_password": "REPLACE_ME",
|
||||||
|
"var_postgresql_for_mastodon_schema": "mastodon"
|
||||||
|
}
|
||||||
49
roles/postgresql-for-mastodon/tasks/main.json
Normal file
49
roles/postgresql-for-mastodon/tasks/main.json
Normal 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_mastodon_username}}",
|
||||||
|
"password": "{{var_postgresql_for_mastodon_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_mastodon_schema}}",
|
||||||
|
"owner": "{{var_postgresql_for_mastodon_username}}"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "rights",
|
||||||
|
"become": true,
|
||||||
|
"become_user": "postgres",
|
||||||
|
"community.postgresql.postgresql_privs": {
|
||||||
|
"state": "present",
|
||||||
|
"db": "{{var_postgresql_for_mastodon_schema}}",
|
||||||
|
"objs": "ALL_IN_SCHEMA",
|
||||||
|
"roles": "{{var_postgresql_for_mastodon_username}}",
|
||||||
|
"privs": "ALL",
|
||||||
|
"grant_option": true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
Loading…
Reference in a new issue