Please note that the file exists (ls -la 
</home/centos/packer/provision.sh>) and it has execute permission as well.

On Monday, March 5, 2018 at 7:33:14 PM UTC+8, Bubunia Patra wrote:
>
> Hi all,
>
> I want to pass some command arguments to the provisioning script in packer 
> for creating an AMI image.  But I am getting "No such file or directory". 
> Can anyone help me in this regard?
> I also having issue when I have multiline strings being passed to packer. 
> I checked the below thread and its somehow adding \n doesnt work.
>
>
> https://stackoverflow.com/questions/16690101/can-a-json-value-contain-a-multiline-string
>
> Can anyone help me in this regard?
>
> Regards
> Pradeep
>
> {
>   "variables": {
>     "aws_access_key": "{{env `PACKER_AWS_ACCESS_KEY`}}",
>     "aws_secret_key": "{{env `PACKER_AWS_SECRET_KEY`}}",
>     "aws_region": "{{env `PACKER_AWS_REGION`}}",
>     "prod_name": "abcd",
>     "image_name": "abc",
>     "version_number": "v1",
>     "ami_filter": "CentOS Linux 7 x86_64 HVM EBS 
> 1704_01-b7ee8a69-ee97-4a49-9e68-afaee216db2e-ami-d52f5bc3.4",
>     "ssh_user_name": "centos",
>     "env_type": "test",
>     "provision_script": "/home/centos/packer/provision.sh",
>     "arg1" : "hello",
>     "arg2" : "world"
>
>    "builders": [
>     {
>                 "name": "packer_eu_west_ebs",
>                 "type": "amazon-ebs",
>                 "access_key": "{{user `aws_access_key`}}",
>                 "secret_key": "{{user `aws_secret_key`}}",
>                 "region": "{{user `aws_region`}}",
>                 "source_ami_filter": {
>                         "filters": {
>                           "name": "{{user `ami_filter`}}"
>                         },
>                         "most_recent": true
>                 },
>                 "instance_type": "t2.small"
>           }
>         ]
>
>
>    "provisioners": [
>     {
>       "type": "shell",
>           "execute_command": "{{.Vars}} sudo -E -S bash '{{.Path}}'",
>            "inline": [
>                       "{{user `provision_script`}} {{user `arg1`}} {{user 
> `arg2`}}"
>
>
>             ]
>           }
>        ]
>     }
>
>
> Error:
>
>
> ==> packer_eu_west_ebs: Pausing after run of step 'StepRunSourceInstance'. 
> Press enter to continue. ==> packer_eu_west_ebs: Pausing after run of step 
> 'StepTagEBSVolumes'. Press enter to continue. ==> packer_eu_west_ebs: 
> Pausing after run of step 'StepGetPassword'. Press enter to continue.
> ==> packer_eu_west_ebs: Waiting for SSH to become available...
> ==> packer_eu_west_ebs: Connected to SSH!
> ==> packer_eu_west_ebs: Pausing after run of step 'StepConnect'. Press 
> enter to continue.
> ==> packer_eu_west_ebs: Provisioning with shell script: 
> /tmp/packer-shell705621081
>     packer_eu_west_ebs: /tmp/script_619.sh: line 2: 
> /home/centos/packer/provision.sh: No such file or directory
>

-- 
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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/packer-tool/83dba316-62a2-452b-9328-b508df034eaf%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to