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.
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