postgresql icon indicating copy to clipboard operation
postgresql copied to clipboard

Can not setup Postgrsql 9.3 on trusty

Open AlexSnet opened this issue 12 years ago • 6 comments

Running ansimble as vagrant provision.

Some output before is truncated.

TASK: [ANXS.postgresql | PostgreSQL | Extensions | Make sure the development headers are installed] *** 
<33.33.33.55> ESTABLISH CONNECTION FOR USER: vagrant
<33.33.33.55> REMOTE_MODULE apt name=libpq-dev state=present
<33.33.33.55> EXEC ssh -C -tt -vvv -o ForwardAgent=yes -o ControlMaster=auto -o ControlPersist=60s -o ControlPath="/home/alex/.ansible/cp/ansible-ssh-%h-%p-%r" -o StrictHostKeyChecking=no -o IdentityFile="/home/alex/.vagrant.d/insecure_private_key" -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=vagrant -o ConnectTimeout=10 33.33.33.55 /bin/sh -c 'mkdir -p $HOME/.ansible/tmp/ansible-tmp-1417516573.84-196422177238307 && chmod a+rx $HOME/.ansible/tmp/ansible-tmp-1417516573.84-196422177238307 && echo $HOME/.ansible/tmp/ansible-tmp-1417516573.84-196422177238307'
<33.33.33.55> PUT /tmp/alex/tmpzXP8Sv TO /home/vagrant/.ansible/tmp/ansible-tmp-1417516573.84-196422177238307/apt
<33.33.33.55> EXEC ssh -C -tt -vvv -o ForwardAgent=yes -o ControlMaster=auto -o ControlPersist=60s -o ControlPath="/home/alex/.ansible/cp/ansible-ssh-%h-%p-%r" -o StrictHostKeyChecking=no -o IdentityFile="/home/alex/.vagrant.d/insecure_private_key" -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=vagrant -o ConnectTimeout=10 33.33.33.55 /bin/sh -c 'sudo -k && sudo -H -S -p "[sudo via ansible, key=pdtbsvhzyqmwuhutjwzvlunuymgkvuck] password: " -u root /bin/sh -c '"'"'echo SUDO-SUCCESS-pdtbsvhzyqmwuhutjwzvlunuymgkvuck; LANG=en_US.UTF-8 LC_CTYPE=en_US.UTF-8 /usr/bin/python /home/vagrant/.ansible/tmp/ansible-tmp-1417516573.84-196422177238307/apt; rm -rf /home/vagrant/.ansible/tmp/ansible-tmp-1417516573.84-196422177238307/ >/dev/null 2>&1'"'"''
ok: [local.myhost.uss] => {"changed": false}

TASK: [ANXS.postgresql | PostgreSQL | Extensions | Make sure the postgis extensions are installed] *** 
skipping: [local.myhost.uss]

TASK: [ANXS.postgresql | PostgreSQL | Make sure the postgres data directory exists] *** 
<33.33.33.55> ESTABLISH CONNECTION FOR USER: vagrant
<33.33.33.55> REMOTE_MODULE file group=postgres state=directory path=/var/lib/postgresql/9.3/main owner=postgres
<33.33.33.55> EXEC ssh -C -tt -vvv -o ForwardAgent=yes -o ControlMaster=auto -o ControlPersist=60s -o ControlPath="/home/alex/.ansible/cp/ansible-ssh-%h-%p-%r" -o StrictHostKeyChecking=no -o IdentityFile="/home/alex/.vagrant.d/insecure_private_key" -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=vagrant -o ConnectTimeout=10 33.33.33.55 /bin/sh -c 'mkdir -p $HOME/.ansible/tmp/ansible-tmp-1417516574.33-214413181594922 && chmod a+rx $HOME/.ansible/tmp/ansible-tmp-1417516574.33-214413181594922 && echo $HOME/.ansible/tmp/ansible-tmp-1417516574.33-214413181594922'
<33.33.33.55> PUT /tmp/alex/tmpsu3Ig_ TO /home/vagrant/.ansible/tmp/ansible-tmp-1417516574.33-214413181594922/file
<33.33.33.55> EXEC ssh -C -tt -vvv -o ForwardAgent=yes -o ControlMaster=auto -o ControlPersist=60s -o ControlPath="/home/alex/.ansible/cp/ansible-ssh-%h-%p-%r" -o StrictHostKeyChecking=no -o IdentityFile="/home/alex/.vagrant.d/insecure_private_key" -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=vagrant -o ConnectTimeout=10 33.33.33.55 /bin/sh -c 'sudo -k && sudo -H -S -p "[sudo via ansible, key=ibtoadiluvcwogddsrcvttxtcxtlfzcc] password: " -u root /bin/sh -c '"'"'echo SUDO-SUCCESS-ibtoadiluvcwogddsrcvttxtcxtlfzcc; LANG=en_US.UTF-8 LC_CTYPE=en_US.UTF-8 /usr/bin/python /home/vagrant/.ansible/tmp/ansible-tmp-1417516574.33-214413181594922/file; rm -rf /home/vagrant/.ansible/tmp/ansible-tmp-1417516574.33-214413181594922/ >/dev/null 2>&1'"'"''
ok: [local.myhost.uss] => {"changed": false, "gid": 118, "group": "postgres", "mode": "0700", "owner": "postgres", "path": "/var/lib/postgresql/9.3/main", "size": 4096, "state": "directory", "uid": 111}

TASK: [ANXS.postgresql | PostgreSQL | Reset the cluster - drop the existing one] *** 
skipping: [local.myhost.uss]

TASK: [ANXS.postgresql | PostgreSQL | Reset the cluster - create a new one (with specified encoding and locale)] *** 
skipping: [local.myhost.uss]

