Skip to content
Snippets Groups Projects
Unverified Commit 3b4126df authored by Agate's avatar Agate :speech_balloon:
Browse files

Fixed some db issues due to delegation

parent 0234dbef
No related branches found
No related tags found
No related merge requests found
...@@ -14,8 +14,8 @@ funkwhale_database_managed: true ...@@ -14,8 +14,8 @@ funkwhale_database_managed: true
funkwhale_database_local: true funkwhale_database_local: true
funkwhale_database_name: funkwhale funkwhale_database_name: funkwhale
funkwhale_database_user: funkwhale funkwhale_database_user: funkwhale
# the DB host as per your ansible inventory # the DB host as per your ansible inventory. No delegation is used if left empty
funkwhale_database_host_ansible: localhost funkwhale_database_host_ansible:
# the DB FQDN or IP for funkwhale connector configuration (ex: pg01.local) # the DB FQDN or IP for funkwhale connector configuration (ex: pg01.local)
funkwhale_database_host_app: localhost funkwhale_database_host_app: localhost
funkwhale_database_port: 5432 funkwhale_database_port: 5432
......
...@@ -13,26 +13,25 @@ ...@@ -13,26 +13,25 @@
name: postgresql name: postgresql
state: started 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: true
become_user: postgres 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: postgresql_user:
name: "{{ funkwhale_database_user }}" name: "{{ funkwhale_database_user }}"
login_user: postgres login_user: postgres
delegate_to: "{{ funkwhale_database_host_ansible }}"
- name: "Create {{ funkwhale_database_user }} database user on {{ funkwhale_database_host_ansible }} (remote / with password)" - name: "Create {{ funkwhale_database_user }} database user on {{ funkwhale_database_host_ansible }} (remote / with password)"
become: true become: true
become_user: postgres 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: postgresql_user:
name: "{{ funkwhale_database_user }}" name: "{{ funkwhale_database_user }}"
password: "{{ funkwhale_database_password }}" password: "{{ funkwhale_database_password }}"
login_user: postgres 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: true
become_user: postgres become_user: postgres
when: funkwhale_database_managed when: funkwhale_database_managed
...@@ -42,7 +41,7 @@ ...@@ -42,7 +41,7 @@
owner: "{{ funkwhale_database_user }}" owner: "{{ funkwhale_database_user }}"
encoding: UTF-8 encoding: UTF-8
template: template0 template: template0
delegate_to: "{{ funkwhale_database_host_ansible }}" delegate_to: "{{ funkwhale_database_host_ansible or inventory_hostname }}"
- name: set up pgsql extensions - name: set up pgsql extensions
become: yes become: yes
...@@ -55,6 +54,6 @@ ...@@ -55,6 +54,6 @@
loop: ['unaccent', 'citext'] loop: ['unaccent', 'citext']
loop_control: loop_control:
loop_var: myext loop_var: myext
delegate_to: "{{ funkwhale_database_host_ansible }}" delegate_to: "{{ funkwhale_database_host_ansible or inventory_hostname }}"
... ...
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment