I’m not very familiar with ansible, I’m having trouble successfully implementing what is discussed in the 5016 thread.
I created a new folder for my custom deploy hooks and added a yml file with some new tasks to run NPM, Bower, and Gulp.
deploy.yml
:
---
- name: Deploy WP site
hosts: web
remote_user: "{{ web_user }}"
vars:
deploy_build_before: "{{ playbook_dir }}/custom-hooks/finalize-build.yml"
deploy_build_after: "{{ playbook_dir }}/roles/deploy/hooks/build-after.yml"
deploy_finalize_after: "{{ playbook_dir }}/roles/deploy/hooks/finalize-after.yml"
project: "{{ wordpress_sites[site] }}"
project_root: "{{ www_root }}/{{ site }}"
roles:
- deploy
finalize-build.yml
:
---
- name: Run npm install
command: npm install
connection: local
args:
chdir: "{{ project.local_path }}/web/app/themes/my_theme"
- name: Run bower install
command: bower install
connection: local
args:
chdir: "{{ project.local_path }}/web/app/themes/my_theme"
- name: Run gulp
command: gulp --production
connection: local
args:
chdir: "{{ project.local_path }}/web/app/themes/my_theme"
- name: Copy project local files
synchronize: src="{{ item.src }}"
dest="{{ deploy_helper.new_release_path }}/{{ item.dest }}"
group=no
owner=no
rsync_opts=--chmod=Du=rwx,--chmod=Dg=rx,--chmod=Do=rx,--chmod=Fu=rw,--chmod=Fg=r,--chmod=Fo=r
with_items:
- src: "{{ project.local_path }}/web/app/themes/my_theme/dist"
dest: web/app/themes/sage
And the error I’m receiving:
failed: [104.131.113.87] => {"failed": true, "rc": 258}
msg: cannot change to directory '/srv/www/example.com/current/web/app/themes/my_theme': path does not exist
I’m assuming I see that error because the current
directory doesn’t actually get symlinked until the deploy_finalize_after
task is complete.
So when I change deploy_build_before
to deploy_finalize_after
in the deploy.yml
I get no errors, but unfortunately I still have no compiled dist
directory either