diff --git a/ansible/deploy.yaml b/ansible/deploy.yaml
index c39e108cb88ad7e3df8e7cc3da54374a10285ed6..cdeb4a235947cf121a4b82e18643b1e675048cc8 100644
--- a/ansible/deploy.yaml
+++ b/ansible/deploy.yaml
@@ -64,21 +64,23 @@
       command: service postgresql initdb 
       args:
         creates: /var/lib/pgsql/data/postgresql.conf
-    - name: Start PostgreSQL and enable at boot
-      service: name=postgresql
-               enabled=yes
-               state=started
     - name: Ensure PostgreSQL is listening on all localhost
       lineinfile: dest=/var/lib/pgsql/data/postgresql.conf
         regexp='^#?listen_addresses\s*='
         line="listen_addresses = '*'"
         state=present
-    - lineinfile: dest=/var/lib/pgsql/data/pg_hba.conf
-                  regexp='host\s+all\s+all\s+127.0.0.1/32\s+md5'
-                  line='host all all 127.0.0.1/32 md5'
-                  insertbefore=BOF
+    - name: copy pg_hba.conf file
+      copy: 
+        remote_src: true
+        src: /home/{{ deploy_user_name }}/iPPIDB/ansible/pg_hba.conf 
+        dest: /var/lib/pgsql/data/pg_hba.conf
+        owner: postgres
+        group: postgres
     - name: restart postgresql service
       systemd: state=restarted name=postgresql enabled=yes
+    - postgresql_db:
+      name: {{ dbname }}
+      owner: {{ dbuser }}
     - name: create db user
       become_user: "postgres"
       postgresql_user: