Skip to content

Instantly share code, notes, and snippets.

@nickhs
Created July 10, 2013 23:32
Show Gist options
  • Save nickhs/5971195 to your computer and use it in GitHub Desktop.
Save nickhs/5971195 to your computer and use it in GitHub Desktop.
# Error
TASK: [create foobar database user] ***********************************
failed: [ec2-184-73-128-96.compute-1.amazonaws.com] => {"failed": true, "item": ""}
msg: unable to connect to database: FATAL: Peer authentication failed for user "postgres"
# Playbook
---
- hosts: dbservers
sudo: yes
user: root
sudo_user: postgres
vars_files:
- vars.yml
tasks:
- include: tasks/createdb.yml
handlers:
- include: handlers.yml
# createdb.yml
---
- name: create ${app_name} database user
action: postgresql_user user=${app_name} password=${database_password} state=present
- name: create database
action: postgresql_db name=${app_name} owner=${app_name} state=present
notify: build database
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment