Commit 6814e8e7 authored by Agate's avatar Agate 💬

Merge branch 'db-issues' into 'master'

Fixed some db issues due to delegation

See merge request !15
parents 0234dbef 3b4126df
Pipeline #10484 passed with stages
in 8 minutes and 59 seconds
......@@ -14,8 +14,8 @@ funkwhale_database_managed: true
funkwhale_database_local: true
funkwhale_database_name: funkwhale
funkwhale_database_user: funkwhale
# the DB host as per your ansible inventory
funkwhale_database_host_ansible: localhost
# the DB host as per your ansible inventory. No delegation is used if left empty
funkwhale_database_host_ansible:
# the DB FQDN or IP for funkwhale connector configuration (ex: pg01.local)
funkwhale_database_host_app: localhost
funkwhale_database_port: 5432
......
......@@ -13,26 +13,25 @@
name: postgresql
state: started
- name: "Create {{ funkwhale_database_user }} database user on {{ funkwhale_database_host_ansible }} (local / passwordless)"
- name: "Create {{ funkwhale_database_user }} database user on {{ funkwhale_database_host_ansible or inventory_hostname }} (local / passwordless)"
become: true
become_user: postgres
when: funkwhale_database_managed and funkwhale_database_host_ansible == 'localhost'
when: funkwhale_database_managed and funkwhale_database_host_ansible == none
postgresql_user:
name: "{{ funkwhale_database_user }}"
login_user: postgres
delegate_to: "{{ funkwhale_database_host_ansible }}"
- name: "Create {{ funkwhale_database_user }} database user on {{ funkwhale_database_host_ansible }} (remote / with password)"
become: true
become_user: postgres
when: funkwhale_database_managed and funkwhale_database_host_ansible != 'localhost'
when: funkwhale_database_managed and funkwhale_database_host_ansible != none
postgresql_user:
name: "{{ funkwhale_database_user }}"
password: "{{ funkwhale_database_password }}"
login_user: postgres
delegate_to: "{{ funkwhale_database_host_ansible }}"
delegate_to: "{{ funkwhale_database_host_ansible or inventory_hostname }}"
- name: "Create {{ funkwhale_database_name }} database on {{ funkwhale_database_host_ansible }}"
- name: "Create {{ funkwhale_database_name }} database on {{ funkwhale_database_host_ansible or inventory_hostname}}"
become: true
become_user: postgres
when: funkwhale_database_managed
......@@ -42,7 +41,7 @@
owner: "{{ funkwhale_database_user }}"
encoding: UTF-8
template: template0
delegate_to: "{{ funkwhale_database_host_ansible }}"
delegate_to: "{{ funkwhale_database_host_ansible or inventory_hostname }}"
- name: set up pgsql extensions
become: yes
......@@ -55,6 +54,6 @@
loop: ['unaccent', 'citext']
loop_control:
loop_var: myext
delegate_to: "{{ funkwhale_database_host_ansible }}"
delegate_to: "{{ funkwhale_database_host_ansible or inventory_hostname }}"
...
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment