mitchellh/packer — pull request #963 by rhburrows (2014-03-18 18:50:45+00:00)
Title: Fix ansible paths when provisioning Linux from Windows

When using Ansible-local to provision a Linux VM from Windows it is crashing with an error like the following:

```
virtualbox-iso: Provisioning with Ansible...
virtualbox-iso: Creating Ansible staging directory...
virtualbox-iso: Creating directory: /tmp/packer-provisioner-ansible-local
virtualbox-iso: Uploading main Playbook file...
virtualbox-iso: Uploading additional Playbooks...
virtualbox-iso: Creating directory: \tmp\packer-provisioner-ansible-local\playbooks
virtualbox-iso: Creating directory: \tmp\packer-provisioner-ansible-local\playbooks\tasks
virtualbox-iso: Executing Ansible: ansible-playbook \tmp\packer-provisioner-ansible-local\dev_config.yml --extra-vars task_path=playbooks/tasks -c local -i "127.0.0.1,"
virtualbox-iso: ERROR: the playbook: tmppacker-provisioner-ansible-localdev_config.yml could not be found
virtualbox-iso: Unregistering and deleting virtual machine...
virtualbox-iso: Deleting output directory...
Build 'virtualbox-iso' errored: Error executing Ansible: Non-zero exit status: 1
```

This is happening because the path to the files is being generated on the host Windows machine and executed on the Linux VM so it doesn't recognize the path separator. This patch converts all the paths to using '/' for the separator.

I'm not very familiar with Go but I believe using a slash for the separator will work for either case on the VM operating system. I'm basing this on the comment here:

https://github.com/mitchellh/packer/blob/master/communicator/ssh/communicator.go#L168

I don't have a big variety of environments to test on but this change worked for the above mentioned case for me.

It looks like there is a similar issue for the chef-solo provisioner in #394