TASK: [ANXS.postgresql | PostgreSQL | Update configuration - pt. 1 (pg_hba.conf)] *** 
<33.33.33.55> ESTABLISH CONNECTION FOR USER: vagrant
<33.33.33.55> EXEC ssh -C -tt -vvv -o ForwardAgent=yes -o ControlMaster=auto -o ControlPersist=60s -o ControlPath="/home/alex/.ansible/cp/ansible-ssh-%h-%p-%r" -o StrictHostKeyChecking=no -o IdentityFile="/home/alex/.vagrant.d/insecure_private_key" -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=vagrant -o ConnectTimeout=10 33.33.33.55 /bin/sh -c 'mkdir -p $HOME/.ansible/tmp/ansible-tmp-1417516574.5-207184879708262 && chmod a+rx $HOME/.ansible/tmp/ansible-tmp-1417516574.5-207184879708262 && echo $HOME/.ansible/tmp/ansible-tmp-1417516574.5-207184879708262'
<33.33.33.55> EXEC ssh -C -tt -vvv -o ForwardAgent=yes -o ControlMaster=auto -o ControlPersist=60s -o ControlPath="/home/alex/.ansible/cp/ansible-ssh-%h-%p-%r" -o StrictHostKeyChecking=no -o IdentityFile="/home/alex/.vagrant.d/insecure_private_key" -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=vagrant -o ConnectTimeout=10 33.33.33.55 /bin/sh -c 'sudo -k && sudo -H -S -p "[sudo via ansible, key=rzzdyyjmeuuaooptediudyqvujrtwthh] password: " -u root /bin/sh -c '"'"'echo SUDO-SUCCESS-rzzdyyjmeuuaooptediudyqvujrtwthh; rc=flag; [ -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" ] && rc=3; python -V 2>/dev/null || rc=4; [ x"$rc" != "xflag" ] && echo "${rc} /etc/postgresql/9.3/main/pg_hba.conf" && exit 0; (python -c '"'"'"'"'"'"'"'"'import hashlib; print(hashlib.sha1(open("/etc/postgresql/9.3/main/pg_hba.conf", "rb").read()).hexdigest())'"'"'"'"'"'"'"'"' 2>/dev/null) || (python -c '"'"'"'"'"'"'"'"'import sha; print(sha.sha(open("/etc/postgresql/9.3/main/pg_hba.conf", "rb").read()).hexdigest())'"'"'"'"'"'"'"'"' 2>/dev/null) || (echo "0 /etc/postgresql/9.3/main/pg_hba.conf")'"'"''
<33.33.33.55> PUT /tmp/alex/tmpKPLEuE TO /home/vagrant/.ansible/tmp/ansible-tmp-1417516574.5-207184879708262/source
<33.33.33.55> PUT /tmp/alex/tmpFqJESh TO /home/vagrant/.ansible/tmp/ansible-tmp-1417516574.5-207184879708262/copy
<33.33.33.55> EXEC ssh -C -tt -vvv -o ForwardAgent=yes -o ControlMaster=auto -o ControlPersist=60s -o ControlPath="/home/alex/.ansible/cp/ansible-ssh-%h-%p-%r" -o StrictHostKeyChecking=no -o IdentityFile="/home/alex/.vagrant.d/insecure_private_key" -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=vagrant -o ConnectTimeout=10 33.33.33.55 /bin/sh -c 'sudo -k && sudo -H -S -p "[sudo via ansible, key=owzhuynsocpsgjtcwtdxlmukeuuylkfd] password: " -u root /bin/sh -c '"'"'echo SUDO-SUCCESS-owzhuynsocpsgjtcwtdxlmukeuuylkfd; LANG=en_US.UTF-8 LC_CTYPE=en_US.UTF-8 /usr/bin/python /home/vagrant/.ansible/tmp/ansible-tmp-1417516574.5-207184879708262/copy; rm -rf /home/vagrant/.ansible/tmp/ansible-tmp-1417516574.5-207184879708262/ >/dev/null 2>&1'"'"''
failed: [local.myhost.uss] => {"failed": true}
msg: Destination directory /etc/postgresql/9.3/main does not exist

FATAL: all hosts have already failed -- aborting

PLAY RECAP ******************************************************************** 
           to retry, use: --limit @/home/alex/playbook.retry

local.myhost.uss           : ok=42   changed=0    unreachable=0    failed=1   

Ansible failed to complete successfully. Any error output should be
visible above. Please fix these errors and try again.

And really after installing postgres-9.3 no /etc/postgres was created.

AlexSnet avatar Dec 02 '14 10:12 AlexSnet

This problem was provided be locales. If working locale on ansible host machine was not present on remote machine pg_createcluster fails.

AlexSnet avatar Dec 02 '14 11:12 AlexSnet

@AlexSnet same problem here, did you find a solution?

areski avatar Feb 20 '15 16:02 areski

Got: msg: Destination directory /etc/postgresql/9.3/main does not exist Fixed it with: sudo pg_createcluster 9.3 main --start

abuzze avatar Feb 28 '15 17:02 abuzze

@areski just add your locale to the target machine. Reproducing this problem: Connecting to target with unsupported locale (locale is not present on target) and trying to run pg_createcluster. Repair: Install needed locales, such as on controller machine to the targets. All will be good.

AlexSnet avatar Apr 26 '15 00:04 AlexSnet

This happened to me, when I was trying to install PostgreSQL 9.4 on Ubuntu 14.04 Server. I was using Ansible from inside of the virtual machine, so controller and target machine were same. abuzze's fix worked fine for me. The question is, why it's needed at all.

miloskroulik avatar May 29 '15 21:05 miloskroulik

@miloskroulik it's happen cause some postgres control scripts were written on Perl. ;)

AlexSnet avatar Jun 27 '15 10:06 AlexSnet