Using file and shell provisioner together in packer fails with " No such file or directory"

27 views
Skip to first unread message

Bubunia Patra

unread,
Sep 30, 2018, 4:27:37 PM9/30/18
to Packer
Hi all,

I want to run a script with argument like test.sh <test.properties> when packer gets executed. 

I am having problem uploading the script file from the current path to the remote ec2 instance.
"variables": {
"scriptdir" : "/home/centos"
}
"provisioners": [
{ "type": "shell", "execute_command": "{{.Vars}} sudo -E -S bash '{{.Path}}'", "scripts": [ "scripts/test.sh" ], "remote_path" : "/home/centos/test.sh" }, { "type": "file", "source": "{{user `scriptdir`}}", "destination": "/home/centos/test.properties" } ] }

Error: /home/centos/test.properties: No such file or directory 
Can anyone please help me in this regard?

Regards
Pradeep

Bubunia Patra

unread,
Sep 30, 2018, 8:37:22 PM9/30/18
to Packer
Sorry I did a typo in this example to provide the correct scriptdir with /home/centos/test properties but I got the same error(no such file or directory). Some how the uploading the files to packer instance is not happening. Need help.

Rickard von Essen

unread,
Oct 1, 2018, 6:51:40 AM10/1/18
to packe...@googlegroups.com
Can you correct the example and provide the exact error message you get?

On Mon, Oct 1, 2018 at 2:37 AM Bubunia Patra <bubunia...@gmail.com> wrote:
Sorry I did a typo in this example to provide the correct scriptdir with /home/centos/test properties but I got the same error(no such file or directory). Some how the uploading the files to packer instance is not happening. Need help.

--
This mailing list is governed under the HashiCorp Community Guidelines - https://www.hashicorp.com/community-guidelines.html. Behavior in violation of those guidelines may result in your removal from this mailing list.

GitHub Issues: https://github.com/mitchellh/packer/issues
IRC: #packer-tool on Freenode
---
You received this message because you are subscribed to the Google Groups "Packer" group.
To unsubscribe from this group and stop receiving emails from it, send an email to packer-tool...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/packer-tool/6bd50285-a483-476d-aa4b-e0534bb63452%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages