---
- name: Ensure vagrant as postgresql user
  postgresql_user: name=vagrant role_attr_flags=SUPERUSER
  sudo_user: postgres
  sudo: true
- name: Ensure vagrant database user is created
  postgresql_user: db={{ postgresql_database_name }} name=vagrant password=vagrant priv=ALL state=present
  sudo_user: postgres
  sudo: true
- name: Ensure vagrant user can access
  lineinfile: dest=/etc/postgresql/9.3/main/pg_hba.conf state=present line='local all postgres trust'
  sudo: true
- name: Ensure database is present
  postgresql_db: name={{ postgresql_database_name }} owner=vagrant
  sudo: true
  sudo_user: postgres
