Deploying a Bedrock site with Ansible

Hello,

I’ve been trying to deploy a site with built with Bedrock with Ansible. I executed the command:

./deploy.sh staging example.com

The deploy keeps failing at TASK: [deploy | Clone project files] with the following error message:

msg: fatal: could not create work tree dir ‘/srv/www/tarasiewicz.net/shared/source’.: Permission denied

What am I missing here? You’re help will be so much appreciated.

This shouldn’t be happening obviously.

Make sure that your deploy.yml playbook is using the web_user: https://github.com/roots/bedrock-ansible/blob/cb32683f5ee81f3dc21fc1b2a89e86531e11d838/deploy.yml#L4

If it is, you can start by looking at the permissions:

ls -la /srv/www/tarasiewicz.net
ls -la /srv/www/tarasiewicz.net/shared

Hi @swalkinshaw, thanks for the answer. I’ve now added the web user to the deploy group that is the owner of my site as I deployed with Capistrano earlier.

Now the Ansible deploy process goes further, but it breaks at the end at

TASK: [deploy | Finalize the deploy]

with

OSError: [Errno 13] Permission denied: /srv/www/example.com/current

This is wierd since /srv/www/example.com/current is a symlink that has 777 permissions and, what is more, it’s owned by the deploy user that is the owner.

Since permissions were broken before you should probably wipe the whole /srv/www directory and let Ansible re-create it to ensure it’s all correct.

Symlinks always show 777, but the permissions are the same as the folder they’re symlinking, they’re not actually 777

2 Likes