SSH Error: Permission denied (publickey,password) - DigitalOcean

Mind running the deploy command one more time with -vvvv and pasting the full output?
ansible-playbook -i hosts/staging deploy.yml --extra-vars "site=bedrock.com" -vvvv

I followed the walkthrough on this site to manually add my ssh key using:

ssh-copy-id web@45.55.241.241

(I had to first reset my password for the web user on the server as I had no idea what this was set to)

That got me passed the SSH Key issue but now I have a new issue :confused:

failed: [45.55.241.241] => (item={ā€˜pathā€™: ā€˜web/app/uploadsā€™, ā€˜srcā€™: ā€˜uploadsā€™}) => {ā€œfailedā€: true, ā€œitemā€: {ā€œpathā€: ā€œweb/app/uploadsā€, ā€œsrcā€: ā€œuploadsā€}, ā€œpathā€: ā€œ/srv/www/bedrock.com/releases/20150423201953/web/app/uploadsā€, ā€œstateā€: ā€œabsentā€}
msg: Error while linking: [Errno 2] No such file or directory

FATAL: all hosts have already failed ā€“ aborting

@fullyint - Hereā€™s the full output:

ansible-playbook -i hosts/staging deploy.yml --extra-vars ā€œsite=bedrock.comā€ -vvvv

PLAY [Deploy WP site] *********************************************************

GATHERING FACTS ***************************************************************
<45.55.241.241> ESTABLISH CONNECTION FOR USER: web
<45.55.241.241> REMOTE_MODULE setup
<45.55.241.241> EXEC ssh -C -tt -vvv -o ForwardAgent=yes -o ControlMaster=auto -o ControlPersist=60s -o ControlPath=ā€œ/Users/danielbell/.ansible/cp/ansible-ssh-%h-%p-%rā€ -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=web -o ConnectTimeout=10 45.55.241.241 /bin/sh -c ā€˜mkdir -p $HOME/.ansible/tmp/ansible-tmp-1429835239.46-169090882513492 && chmod a+rx $HOME/.ansible/tmp/ansible-tmp-1429835239.46-169090882513492 && echo $HOME/.ansible/tmp/ansible-tmp-1429835239.46-169090882513492ā€™
<45.55.241.241> PUT /var/folders/xy/1kc57lfs7rn18nrjdpypxmxh0000gn/T/tmpyp4J_m TO /home/web/.ansible/tmp/ansible-tmp-1429835239.46-169090882513492/setup
<45.55.241.241> EXEC ssh -C -tt -vvv -o ForwardAgent=yes -o ControlMaster=auto -o ControlPersist=60s -o ControlPath=ā€œ/Users/danielbell/.ansible/cp/ansible-ssh-%h-%p-%rā€ -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=web -o ConnectTimeout=10 45.55.241.241 /bin/sh -c ā€˜LANG=en_US.UTF-8 LC_CTYPE=en_US.UTF-8 /usr/bin/python /home/web/.ansible/tmp/ansible-tmp-1429835239.46-169090882513492/setup; rm -rf /home/web/.ansible/tmp/ansible-tmp-1429835239.46-169090882513492/ >/dev/null 2>&1ā€™
ok: [45.55.241.241]

TASK: [deploy | Initialize] ***************************************************
<45.55.241.241> ESTABLISH CONNECTION FOR USER: web
<45.55.241.241> REMOTE_MODULE deploy_helper path=ā€œ/srv/www/bedrock.comā€ state=present
<45.55.241.241> EXEC ssh -C -tt -vvv -o ForwardAgent=yes -o ControlMaster=auto -o ControlPersist=60s -o ControlPath=ā€œ/Users/danielbell/.ansible/cp/ansible-ssh-%h-%p-%rā€ -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=web -o ConnectTimeout=10 45.55.241.241 /bin/sh -c ā€˜mkdir -p $HOME/.ansible/tmp/ansible-tmp-1429835244.12-66544580754692 && chmod a+rx $HOME/.ansible/tmp/ansible-tmp-1429835244.12-66544580754692 && echo $HOME/.ansible/tmp/ansible-tmp-1429835244.12-66544580754692ā€™
<45.55.241.241> PUT /var/folders/xy/1kc57lfs7rn18nrjdpypxmxh0000gn/T/tmpOn7LyJ TO /home/web/.ansible/tmp/ansible-tmp-1429835244.12-66544580754692/deploy_helper
<45.55.241.241> EXEC ssh -C -tt -vvv -o ForwardAgent=yes -o ControlMaster=auto -o ControlPersist=60s -o ControlPath=ā€œ/Users/danielbell/.ansible/cp/ansible-ssh-%h-%p-%rā€ -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=web -o ConnectTimeout=10 45.55.241.241 /bin/sh -c ā€˜LANG=en_US.UTF-8 LC_CTYPE=en_US.UTF-8 /usr/bin/python /home/web/.ansible/tmp/ansible-tmp-1429835244.12-66544580754692/deploy_helper; rm -rf /home/web/.ansible/tmp/ansible-tmp-1429835244.12-66544580754692/ >/dev/null 2>&1ā€™
ok: [45.55.241.241] => {ā€œansible_factsā€: {ā€œdeploy_helperā€: {ā€œcurrent_pathā€: ā€œ/srv/www/bedrock.com/currentā€, ā€œnew_releaseā€: ā€œ20150423202404ā€, ā€œnew_release_pathā€: ā€œ/srv/www/bedrock.com/releases/20150423202404ā€, ā€œprevious_releaseā€: null, ā€œprevious_release_pathā€: null, ā€œproject_pathā€: ā€œ/srv/www/bedrock.comā€, ā€œreleases_pathā€: ā€œ/srv/www/bedrock.com/releasesā€, ā€œshared_pathā€: ā€œ/srv/www/bedrock.com/sharedā€, ā€œunfinished_filenameā€: ā€œDEPLOY_UNFINISHEDā€}}, ā€œchangedā€: false, ā€œstateā€: ā€œpresentā€}

TASK: [deploy | Clone project files] ******************************************
<45.55.241.241> ESTABLISH CONNECTION FOR USER: web
<45.55.241.241> REMOTE_MODULE git repo= dest=ā€œ/srv/www/bedrock.com/shared/sourceā€ version=ā€œmasterā€ accept_hostkey=yes
<45.55.241.241> EXEC ssh -C -tt -vvv -o ForwardAgent=yes -o ControlMaster=auto -o ControlPersist=60s -o ControlPath=ā€œ/Users/danielbell/.ansible/cp/ansible-ssh-%h-%p-%rā€ -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=web -o ConnectTimeout=10 45.55.241.241 /bin/sh -c ā€˜mkdir -p $HOME/.ansible/tmp/ansible-tmp-1429835245.16-120691099126435 && chmod a+rx $HOME/.ansible/tmp/ansible-tmp-1429835245.16-120691099126435 && echo $HOME/.ansible/tmp/ansible-tmp-1429835245.16-120691099126435ā€™
<45.55.241.241> PUT /var/folders/xy/1kc57lfs7rn18nrjdpypxmxh0000gn/T/tmpMTIAwe TO /home/web/.ansible/tmp/ansible-tmp-1429835245.16-120691099126435/git
<45.55.241.241> EXEC ssh -C -tt -vvv -o ForwardAgent=yes -o ControlMaster=auto -o ControlPersist=60s -o ControlPath=ā€œ/Users/danielbell/.ansible/cp/ansible-ssh-%h-%p-%rā€ -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=web -o ConnectTimeout=10 45.55.241.241 /bin/sh -c ā€˜LANG=en_US.UTF-8 LC_CTYPE=en_US.UTF-8 /usr/bin/python /home/web/.ansible/tmp/ansible-tmp-1429835245.16-120691099126435/git; rm -rf /home/web/.ansible/tmp/ansible-tmp-1429835245.16-120691099126435/ >/dev/null 2>&1ā€™
ok: [45.55.241.241] => {ā€œafterā€: ā€œ248546384754f1ae13f72f1a1ec243eaf81d0a87ā€, ā€œbeforeā€: ā€œ248546384754f1ae13f72f1a1ec243eaf81d0a87ā€, ā€œchangedā€: false}

TASK: [deploy | write unfinished file] ****************************************
<45.55.241.241> ESTABLISH CONNECTION FOR USER: web
<45.55.241.241> REMOTE_MODULE file path=ā€œ/srv/www/bedrock.com/shared/source/DEPLOY_UNFINISHEDā€ state=touch
<45.55.241.241> EXEC ssh -C -tt -vvv -o ForwardAgent=yes -o ControlMaster=auto -o ControlPersist=60s -o ControlPath=ā€œ/Users/danielbell/.ansible/cp/ansible-ssh-%h-%p-%rā€ -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=web -o ConnectTimeout=10 45.55.241.241 /bin/sh -c ā€˜mkdir -p $HOME/.ansible/tmp/ansible-tmp-1429835251.95-128102627804567 && chmod a+rx $HOME/.ansible/tmp/ansible-tmp-1429835251.95-128102627804567 && echo $HOME/.ansible/tmp/ansible-tmp-1429835251.95-128102627804567ā€™
<45.55.241.241> PUT /var/folders/xy/1kc57lfs7rn18nrjdpypxmxh0000gn/T/tmpx9VJ3h TO /home/web/.ansible/tmp/ansible-tmp-1429835251.95-128102627804567/file
<45.55.241.241> EXEC ssh -C -tt -vvv -o ForwardAgent=yes -o ControlMaster=auto -o ControlPersist=60s -o ControlPath=ā€œ/Users/danielbell/.ansible/cp/ansible-ssh-%h-%p-%rā€ -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=web -o ConnectTimeout=10 45.55.241.241 /bin/sh -c ā€˜LANG=en_US.UTF-8 LC_CTYPE=en_US.UTF-8 /usr/bin/python /home/web/.ansible/tmp/ansible-tmp-1429835251.95-128102627804567/file; rm -rf /home/web/.ansible/tmp/ansible-tmp-1429835251.95-128102627804567/ >/dev/null 2>&1ā€™
changed: [45.55.241.241] => {ā€œchangedā€: true, ā€œdestā€: ā€œ/srv/www/bedrock.com/shared/source/DEPLOY_UNFINISHEDā€, ā€œgidā€: 33, ā€œgroupā€: ā€œwww-dataā€, ā€œmodeā€: ā€œ0644ā€, ā€œownerā€: ā€œwebā€, ā€œsizeā€: 0, ā€œstateā€: ā€œfileā€, ā€œuidā€: 1000}

TASK: [deploy | Copy files to new build dir] **********************************
<45.55.241.241> ESTABLISH CONNECTION FOR USER: web
<45.55.241.241> REMOTE_MODULE command cp -pr /srv/www/bedrock.com/shared/source /srv/www/bedrock.com/releases/20150423202404
<45.55.241.241> EXEC ssh -C -tt -vvv -o ForwardAgent=yes -o ControlMaster=auto -o ControlPersist=60s -o ControlPath=ā€œ/Users/danielbell/.ansible/cp/ansible-ssh-%h-%p-%rā€ -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=web -o ConnectTimeout=10 45.55.241.241 /bin/sh -c ā€˜mkdir -p $HOME/.ansible/tmp/ansible-tmp-1429835253.01-187975690550935 && chmod a+rx $HOME/.ansible/tmp/ansible-tmp-1429835253.01-187975690550935 && echo $HOME/.ansible/tmp/ansible-tmp-1429835253.01-187975690550935ā€™
<45.55.241.241> PUT /var/folders/xy/1kc57lfs7rn18nrjdpypxmxh0000gn/T/tmpkBRrW2 TO /home/web/.ansible/tmp/ansible-tmp-1429835253.01-187975690550935/command
<45.55.241.241> EXEC ssh -C -tt -vvv -o ForwardAgent=yes -o ControlMaster=auto -o ControlPersist=60s -o ControlPath=ā€œ/Users/danielbell/.ansible/cp/ansible-ssh-%h-%p-%rā€ -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=web -o ConnectTimeout=10 45.55.241.241 /bin/sh -c ā€˜LANG=en_US.UTF-8 LC_CTYPE=en_US.UTF-8 /usr/bin/python /home/web/.ansible/tmp/ansible-tmp-1429835253.01-187975690550935/command; rm -rf /home/web/.ansible/tmp/ansible-tmp-1429835253.01-187975690550935/ >/dev/null 2>&1ā€™
changed: [45.55.241.241] => {ā€œchangedā€: true, ā€œcmdā€: [ā€œcpā€, ā€œ-prā€, ā€œ/srv/www/bedrock.com/shared/sourceā€, ā€œ/srv/www/bedrock.com/releases/20150423202404ā€], ā€œdeltaā€: ā€œ0:00:00.020942ā€, ā€œendā€: ā€œ2015-04-23 20:24:13.824129ā€, ā€œrcā€: 0, ā€œstartā€: ā€œ2015-04-23 20:24:13.803187ā€, ā€œstderrā€: ā€œā€, ā€œstdoutā€: ā€œā€, ā€œwarningsā€: }

TASK: [deploy | Move project subtree into root folder] ************************
skipping: [45.55.241.241]

