Browse Source

Merge pull request #535 from carljm/pg-passwords

Encrypt Postgres passwords, and fix change-reporting.
Sven Neuhaus 8 years ago
parent
commit
15a39c695d
2 changed files with 9 additions and 5 deletions
  1. 5
    3
      roles/mailserver/tasks/postfix.yml
  2. 4
    2
      roles/owncloud/tasks/owncloud.yml

+ 5
- 3
roles/mailserver/tasks/postfix.yml View File

@@ -16,12 +16,14 @@
16 16
   tags:
17 17
     - dependencies
18 18
 
19
-- name: Set postgres password
20
-  command: sudo -u {{ db_admin_username }} psql -d {{ db_admin_username }} -c "ALTER USER postgres with  password '{{ db_admin_password }}';"
19
+- name: Set password for PostgreSQL admin user
20
+  become: true
21
+  become_user: postgres
22
+  postgresql_user: name={{ db_admin_username }} password={{ db_admin_password }} encrypted=yes
21 23
   notify: import sql postfix
22 24
 
23 25
 - name: Create database user for mail server
24
-  postgresql_user: login_host=localhost login_user={{ db_admin_username }} login_password="{{ db_admin_password }}" name={{ mail_db_username }} password="{{ mail_db_password }}" state=present
26
+  postgresql_user: login_host=localhost login_user={{ db_admin_username }} login_password="{{ db_admin_password }}" name={{ mail_db_username }} password="{{ mail_db_password }}" encrypted=yes state=present
25 27
   notify: import sql postfix
26 28
 
27 29
 - name: Create database for mail server

+ 4
- 2
roles/owncloud/tasks/owncloud.yml View File

@@ -9,8 +9,10 @@
9 9
   tags:
10 10
     - dependencies
11 11
 
12
-- name: Set postgres administrator password
13
-  command: sudo -u {{ db_admin_username }} psql -c "ALTER USER postgres with password '{{ db_admin_password }}';"
12
+- name: Set password for PostgreSQL admin user
13
+  become: true
14
+  become_user: postgres
15
+  postgresql_user: name={{ db_admin_username }} password={{ db_admin_password }} encrypted=yes
14 16
 
15 17
 - name: Create database user for ownCloud
16 18
   postgresql_user: login_host=localhost login_user={{ db_admin_username }} login_password="{{ db_admin_password }}" name={{ owncloud_db_username }} password="{{ owncloud_db_password }}" role_attr_flags=CREATEDB state=present

Loading…
Cancel
Save