nickjj / ansible-postgres

Install a bare bones version of postgres with ansible.
5 stars 3 forks source link

Destination directory /etc/postgresql/9.3/main does not exist #1

Closed pacuna closed 10 years ago

pacuna commented 10 years ago

Hi, when I'm trying to run the playbook, I'm getting this error and I haven't been able to solve it:

TASK: [nickjj.postgres | ensure postgres dependencies are installed] ********** 
ok: [162.243.196.xxx]

TASK: [nickjj.postgres | ensure postgres apt key exists] ********************** 
ok: [162.243.196.xxx]

TASK: [nickjj.postgres | ensure postgres apt repository exists] *************** 
ok: [162.243.196.xxx]

TASK: [nickjj.postgres | ensure postgres is installed] ************************ 
ok: [162.243.196.x]

TASK: [nickjj.postgres | ensure postgres' pg_hba is configured] *************** 
failed: [162.243.196.xxx] => {"failed": true}
msg: Destination directory /etc/postgresql/9.3/main does not exist

FATAL: all hosts have already failed -- aborting

Any ideas? I'm running an Ubuntu 12.04 dropplet on digital ocean. Thanks in advance.

nickjj commented 10 years ago

Interesting, I just setup a new 12.04 LTS server locally and it ran through without issues. It is also passing on travis which can be seen here. Travis is running 12.04 too.

pacuna commented 10 years ago

I don't have /etc/postgresql. I have /etc/postgresql-common with some cluster configurations inside. I saw other people with similar problems using chef I think and it was a locale problem, but I don't know how to fix it or if this is related to that. The droplet is Ubuntu 12.04.4 x64.

This is the output:

TASK: [nickjj.postgres | ensure postgres' pg_hba is configured] *************** 
<162.243.196.xxx> ESTABLISH CONNECTION FOR USER: root
<162.243.196.xxx> EXEC ['ssh', '-C', '-tt', '-vvv', '-o', 'ControlMaster=auto', '-o', 'ControlPersist=60s', '-o', 'ControlPath=/home/pacuna/.ansible/cp/ansible-ssh-%h-%p-%r', '-o', 'Port=22', '-o', 'KbdInteractiveAuthentication=no', '-o', 'PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey', '-o', 'PasswordAuthentication=no', '-o', 'User=root', '-o', 'ConnectTimeout=10', '162.243.196.xxx', "/bin/sh -c 'mkdir -p $HOME/.ansible/tmp/ansible-tmp-1403537041.87-104981854770783 && chmod a+rx $HOME/.ansible/tmp/ansible-tmp-1403537041.87-104981854770783 && echo $HOME/.ansible/tmp/ansible-tmp-1403537041.87-104981854770783'"]
<162.243.196.xxx> EXEC ['ssh', '-C', '-tt', '-vvv', '-o', 'ControlMaster=auto', '-o', 'ControlPersist=60s', '-o', 'ControlPath=/home/pacuna/.ansible/cp/ansible-ssh-%h-%p-%r', '-o', 'Port=22', '-o', 'KbdInteractiveAuthentication=no', '-o', 'PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey', '-o', 'PasswordAuthentication=no', '-o', 'User=root', '-o', 'ConnectTimeout=10', '162.243.196.xxx', u'/bin/sh -c \'rc=0; [ -r "/etc/postgresql/9.3/main/pg_hba.conf" ] || rc=2; [ -f "/etc/postgresql/9.3/main/pg_hba.conf" ] || rc=1; [ -d "/etc/postgresql/9.3/main/pg_hba.conf" ] && echo 3 && exit 0; (/usr/bin/md5sum /etc/postgresql/9.3/main/pg_hba.conf 2>/dev/null) || (/sbin/md5sum -q /etc/postgresql/9.3/main/pg_hba.conf 2>/dev/null) || (/usr/bin/digest -a md5 /etc/postgresql/9.3/main/pg_hba.conf 2>/dev/null) || (/sbin/md5 -q /etc/postgresql/9.3/main/pg_hba.conf 2>/dev/null) || (/usr/bin/md5 -n /etc/postgresql/9.3/main/pg_hba.conf 2>/dev/null) || (/bin/md5 -q /etc/postgresql/9.3/main/pg_hba.conf 2>/dev/null) || (/usr/bin/csum -h MD5 /etc/postgresql/9.3/main/pg_hba.conf 2>/dev/null) || (/bin/csum -h MD5 /etc/postgresql/9.3/main/pg_hba.conf 2>/dev/null) || (echo "${rc} /etc/postgresql/9.3/main/pg_hba.conf")\'']
<162.243.196.xxx> PUT /tmp/tmpdPUWZa TO /root/.ansible/tmp/ansible-tmp-1403537041.87-104981854770783/source
<162.243.196.xxx> PUT /tmp/tmpQ7x9uV TO /root/.ansible/tmp/ansible-tmp-1403537041.87-104981854770783/copy
<162.243.196.xxx> EXEC ['ssh', '-C', '-tt', '-vvv', '-o', 'ControlMaster=auto', '-o', 'ControlPersist=60s', '-o', 'ControlPath=/home/pacuna/.ansible/cp/ansible-ssh-%h-%p-%r', '-o', 'Port=22', '-o', 'KbdInteractiveAuthentication=no', '-o', 'PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey', '-o', 'PasswordAuthentication=no', '-o', 'User=root', '-o', 'ConnectTimeout=10', '162.243.196.xxx', u"/bin/sh -c 'LC_CTYPE=C LANG=C /usr/bin/python /root/.ansible/tmp/ansible-tmp-1403537041.87-104981854770783/copy; rm -rf /root/.ansible/tmp/ansible-tmp-1403537041.87-104981854770783/ >/dev/null 2>&1'"]
failed: [162.243.196.xxx] => {"failed": true}
msg: Destination directory /etc/postgresql/9.3/main does not exist

FATAL: all hosts have already failed -- aborting
pacuna commented 10 years ago

I fixed this issue by generating some missing locales in the VPS and purging the postgresql old installation.

pacuna commented 10 years ago

@nickjj by the way, can you give a small description of the process that you use to deploy a project created with orats? I'm sort of new with ansible and a basic list of taks would be useful. Thanks in advance.

nickjj commented 10 years ago

@pacuna What commands did you run to generate the locales? When you say purge the old installation do you mean the old installation provided by this role or does that droplet come pre-loaded with an old version of postgres?

I have a few basic guides on the wiki: https://github.com/nickjj/orats/wiki

This one covers deploying: https://github.com/nickjj/orats/wiki/Get-your-application-on-a-server

pacuna commented 10 years ago

Thanks. I purged the installation provided by this role (it was a fresh droplet), but I think it was broken because of the locale problems, for example I didn't have an /ect/postgresql directory. The commands were:

dpkg-reconfigure locales

And then

locale-gen MISSING_LOCALES

Before fixing the locales I tried to run apt-get purge and the output showed me an error and the locales that were missing.