ansible-for-devops
ansible-for-devops copied to clipboard
Ch4 Node.js playbook; Fatal error "Failed to get information on remote file ... not a directory" when run task "Copy example Node.js app to server
RockyLinux 8.6 Ansible core 2.12.2
When that step is reached using the YAML from the book, ansible throws the following:
fatal: [anstarget3]: FAILED! => {"msg": "Failed to get information on remote file (/usr/local/opt/node/app/app.js): Not a directory"}
It looks like this is down to passing in the var node_apps_location: /usr/local/opt/node
leaves us with no "app" directory into which files can be copied.
Changing line 32 from
file: "path={{ node_apps_location }} state=directory"
to
file: "path={{ node_apps_location }}/app state=directory"
sets it up correctly and all files are copied over as expected.