Advertisement
Guest User

Untitled

a guest
Jul 18th, 2017
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.52 KB | None | 0 0
  1. # TYPE DATABASE USER ADDRESS METHOD
  2. local all pgsql peer
  3. local all all md5
  4. host all all 127.0.0.1/32 md5
  5. host all all ::1/128 md5
  6.  
  7. $ su pgsql
  8. $ psql template1
  9. template1=# l
  10. List of databases
  11. ...
  12.  
  13. - name: Create the postgresql database
  14. postgresql_db: name=mydatabase login_user=pgsql
  15.  
  16. PLAY [web] ********************************************************************
  17.  
  18. GATHERING FACTS ***************************************************************
  19. ok: [host.example.org]
  20.  
  21. TASK: [database | Create the postgresql database] *****************************
  22. failed: [host.example.org] => {"failed": true}
  23. msg: unable to connect to database: FATAL: Peer authentication failed for user "pgsql"
  24.  
  25.  
  26. FATAL: all hosts have already failed -- aborting
  27.  
  28. - name: Create postgres database
  29. become: true
  30. become_user: postgres
  31. postgresql_db:
  32. name: <database-name>
  33.  
  34. - name: Create postgres user
  35. postgresql_user: name={{ pg_user }} password={{ pg_password }}
  36. become: true
  37. become_user: postgres
  38.  
  39. - name: Create the postgresql database
  40. remote_user: pgsql
  41. postgresql_db: name=mydatabase login_user=pgsql
  42. ...
  43.  
  44. - name: Create the postgresql database
  45. remote_user: root
  46. become: yes
  47. become_user: pgsql
  48. postgresql_db: name=mydatabase login_user=pgsql
  49. ...
  50.  
  51. [ssh_connection]
  52. pipelining=True
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement