I’m using Ansible v2.10.6
, as installed by Trellis-cli.
The command I’m having trouble with, in build-before.yml
is:
- name: Install Composer dependencies
composer:
command: install
arguments: --no_dev --optimize_autoloader --no_scripts --classmap_authoritative
working_dir: "{{ project_local_path }}/web/app/plugins/my-plugin"
Where ansible is reporting:
[RuntimeException] ",
Invalid working directory specified, ../site/web/app/plugins/my-plugin does not exist.
This happens even if I hard code the path to the plugin.
Additionally, in troubleshooting, I can see that the directory does exist:
- name: Listing
command: ls -l
register: ls_result
connection: local
args:
chdir: "{{ project_local_path }}/web/app/plugins/my-plugin"
- debug:
msg: "Plugin Listing: {{ ls_result }}"
It prints out the plugin directory contents.
In case my overall approach is misguided, what I’m aiming to do is:
- remove the local vendor directory
- rebuild without the dev dependencies
- install npm dependencies
- compile assets
- copy the vendor and dist directories to the server
- name: Clean out Composer vendor directory
file:
state: absent
path: "{{ project_local_path }}/web/app/plugins/my-plugin/vendor"
delegate_to: localhost
- name: Install Composer dependencies
composer:
command: install
arguments: --no_dev --optimize_autoloader --no_scripts --classmap_authoritative
working_dir: "{{ project_local_path }}/web/app/plugins/my-plugin"
- name: Install Plugin npm requirements
command: yarn install
connection: local
args:
chdir: "{{ project_local_path }}/web/app/plugins/my-plugin"
- name: Build Plugin dist from assets
command: grunt
connection: local
args:
chdir: "{{ project_local_path }}/web/app/plugins/my-plugin"
- name: Copy Plugin dist files
synchronize:
src: "{{ project_local_path }}/web/app/plugins/my-plugin/dist"
dest: "{{ deploy_helper.new_release_path }}/web/app/plugins/my-plugin"
group: no
owner: no
rsync_opts: --chmod=Du=rwx,--chmod=Dg=rx,--chmod=Do=rx,--chmod=Fu=rw,--chmod=Fg=r,--chmod=Fo=r
- name: Copy Plugin vendor directory
synchronize:
src: "{{ project_local_path }}/web/app/plugins/my-plugin/dist"
dest: "{{ deploy_helper.new_release_path }}/web/app/plugins/my-plugin"
group: no
owner: no
rsync_opts: --chmod=Du=rwx,--chmod=Dg=rx,--chmod=Do=rx,--chmod=Fu=rw,--chmod=Fg=r,--chmod=Fo=r
Thanks much, as always for your time, sage insights and wisdom.