On my exploration of Packer I wonder the following:
The docs state (as part of the getting started steps where a Ubuntu image is provisioned to AWS):
Note: The sleep 30 in the example above is very important. Because Packer is able to detect and SSH into the instance as soon as SSH is available, Ubuntu actually doesn't get proper amounts of time to initialize. The sleep makes sure that the OS properly initializes.
It shows an example where a shell provisioner (inline) is the first provisioner to kick in.
Do you always need to sleep 30
before any provisioner is to start, in particular:
- When I start the provisioning block with a file provisioner, does it automatically wait until the OS properly initializes?
- When I run a script/scripts shell provisioner instead of an inline block of commands, do I need to start the first script with
sleep 30
?
If so, would a general suggestion be that you always put this on top of your provisioning block:
"provisioners": [
{
"type": "shell",
"inline": [
"sleep 30"
]
},
{...}]