Automating Software Installation with Packer Shell Provisioners
Learn how to use Packer shell provisioners with external scripts to automate software installation during image builds, avoid drift, and ensure privilege escalation.
ReadMeFeed / Community knowledge
Real questions. Useful conversations. Find the people who know your stack.
Learn how to use Packer shell provisioners with external scripts to automate software installation during image builds, avoid drift, and ensure privilege escalation.
Background Vagrant's retryable option for provisioners (since 2.2) re-executes a provisioner on failure, but the framework does not wrap the run in a transaction or provide an on_retry hook. This means any provisioner that writes files, modifies databases, or calls external APIs can perform the same mutations twice when a transient error triggers a retry. Co
When a Vagrant machine fails to provision due to a transient network glitch or a synced‑folder mount error, the provisioner may be retried automatically. If the provisioner is configured with run: 'always' , Vagrant will execute it on every retry, potentially causing duplicate writes such as appending timestamps or installing packages twice. Setting run: 'on
Vagrant documents that setting a timeout on a provisioner sends an interrupt signal when the limit is exceeded and marks the provision as failed. However, observed behavior differs: some provisioner types (e.g., shell) leave the virtual machine running after a timeout, while others (e.g., Ansible) appear to trigger a vagrant halt. The underlying decision poi