♻: add pg role determination to mastodon

This commit is contained in:
VC
2025-02-15 09:15:23 +01:00
parent 14f6dfde14
commit 7f8db91dfb
6 changed files with 189 additions and 3 deletions

View File

@@ -0,0 +1,15 @@
---
- name: Create mastodon db role
become_user: postgres
become: true
community.postgresql.postgresql_user:
name: "{{ mastodon_pg_role }}"
password: "{{ mastodon_pg_password }}"
- name: Create mastodon db
become_user: postgres
become: true
community.postgresql.postgresql_db:
name: "{{ mastodon_pg_database }}"
owner: "{{ mastodon_pg_role }}"

View File

@@ -1,5 +1,8 @@
---
- name: Init db
ansible.builtin.include_tasks: db.yml
- name: Create mastodon user
ansible.builtin.user:
name: mastodon
@@ -63,5 +66,15 @@
- name: Install mastodon
ansible.builtin.include_tasks: mastodon.yml
- name: Put env file
ansible.builtin.template:
src: "env.production.j2"
dest: "{{ mastodon_home }}/live/.env.production"
user: mastodon
group: mastodon
mode: "0o600"
notify:
- Restart mastodon
- name: Install tootctl cron
ansible.builtin.include_tasks: cron.yml