Browse Source

postgresql fix database access

master
parent
commit
3b0951a4a4
1 changed files with 14 additions and 4 deletions
  1. +14
    -4
      tasks/postgresql.yaml

+ 14
- 4
tasks/postgresql.yaml View File

@@ -5,6 +5,14 @@
pkg: python-psycopg2 pkg: python-psycopg2
delegate_to: "{{ (nextcloud_database_host != 'localhost') | ternary(nextcloud_database_host,inventory_hostname) }}" delegate_to: "{{ (nextcloud_database_host != 'localhost') | ternary(nextcloud_database_host,inventory_hostname) }}"


- name: postgresql user
postgresql_user:
name: "{{ nextcloud_database_user }}"
password: "{{ nextcloud_database_pass }}"
delegate_to: "{{ (nextcloud_database_host != 'localhost') | ternary(nextcloud_database_host,inventory_hostname) }}"
become: yes
become_user: postgres

- name: postgresql database - name: postgresql database
postgresql_db: postgresql_db:
name: "{{nextcloud_database_name}}" name: "{{nextcloud_database_name}}"
@@ -12,15 +20,17 @@
lc_collate: "{{nextcloud_postgresql_lc}}" lc_collate: "{{nextcloud_postgresql_lc}}"
lc_ctype: "{{nextcloud_postgresql_lc}}" lc_ctype: "{{nextcloud_postgresql_lc}}"
template: template0 template: template0
owner: "{{nextcloud_database_user}}"
delegate_to: "{{ (nextcloud_database_host != 'localhost') | ternary(nextcloud_database_host,inventory_hostname) }}" delegate_to: "{{ (nextcloud_database_host != 'localhost') | ternary(nextcloud_database_host,inventory_hostname) }}"
become: yes become: yes
become_user: postgres become_user: postgres


- name: postgresql user
postgresql_user:
name: "{{ nextcloud_database_user }}"
password: "{{ nextcloud_database_pass }}"
- name: postgresql access
postgresql_privs:
db: "{{nextcloud_database_name}}" db: "{{nextcloud_database_name}}"
privs: ALL
type: database
role: "{{ nextcloud_database_user }}"
delegate_to: "{{ (nextcloud_database_host != 'localhost') | ternary(nextcloud_database_host,inventory_hostname) }}" delegate_to: "{{ (nextcloud_database_host != 'localhost') | ternary(nextcloud_database_host,inventory_hostname) }}"
become: yes become: yes
become_user: postgres become_user: postgres

Loading…
Cancel
Save