TASK: [deploy | Remove unwanted files/folders from new release] ***************
<45.55.241.241> ESTABLISH CONNECTION FOR USER: web
<45.55.241.241> REMOTE_MODULE file path=ā€œ/srv/www/bedrock.com/releases/20150423202404/.gitā€ state=absent
<45.55.241.241> EXEC ssh -C -tt -vvv -o ForwardAgent=yes -o ControlMaster=auto -o ControlPersist=60s -o ControlPath=ā€œ/Users/danielbell/.ansible/cp/ansible-ssh-%h-%p-%rā€ -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=web -o ConnectTimeout=10 45.55.241.241 /bin/sh -c ā€˜mkdir -p $HOME/.ansible/tmp/ansible-tmp-1429835254.09-133873997428035 && chmod a+rx $HOME/.ansible/tmp/ansible-tmp-1429835254.09-133873997428035 && echo $HOME/.ansible/tmp/ansible-tmp-1429835254.09-133873997428035ā€™
<45.55.241.241> PUT /var/folders/xy/1kc57lfs7rn18nrjdpypxmxh0000gn/T/tmpaLXVw0 TO /home/web/.ansible/tmp/ansible-tmp-1429835254.09-133873997428035/file
<45.55.241.241> EXEC ssh -C -tt -vvv -o ForwardAgent=yes -o ControlMaster=auto -o ControlPersist=60s -o ControlPath=ā€œ/Users/danielbell/.ansible/cp/ansible-ssh-%h-%p-%rā€ -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=web -o ConnectTimeout=10 45.55.241.241 /bin/sh -c ā€˜LANG=en_US.UTF-8 LC_CTYPE=en_US.UTF-8 /usr/bin/python /home/web/.ansible/tmp/ansible-tmp-1429835254.09-133873997428035/file; rm -rf /home/web/.ansible/tmp/ansible-tmp-1429835254.09-133873997428035/ >/dev/null 2>&1ā€™
changed: [45.55.241.241] => (item=.git) => {ā€œchangedā€: true, ā€œitemā€: ā€œ.gitā€, ā€œpathā€: ā€œ/srv/www/bedrock.com/releases/20150423202404/.gitā€, ā€œstateā€: ā€œabsentā€}

TASK: [deploy | Run pre_build_commands_local on Ansible host] *****************
skipping: [45.55.241.241]

TASK: [deploy | Copy project local files] *************************************
skipping: [45.55.241.241]

TASK: [deploy | Copy project templates] ***************************************
<45.55.241.241> ESTABLISH CONNECTION FOR USER: web
<45.55.241.241> EXEC ssh -C -tt -vvv -o ForwardAgent=yes -o ControlMaster=auto -o ControlPersist=60s -o ControlPath=ā€œ/Users/danielbell/.ansible/cp/ansible-ssh-%h-%p-%rā€ -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=web -o ConnectTimeout=10 45.55.241.241 /bin/sh -c ā€˜mkdir -p $HOME/.ansible/tmp/ansible-tmp-1429835255.09-529137414642 && chmod a+rx $HOME/.ansible/tmp/ansible-tmp-1429835255.09-529137414642 && echo $HOME/.ansible/tmp/ansible-tmp-1429835255.09-529137414642ā€™
<45.55.241.241> EXEC ssh -C -tt -vvv -o ForwardAgent=yes -o ControlMaster=auto -o ControlPersist=60s -o ControlPath=ā€œ/Users/danielbell/.ansible/cp/ansible-ssh-%h-%p-%rā€ -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=web -o ConnectTimeout=10 45.55.241.241 /bin/sh -c ā€˜rc=flag; [ -r /srv/www/bedrock.com/releases/20150423202404/.env ] || rc=2; [ -f /srv/www/bedrock.com/releases/20150423202404/.env ] || rc=1; [ -d /srv/www/bedrock.com/releases/20150423202404/.env ] && rc=3; python -V 2>/dev/null || rc=4; [ x"$rc" != ā€œxflagā€ ] && echo "${rc} ā€œ/srv/www/bedrock.com/releases/20150423202404/.env && exit 0; (python -c 'ā€ā€™ā€œ'import hashlib; BLOCKSIZE = 65536; hasher = hashlib.sha1(); afile = open(ā€ā€˜"ā€™ā€œā€˜/srv/www/bedrock.com/releases/20150423202404/.envā€™ā€ā€˜"ā€™ā€œ, ā€œrbā€) buf = afile.read(BLOCKSIZE) while len(buf) > 0: hasher.update(buf) buf = afile.read(BLOCKSIZE) afile.close() print(hasher.hexdigest())'ā€ā€˜"ā€™ 2>/dev/null) || (python -c ā€˜"ā€™ā€œ'import sha; BLOCKSIZE = 65536; hasher = sha.sha(); afile = open(ā€ā€˜"ā€™ā€œā€˜/srv/www/bedrock.com/releases/20150423202404/.envā€™ā€ā€˜"ā€™ā€œ, ā€œrbā€) buf = afile.read(BLOCKSIZE) while len(buf) > 0: hasher.update(buf) buf = afile.read(BLOCKSIZE) afile.close() print(hasher.hexdigest())'ā€ā€˜"ā€™ 2>/dev/null) || (echo ā€˜"ā€™ā€œ'0 'ā€ā€˜"ā€™/srv/www/bedrock.com/releases/20150423202404/.env)ā€™
<45.55.241.241> PUT /var/folders/xy/1kc57lfs7rn18nrjdpypxmxh0000gn/T/tmpUMJrOe TO /home/web/.ansible/tmp/ansible-tmp-1429835255.09-529137414642/source
<45.55.241.241> PUT /var/folders/xy/1kc57lfs7rn18nrjdpypxmxh0000gn/T/tmpbLrlUm TO /home/web/.ansible/tmp/ansible-tmp-1429835255.09-529137414642/copy
<45.55.241.241> EXEC ssh -C -tt -vvv -o ForwardAgent=yes -o ControlMaster=auto -o ControlPersist=60s -o ControlPath=ā€œ/Users/danielbell/.ansible/cp/ansible-ssh-%h-%p-%rā€ -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=web -o ConnectTimeout=10 45.55.241.241 /bin/sh -c ā€˜LANG=en_US.UTF-8 LC_CTYPE=en_US.UTF-8 /usr/bin/python /home/web/.ansible/tmp/ansible-tmp-1429835255.09-529137414642/copy; rm -rf /home/web/.ansible/tmp/ansible-tmp-1429835255.09-529137414642/ >/dev/null 2>&1ā€™
changed: [45.55.241.241] => (item={ā€˜destā€™: ā€˜.envā€™, ā€˜srcā€™: ā€˜roles/deploy/templates/env.j2ā€™, ā€˜nameā€™: ā€˜.env configā€™}) => {ā€œchangedā€: true, ā€œchecksumā€: ā€œ4ec357d01f1c372b44fb51d9071708ff628c2cf9ā€, ā€œdestā€: ā€œ/srv/www/bedrock.com/releases/20150423202404/.envā€, ā€œgidā€: 33, ā€œgroupā€: ā€œwww-dataā€, ā€œitemā€: {ā€œdestā€: ā€œ.envā€, ā€œnameā€: ā€œ.env configā€, ā€œsrcā€: ā€œroles/deploy/templates/env.j2ā€}, ā€œmd5sumā€: ā€œ1f3c5af870c3fdb143511dbe15cd4e45ā€, ā€œmodeā€: ā€œ0644ā€, ā€œownerā€: ā€œwebā€, ā€œsizeā€: 347, ā€œsrcā€: ā€œ/home/web/.ansible/tmp/ansible-tmp-1429835255.09-529137414642/sourceā€, ā€œstateā€: ā€œfileā€, ā€œuidā€: 1000}

