Ansible deploy subtree failure on web/app/uploads directory

Having a wonderful time with all the hard work you guys have put in to ansible-bedrock and all the other projects that have emerged … with you since the get go … o.g. roots … so first things first THANKS GUYS!

And now to the issue at hand …

I got my vagrant up, then I got my provision on and all is wonderful in the land of little sleep, but, on deploy to my freshly-created, digital-ocean-ansible-provisioned, droplet I hit the snag mentioned here on this closed thread - Symlink issues with deploys - #12 by treb0r

… not exactly the same but close enough …

I’ve checked that I had the latest files as mentioned there ( assumed I would since I only cloned them 48 hours ago ) and they are there …

$ ag subtree main.yml
4:project_subtree: "{{ project.subtree | default(false) }}"
$ ag subtree main.yml
18:- name: Move project subtree into root folder
19:  shell: mv {{ deploy_helper.new_release_path }}/{{ project_subtree }}/* {{ deploy_helper.new_release_path }}
20:  when: project_subtree != 'False'

Here is the fail:

TASK: [deploy | Create shared symlinks] *************************************** 
failed: [x.x.x.x] => (item={'path': 'web/app/uploads', 'src': 'uploads'}) => {"failed": true, "item": {"path": "web/app/uploads", "src": "uploads"}, "path": "/srv/www/", "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/me/deploy.retry

x.x.x.x            : ok=11   changed=7    unreachable=0    failed=1   

Any clue why it’s failing on this?

What does your directory structure look like? It if looks like this;


I think you’ll need to add subtree: site to your group_vars/production and/or staging.

1 Like

Yes, my directory structure is as such … it’s set up exactly like the roots example project … I’ll give that a go

Thanks Poggen that did it … I checked that file for comparison too before I ran the deploy and somehow missed that … ( someone needs thicker glasses … heh )

1 Like

I fear I might be losing my mind … previously when this got resolved I had checked my group_vars/production against the one on the example project site and realized that the example project did in fact have the subtree: site in it and mine ( cloned from ansible repo ) did not, so, I added it and all was good.

Now I am on a new project with new files and I was having an issue that made me think that perhaps I needed to also set the site:subtree entry in my group_vars/development, so I referred back to the example project to how it was done there again and lo and behold the subtree: site entry in group_vars/production isn’t even there any more, but, there is no commit or file change notification to represent this change?

Very confused right now as to whether I need to continue using the site:subtree directive now as my directory structure is exactly like the Project Example and all traces of it are now gone from the files there … and also this entry in group_vars seems to have vanished as well from the example so wondering if I should still be using it …


  • path: "{{ project.local_path }}/web/app/themes/sage"
    cmd: npm install
  • path: "{{ project.local_path }}/web/app/themes/sage"
    cmd: bower install
  • path: "{{ project.local_path }}/web/app/themes/sage"
    cmd: gulp --production


  • name: compiled theme assets
    src: "{{ project.local_path }}/web/app/themes/sage/dist"
    dest: web/app/themes/sage

I’m too green with all the new stuff I’m learning right now, so, trying to stay very vanilla and reliant on the example files so when they change without comment I’m a bit lost unfortunately.

Any help on this is most welcome~

@swalkinshaw explained the way subtree works in another thread:

1 Like

That’s what I thought … and the project example is set up this way too … hence when you answered my initial question with this info I went to the project example and verified that the subtree: site directive was in fact in the example project’s group_vars/production file … this is why I am so confused why it isn’t there now … am I crazy?

subtree: site is still in the example repo.

Well that answers that then … I am crazy … that’s twice I’ve done that now … I actually said to myself "self, you know you missed this before … are you sure you’re not looking at the ansible repo instead of the example project repo … I seriously checked so many times and still managed to be comparing files in the wrong repo … heh … time to get some sleep for sure … and thanks for setting me straight again.

That answers the mysteriously missing project_pre_build question as well …

I do have one question remaining though … I noticed on the example project that they don’t have the subtree: site directive in the group_vars/development file … isn’t this needed there as well? I have it in my development file and that is correct for my setup right? My setup being exactly the same as the example project~

I removed subtree from my local dev group_vars because I don’t think it has any relevance there … correct me if I’m wrong … otherwise, just consider this ancient history :wink:

subtree is only used for deployments so it can be left out whenever you aren’t deploying (like in development for example).

Thank you for the confirmation @swalkinshaw :wink: