Error on Deploy (trying to compile source files for Theme)

I added this snippet to my staging deploy to compile the theme files so it would compile the assets for the site’s theme and push them up to the server:

project_pre_build_commands_local: - path: "{{ project.local_path }}/web/app/themes/sarah" cmd: npm install - path: "{{ project.local_path }}/web/app/themes/sarah" cmd: bower install - path: "{{ project.local_path }}/web/app/themes/sarah" cmd: gulp --production project_local_files: - name: compiled theme assets src: "{{ project.local_path }}/web/app/themes/sarah/dist" dest: web/app/themes/sarah

I took this from the roots-example-project.com repo. I have local_path set to ../site which is where the Bedrock piece is located. When I try to run the deploy script, I get this:

fatal: [d6dstaging.com] => Failed to template {{ wordpress_sites[site] }}: Failed to template {{ project.local_path }}/web/app/themes/sarah/dist: Failed to template {{ wordpress_sites[site] }}: Failed to template {{ project.local_path }}/web/app/themes/sarah/dist: Failed to template {{ wordpress_sites[site] }}: Failed to template {{ project.local_path }}/web/app/themes/sarah/dist: Failed to template {{ wordpress_sites[site] }}: Failed to template {{ project.local_path }}/web/app/themes/sarah/dist: Failed to template {{ wordpress_sites[site] }}: Failed to template {{ project.local_path }}/web/app/themes/sarah/dist: Failed to template {{ wordpress_sites[site] }}: Failed to template {{ project.local_path }}/web/app/themes/sarah/dist: Failed to template {{ wordpress_sites[site] }}: Failed to template {{ project.local_path }}/web/app/themes/sarah/dist: Failed to template {{ wordpress_sites[site] }}: Failed to template {{ project.local_path }}/web/app/themes/sarah/dist: Failed to template {{ wordpress_sites[site] }}: Failed to template {{ project.local_path }}/web/app/themes/sarah/dist: Failed to template {{ wordpress_sites[site] }}: Failed to template {{ project.local_path }}/web/app/themes/sarah/dist: Failed to template {{ wordpress_sites[site] }}: Failed to template {{ project.local_path }}/web/app/themes/sarah/dist: Failed to template {{ wordpress_sites[site] }}: Failed to template {{ project.local_path }}/web/app/themes/sarah/dist: Failed to template {{ wordpress_sites[site] }}: Failed to template {{ project.local_path }}/web/app/themes/sarah/dist: Failed to template {{ wordpress_sites[site] }}: Failed to template {{ project.local_path }}/web/app/themes/sarah/dist: Failed to template {{ wordpress_sites[site] }}: Failed to template {{ project.local_path }}/web/app/themes/sarah/dist: Failed to template {{ wordpress_sites[site] }}: Failed to template {{ project.local_path }}/web/app/themes/sarah/dist: Failed to template {{ wordpress_sites[site] }}: Failed to template {{ project.local_path }}/web/app/themes/sarah/dist: Failed to template {{ wordpress_sites[site] }}: Failed to template {{ project.local_path }}/web/app/themes/sarah/dist: Failed to template {{ wordpress_sites[site] }}: Failed to template {{ project.local_path }}/web/app/themes/sarah/dist: Failed to template {{ wordpress_sites[site] }}: Failed to template {{ project.local_path }}/web/app/themes/sarah/dist: Failed to template {{ wordpress_sites[site] }}: Failed to template {{ project.local_path }}/web/app/themes/sarah/dist: Failed to template {{ wordpress_sites[site] }}: Failed to template {{ project.local_path }}/web/app/themes/sarah/dist: Failed to template {{ wordpress_sites[site] }}: Failed to template {{ project.local_path }}/web/app/themes/sarah/dist: Failed to template {{ wordpress_sites[site] }}: Failed to template {{ project.local_path }}/web/app/themes/sarah/dist: Failed to template {{ wordpress_sites[site] }}: Failed to template {{ project.local_path }}/web/app/themes/sarah/dist: Failed to template {{ wordpress_sites[site] }}: Failed to template {{ project.local_path }}/web/app/themes/sarah/dist: Failed to template {{ wordpress_sites[site] }}: Failed to template {{ project.local_path }}/web/app/themes/sarah/dist: Failed to template {{ wordpress_sites[site] }}: Failed to template {{ project.local_path }}/web/app/themes/sarah/dist: Failed to template {{ wordpress_sites[site] }}: Failed to template {{ project.local_path }}/web/app/themes/sarah/dist: Failed to template {{ wordpress_sites[site] }}: Failed to template {{ project.local_path }}/web/app/themes/sarah/dist: Failed to template {{ wordpress_sites[site] }}: Failed to template {{ project.local_path }}/web/app/themes/sarah/dist: Failed to template {{ wordpress_sites[site] }}: Failed to template {{ project.local_path }}/web/app/themes/sarah/dist: Failed to template {{ wordpress_sites[site] }}: Failed to template {{ project.local_path }}/web/app/themes/sarah/dist: Failed to template {{ wordpress_sites[site] }}: Failed to template {{ project.local_path }}/web/app/themes/sarah/dist: Failed to template {{ wordpress_sites[site] }}: Failed to template {{ project.local_path }}/web/app/themes/sarah/dist: Failed to template {{ wordpress_sites[site] }}: Failed to template {{ project.local_path }}/web/app/themes/sarah/dist: Failed to template {{ wordpress_sites[site] }}: Failed to template {{ project.local_path }}/web/app/themes/sarah/dist: Failed to template {{ wordpress_sites[site] }}: Failed to template {{ project.local_path }}/web/app/themes/sarah/dist: Failed to template {{ wordpress_sites[site] }}: Failed to template {{ project.local_path }}/web/app/themes/sarah/dist: Failed to template {{ wordpress_sites[site] }}: Failed to template {{ project.local_path }}/web/app/themes/sarah/dist: Failed to template {{ wordpress_sites[site] }}: Failed to template {{ project.local_path }}/web/app/themes/sarah/dist: Failed to template {{ wordpress_sites[site] }}: Failed to template {{ project.local_path }}/web/app/themes/sarah/dist: Failed to template {{ wordpress_sites[site] }}: Failed to template {{ project.local_path }}/web/app/themes/sarah/dist: Failed to template {{ wordpress_sites[site] }}: Failed to template {{ project.local_path }}/web/app/themes/sarah/dist: Failed to template {{ wordpress_sites[site] }}: Failed to template {{ project.local_path }}/web/app/themes/sarah/dist: Failed to template {{ wordpress_sites[site] }}: Failed to template {{ project.local_path }}/web/app/themes/sarah/dist: Failed to template {{ wordpress_sites[site] }}: Failed to template {{ project.local_path }}/web/app/themes/sarah/dist: Failed to template {{ wordpress_sites[site] }}: Failed to template {{ project.local_path }}/web/app/themes/sarah/dist: Failed to template {{ wordpress_sites[site] }}: Failed to template {{ project.local_path }}/web/app/themes/sarah/dist: Failed to template {{ wordpress_sites[site] }}: Failed to template {{ project.local_path }}/web/app/themes/sarah/dist: Failed to template {{ wordpress_sites[site] }}: Failed to template {{ project.local_path }}/web/app/themes/sarah/dist: Failed to template {{ wordpress_sites[site] }}: Failed to template {{ project.local_path }}/web/app/themes/sarah/dist: Failed to template {{ wordpress_sites[site] }}: Failed to template {{ project.local_path }}/web/app/themes/sarah/dist: Failed to template {{ wordpress_sites[site] }}: recursive loop detected in template string: {{ wordpress_sites[site] }}

This happened at the gathering facts stage so no steps of the deploy actually ran. The server deployment ran without any issues. I’m not sure if I typed something wrong, but I just took the snippet from the example repo and changed the path to match where the theme is.

I haven’t seen this error before.

  • You entered those definitions into group_vars/staging right (not somewhere like roles/deploy/tasks/main.yml)?
  • What is your ansible version?
  • Any promising leads from searching around for this error elsewhere? Seems like there’s some discussion of this error over at github ansible.

If you see many more unusual errors, you might try a fresh clone of various roots components, seeing if you can get things working with the defaults before making many customizations. Then customize and test as you go.

1 Like

Yes, I did put those definitions into group_vars/staging. I can put it up in a gist if anyone would think it would be helpful to troubleshoot.

It is Ansible 1.9.1. I’m running this on a Ubuntu 14.04 droplet that I’m using as a control server since I had too many issues doing this with Windows.

There were some bugs from older versions, but didn’t see anything with 1.9.1.

I just replaced the variable with …/site/ and it worked for me that way.

If you’ve got it working, that’s great. Note the issues with Ansible 1.9.1. You may want to stick with 1.9.0.1 till the next version comes out.

Well, I spoke too soon. The playbook ran without any errors, but there’s no dist folder on the server. I guess the commands did not run correctly.

It looks like it’s skipping the Copy project local files step of the playbook and I don’t know why. I just ran the gulp --production myself to create the dist folder and this is what I have in the staging variables file:

project_local_files: - name: compiled theme assets src: '../site/web/app/themes/sarah/dist' dest: web/app/themes/sarah

I can’t think of why it would skip the Copy project local files unless project_local_files was an empty list/array. You could double check what ansible is seeing as the value for that variable by dropping this at the top of roles/deploy/tasks/main.yml:

- debug: var=project_local_files
- fail:

… then run the deploy again. It will dump the contents of project_local_files in the output.

You also might want to try rsyncing manually from the control machine to the remote server, just to double-check that it’s not just an rsync issue (vs. an ansible issue). If the manual rsync works, but the Copy project local files task keeps giving you trouble, you might see if anything catches your eye in the docs for ansible’s synchronize module, which is just a wrapper for rsync.

Did you solve this, @romero2k? Think I might have the same issue as you and any insight on how to managed to work through it would be greatly appreciated!

I ended up just scp’ing the folder to the server. Did not have time to really dig into it too much.