TASK: [deploy | Run pre_build_commands in the new_release_path] ***************
skipping: [45.55.241.241]

TASK: [deploy | Check if project folders exist] *******************************
<45.55.241.241> ESTABLISH CONNECTION FOR USER: web
<45.55.241.241> REMOTE_MODULE stat path=ā€œ/srv/www/bedrock.com/current/vendorā€
<45.55.241.241> EXEC ssh -C -tt -vvv -o ForwardAgent=yes -o ControlMaster=auto -o ControlPersist=60s -o ControlPath=ā€œ/Users/danielbell/.ansible/cp/ansible-ssh-%h-%p-%rā€ -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=web -o ConnectTimeout=10 45.55.241.241 /bin/sh -c ā€˜mkdir -p $HOME/.ansible/tmp/ansible-tmp-1429835256.76-125569270747672 && chmod a+rx $HOME/.ansible/tmp/ansible-tmp-1429835256.76-125569270747672 && echo $HOME/.ansible/tmp/ansible-tmp-1429835256.76-125569270747672ā€™
<45.55.241.241> PUT /var/folders/xy/1kc57lfs7rn18nrjdpypxmxh0000gn/T/tmpOOiDvK TO /home/web/.ansible/tmp/ansible-tmp-1429835256.76-125569270747672/stat
<45.55.241.241> EXEC ssh -C -tt -vvv -o ForwardAgent=yes -o ControlMaster=auto -o ControlPersist=60s -o ControlPath=ā€œ/Users/danielbell/.ansible/cp/ansible-ssh-%h-%p-%rā€ -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=web -o ConnectTimeout=10 45.55.241.241 /bin/sh -c ā€˜LANG=en_US.UTF-8 LC_CTYPE=en_US.UTF-8 /usr/bin/python /home/web/.ansible/tmp/ansible-tmp-1429835256.76-125569270747672/stat; rm -rf /home/web/.ansible/tmp/ansible-tmp-1429835256.76-125569270747672/ >/dev/null 2>&1ā€™
ok: [45.55.241.241] => (item=vendor) => {ā€œchangedā€: false, ā€œitemā€: ā€œvendorā€, ā€œstatā€: {ā€œexistsā€: false}}

