ansible-roles/webapps/peertube/tasks/postgres-user.yml
Patrick Marchand d35f2bcae7
All checks were successful
gitea/ansible-roles/pipeline/head This commit looks good
Added peertube role
Not finished, I got to webapps/peertube/tasks/postgres-user.yml
before committing what I'd done.
2022-11-11 16:36:52 -05:00

41 lines
1 KiB
YAML

---
- name: Create a new database
community.postgresql.postgresql_db:
name: "{{ peertube_db_name }}"
tags:
- peertube
- name: Generate Postgres password
command: 'apg -n 1 -m 16 -M lcN'
register: peertube_db_pass_apg
check_mode: no
changed_when: False
tags:
- peertube
- name: Connect to peertube database, create peertube user, and grant access to database
community.postgresql.postgresql_user:
db: "{{ peertube_db_name }}"
name: "{{ peertube_db_user }}"
password: "{{ peertube_db_pass_apg.stdout }}"
priv: "ALL"
tags:
- peertube
- name: Store credentials in my.cnf
ini_file:
dest: "{{ nextcloud_home }}/.my.cnf"
owner: "{{ nextcloud_user }}"
group: "{{ nextcloud_user }}"
mode: "0600"
section: client
option: "{{ item.option }}"
value: "{{ item.value }}"
loop:
- { option: "user", value: "{{ nextcloud_db_user }}" }
- { option: "database", value: "{{ nextcloud_db_name }}" }
- { option: "password", value: "{{ nextcloud_db_pass }}" }
tags:
- nextcloud