I am provisioning a 'Precise64' Ubuntu machine via Ansible, I am encountering an error when ensuring that the database is in fact created. I am using most of https://github.com/jcalazan/ansible-django-stack
- name: Install PostgreSQL
apt: name={{ item }} update_cache={{ update_apt_cache }} state=installed
with_items:
- postgresql
- postgresql-contrib
- python-psycopg2
tags: packages
- name: Ensure the PostgreSQL service is running
service: name=postgresql state=started enabled=yes
- name: Ensure database is created
sudo_user: postgres
postgresql_db: name={{ db_name }}
encoding='UTF-8'
lc_collate='en_US.UTF-8'
lc_ctype='en_US.UTF-8'
template='template0'
state=present
However, when arriving to the last task, I get this error:
failed: [default] => {"failed": true, "playbook": "vagrant.yml", "role": "db", "task": "Ensure database is created"} msg: unable to connect to database: could not connect to server: No such file or directory Is the server running locally and accepting connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.5432"?
FATAL: all hosts have already failed -- aborting