TASK: [deploy | Copy project folders] *****************************************
skipping: [45.55.241.241] => (item={ā€˜invocationā€™: {ā€˜module_nameā€™: uā€™statā€™, ā€˜module_argsā€™: uā€™path=ā€œ/srv/www/bedrock.com/current/vendorā€ā€˜}, ā€˜itemā€™: ā€˜vendorā€™, uā€™statā€™: {uā€™existsā€™: False}, uā€™changedā€™: False})

TASK: [deploy | Ensure shared sources are present] ****************************
<45.55.241.241> ESTABLISH CONNECTION FOR USER: web
<45.55.241.241> REMOTE_MODULE file path=ā€œ/srv/www/bedrock.com/shared/uploadsā€ state=ā€œdirectoryā€
<45.55.241.241> EXEC ssh -C -tt -vvv -o ForwardAgent=yes -o ControlMaster=auto -o ControlPersist=60s -o ControlPath=ā€œ/Users/danielbell/.ansible/cp/ansible-ssh-%h-%p-%rā€ -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=web -o ConnectTimeout=10 45.55.241.241 /bin/sh -c ā€˜mkdir -p $HOME/.ansible/tmp/ansible-tmp-1429835257.72-183071889507253 && chmod a+rx $HOME/.ansible/tmp/ansible-tmp-1429835257.72-183071889507253 && echo $HOME/.ansible/tmp/ansible-tmp-1429835257.72-183071889507253ā€™
<45.55.241.241> PUT /var/folders/xy/1kc57lfs7rn18nrjdpypxmxh0000gn/T/tmpWpeu6y TO /home/web/.ansible/tmp/ansible-tmp-1429835257.72-183071889507253/file
<45.55.241.241> EXEC ssh -C -tt -vvv -o ForwardAgent=yes -o ControlMaster=auto -o ControlPersist=60s -o ControlPath=ā€œ/Users/danielbell/.ansible/cp/ansible-ssh-%h-%p-%rā€ -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=web -o ConnectTimeout=10 45.55.241.241 /bin/sh -c ā€˜LANG=en_US.UTF-8 LC_CTYPE=en_US.UTF-8 /usr/bin/python /home/web/.ansible/tmp/ansible-tmp-1429835257.72-183071889507253/file; rm -rf /home/web/.ansible/tmp/ansible-tmp-1429835257.72-183071889507253/ >/dev/null 2>&1ā€™
ok: [45.55.241.241] => (item={ā€˜pathā€™: ā€˜web/app/uploadsā€™, ā€˜srcā€™: ā€˜uploadsā€™}) => {ā€œchangedā€: false, ā€œgidā€: 33, ā€œgroupā€: ā€œwww-dataā€, ā€œitemā€: {ā€œpathā€: ā€œweb/app/uploadsā€, ā€œsrcā€: ā€œuploadsā€}, ā€œmodeā€: ā€œ0755ā€, ā€œownerā€: ā€œwebā€, ā€œpathā€: ā€œ/srv/www/bedrock.com/shared/uploadsā€, ā€œsizeā€: 4096, ā€œstateā€: ā€œdirectoryā€, ā€œuidā€: 1000}

TASK: [deploy | Ensure shared paths are absent] *******************************
<45.55.241.241> ESTABLISH CONNECTION FOR USER: web
<45.55.241.241> REMOTE_MODULE file path=ā€œ/srv/www/bedrock.com/releases/20150423202404/web/app/uploadsā€ state=absent
<45.55.241.241> EXEC ssh -C -tt -vvv -o ForwardAgent=yes -o ControlMaster=auto -o ControlPersist=60s -o ControlPath=ā€œ/Users/danielbell/.ansible/cp/ansible-ssh-%h-%p-%rā€ -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=web -o ConnectTimeout=10 45.55.241.241 /bin/sh -c ā€˜mkdir -p $HOME/.ansible/tmp/ansible-tmp-1429835258.76-200400019701731 && chmod a+rx $HOME/.ansible/tmp/ansible-tmp-1429835258.76-200400019701731 && echo $HOME/.ansible/tmp/ansible-tmp-1429835258.76-200400019701731ā€™
<45.55.241.241> PUT /var/folders/xy/1kc57lfs7rn18nrjdpypxmxh0000gn/T/tmp5u0uyr TO /home/web/.ansible/tmp/ansible-tmp-1429835258.76-200400019701731/file
<45.55.241.241> EXEC ssh -C -tt -vvv -o ForwardAgent=yes -o ControlMaster=auto -o ControlPersist=60s -o ControlPath=ā€œ/Users/danielbell/.ansible/cp/ansible-ssh-%h-%p-%rā€ -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=web -o ConnectTimeout=10 45.55.241.241 /bin/sh -c ā€˜LANG=en_US.UTF-8 LC_CTYPE=en_US.UTF-8 /usr/bin/python /home/web/.ansible/tmp/ansible-tmp-1429835258.76-200400019701731/file; rm -rf /home/web/.ansible/tmp/ansible-tmp-1429835258.76-200400019701731/ >/dev/null 2>&1ā€™
ok: [45.55.241.241] => (item={ā€˜pathā€™: ā€˜web/app/uploadsā€™, ā€˜srcā€™: ā€˜uploadsā€™}) => {ā€œchangedā€: false, ā€œitemā€: {ā€œpathā€: ā€œweb/app/uploadsā€, ā€œsrcā€: ā€œuploadsā€}, ā€œpathā€: ā€œ/srv/www/bedrock.com/releases/20150423202404/web/app/uploadsā€, ā€œstateā€: ā€œabsentā€}

TASK: [deploy | Create shared symlinks] ***************************************
<45.55.241.241> ESTABLISH CONNECTION FOR USER: web
<45.55.241.241> REMOTE_MODULE file path=ā€œ/srv/www/bedrock.com/releases/20150423202404/web/app/uploadsā€ src=ā€œ/srv/www/bedrock.com/shared/uploadsā€ state=link
<45.55.241.241> EXEC ssh -C -tt -vvv -o ForwardAgent=yes -o ControlMaster=auto -o ControlPersist=60s -o ControlPath=ā€œ/Users/danielbell/.ansible/cp/ansible-ssh-%h-%p-%rā€ -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=web -o ConnectTimeout=10 45.55.241.241 /bin/sh -c ā€˜mkdir -p $HOME/.ansible/tmp/ansible-tmp-1429835259.8-233836316771629 && chmod a+rx $HOME/.ansible/tmp/ansible-tmp-1429835259.8-233836316771629 && echo $HOME/.ansible/tmp/ansible-tmp-1429835259.8-233836316771629ā€™
<45.55.241.241> PUT /var/folders/xy/1kc57lfs7rn18nrjdpypxmxh0000gn/T/tmpxkJXPk TO /home/web/.ansible/tmp/ansible-tmp-1429835259.8-233836316771629/file
<45.55.241.241> EXEC ssh -C -tt -vvv -o ForwardAgent=yes -o ControlMaster=auto -o ControlPersist=60s -o ControlPath=ā€œ/Users/danielbell/.ansible/cp/ansible-ssh-%h-%p-%rā€ -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=web -o ConnectTimeout=10 45.55.241.241 /bin/sh -c ā€˜LANG=en_US.UTF-8 LC_CTYPE=en_US.UTF-8 /usr/bin/python /home/web/.ansible/tmp/ansible-tmp-1429835259.8-233836316771629/file; rm -rf /home/web/.ansible/tmp/ansible-tmp-1429835259.8-233836316771629/ >/dev/null 2>&1ā€™
failed: [45.55.241.241] => (item={ā€˜pathā€™: ā€˜web/app/uploadsā€™, ā€˜srcā€™: ā€˜uploadsā€™}) => {ā€œfailedā€: true, ā€œitemā€: {ā€œpathā€: ā€œweb/app/uploadsā€, ā€œsrcā€: ā€œuploadsā€}, ā€œpathā€: ā€œ/srv/www/bedrock.com/releases/20150423202404/web/app/uploadsā€, ā€œstateā€: ā€œabsentā€}
msg: Error while linking: [Errno 2] No such file or directory

FATAL: all hosts have already failed ā€“ aborting

PLAY RECAP ********************************************************************
to retry, use: --limit @/Users/danielbell/deploy.retry

45.55.241.241 : ok=11 changed=4 unreachable=0 failed=1

Going to open up a new topic with this new issue. I guess Iā€™ll consider this solved for now even though I foresee this becoming a hassle. Iā€™ll see if the rest of the team runs into the same issue before I worry about it too much.

Thanks again for all your help!

Whatā€™s your folder structure of the repository you deployed like? Is Bedrock the root folder? Or a sub-folder like we have here: https://github.com/roots/roots-example-project.com

If so, you need to set subtree like here

Ok, that deffinetly sounds like it could be part of the issue. However when I add that like so:

local_path: ā€˜ā€¦/bedrockā€™ # path targeting local Bedrock project directory (relative to Ansible root)
repo: git@bitbucket.org:newbird/bedrock.git
subtree: bedrock
multisite:
enabled: false
subdomains: false

and then try to deploy again, I get this:

TASK: [deploy | Move project subtree into root folder] ************************
fatal: [45.55.241.241] => error while evaluating conditional: bedrock

What version of Ansible are you running?

Stupid question (just because Iā€™m on the cusp of jumping into the same challenge getting this configured as well, and Iā€™m watching with great interest), butā€¦ why is the github_ssh_keys list thusly named?

How does github factor into the deployment at all if my/whomeverā€™s project isnā€™t hosted on github?

And doesnā€™t the bedrock-ansible deployment use the local dev files to produce and transmit the deployment to staging/prod (or if I donā€™t even have a github account)?

How can we simply reference an ssh key that exists on our local machine to authenticate the deployment?

I believe I have the most recent version considering I just installed this 3 days ago. But, just in case, how do I check which version I am currently using?

@timichango I think github ssh is used so the production server can clone the github repo etc. Itā€™s like a 3 way communication, between

local <-> production server <-> github repo (and github <-> local of course)

So in a way all 3 need to be connected with ssh keys. For some of the above errors, i had to login to the DO droplet (after provision) as ā€œwebā€ user and create a SSH key for him and add it to github. And then try the deploy.

Although i get he same error: error while evaluating conditional at end.

Hereā€™s my understanding. Corrections welcome.

Q. How does ā€˜rootā€™ connect to remote (e.g., to run server.yml playbook)?
A. ā€˜rootā€™ uses pub key you added when initially spinning up DO droplet

Q. How does ā€˜webā€™ user connect to remote (e.g., to run deploy.yml playbook)?
A. ā€˜webā€™ user uses pub key added to remote for ā€˜webā€™ user.

Q. Wait, how was a pub key added to remote for ā€˜webā€™ user?
A. If you defined the github_ssh_keys dictionary, the server.yml playbook used that info to retrieve the public key from github and load it on your remote for ā€˜webā€™ to use.

Q. Why not just have bedrock-ansible copy up my pub key instead going to github to get it?
A. Itā€™s a mere convenience, but also, what if you want to add a pub key for ā€˜randomguyā€™ user so he can deploy too, but you donā€™t have that key on your local machine? Just add randomguyā€™s github username to the github_ssh_keys list and bedrock-ansible will get it for you (courtesy of the exceptionally intelligent @austinpray here).

Q. Errā€¦ but if I donā€™t have my pub key on github and donā€™t want to add itā€¦ how do I get a pub key on remote server for ā€˜webā€™ user to use?
A. Manually load up your pub key on the remote for ā€˜webā€™ user (e.g., after running server.yml. Lots of searchable info out there on how.

Q. How does my remote server make the connection to a private repo (github or other) to clone/install?
A. github_ssh_keys actually doesnā€™t have anything to do with this. You should have SSH Forwarding set up, which allows the remote server to use your local machineā€™s credentials to connect to the private repo.

Q. So, whatā€™s with the name github_ssh_keys again?
A. Itā€™s not that you use these keys to connect to a github repo (deploy.yml will use ssh forwarding to connect to private repo). Rather, bedrock-ansible will conveniently fetch any pub ssh keys from github that you specify, then load them on the server for users to use (like for ā€˜webā€™ user).

Q. I want more of this ssh stuff. MORE!
A. see the SSH Keys wiki

Q. So, how do I get some files on the server if I donā€™t want to have the server clone them from a repo?
A. Check out how bedrock-ansible makes it possible to sync files from your local machine upon each deployment.

Q. How do I check my Ansible version?
A. Lots of searchable info on this out there.

@darjanpanic Regarding ā€œerror while evaluating conditionalā€, I suspect your group_vars/<environment> files may be missing the ssl enabled false info like this, but not sure without more details. If the problem persists, you could start a new thread.

Letā€™s put any new specific and focused questions in new threads.

6 Likes

Added these to our Wiki page: https://github.com/roots/bedrock-ansible/wiki/SSH-Keys

@timichango Iā€™d recommend adding your key to github and using bedrock-ansibleā€™s defaults for loading up your key. That way you wouldnā€™t have to maintain an alteration to bedrock-ansibleā€™s roles.

But Ansibleā€™s authorized_key module makes it easy to load a key from your local machine to the server. If I were doing it, Iā€™d add a task at the end of roles/users/tasks/main.yml:

- name: Add SSH key for web user
  authorized_key: user="{{ web_user }}" key="{{ lookup('file', '/local/path/to/public/key/id_rsa.pub') }}"

(wish those lines werenā€™t wrapping)

2 Likes

Iā€™m having the same issue. The problem Iā€™ve noticed is with the port :22. Iā€™ve created the secure admin sudo user and password and can login to the droplet just fine with an ssh command. But if I try to ssh into the server:22, it tells me ā€œCould not resolve hostname ...*:22: nodename nor servname provided, or not knownā€

Could this have to do with it?