We have a shell provisioner for a Vyos installation that looks like:
provisioner "shell" {
inline = [
"source /opt/vyatta/etc/functions/script-template",
"configure",
# "load /tmp/config.boot",
# "commit"
"delete interface ethernet eth0 address dhcp",
"set interface ethernet eth0 address 10.0.0.1/30",
"commit",
"save",
"delete interface ethernet eth0 hw-id",
"commit",
"save",
"set interface ethernet eth1 address 192.168.1.1/24",
"commit",
"save",
"delete interface ethernet eth1 hw-id",
"commit",
"save",
]
inline_shebang = "/bin/vbash"
expect_disconnect = true
timeout = "0h0m30s"
}
eth0
is previously getting an IP from dhcp
, and we see it connects fine with the provisioner, uploads the script, and execution starts. If we remove the timeout
it will hang forever, and if we don’t change eth0
it will complete just fine.
==> vsphere-iso.vyos_vsphere_iso: Creating VM...
==> vsphere-iso.vyos_vsphere_iso: Customizing hardware...
==> vsphere-iso.vyos_vsphere_iso: Mounting ISO images...
==> vsphere-iso.vyos_vsphere_iso: Adding configuration parameters...
==> vsphere-iso.vyos_vsphere_iso: Set boot order...
==> vsphere-iso.vyos_vsphere_iso: Power on VM...
==> vsphere-iso.vyos_vsphere_iso: Waiting 5s for boot...
==> vsphere-iso.vyos_vsphere_iso: Typing boot command...
==> vsphere-iso.vyos_vsphere_iso: Waiting for IP...
==> vsphere-iso.vyos_vsphere_iso: IP address: 192.168.100.9
==> vsphere-iso.vyos_vsphere_iso: Using SSH communicator to connect: 192.168.100.9
==> vsphere-iso.vyos_vsphere_iso: Waiting for SSH to become available...
==> vsphere-iso.vyos_vsphere_iso: Connected to SSH!
==> vsphere-iso.vyos_vsphere_iso: Setting a 30s timeout for the next provisioner...
==> vsphere-iso.vyos_vsphere_iso: Provisioning with shell script: /tmp/packer-shell1754382940
Is there a way to tell the provisioner it can disconnect or otherwise get around this issue?
Fails with:
==> vsphere-iso.vyos_vsphere_iso: Cancelling provisioner after a timeout...
==> vsphere-iso.vyos_vsphere_iso: Provisioning step had errors: Running the cleanup provisioner, if present...
==> vsphere-iso.vyos_vsphere_iso: Power off VM...
==> vsphere-iso.vyos_vsphere_iso: Destroying VM...
Build 'vsphere-iso.vyos_vsphere_iso' errored after 4 minutes 25 seconds: context canceled