better/simpler `pause_before_connecting` example

This commit is contained in:
Adrien Delorme 2020-07-20 16:02:49 +02:00
parent 530f5e3f63
commit fd6be7f279
2 changed files with 16 additions and 66 deletions

View File

@ -43,41 +43,16 @@ type Config struct {
Type string `mapstructure:"communicator"`
// We recommend that you enable SSH or WinRM as the very last step in your
// guest's bootstrap script, but sometimes you may have a race condition where
// you need Packer to wait before attempting to connect to your guest.
// guest's bootstrap script, but sometimes you may have a race condition
// where you need Packer to wait before attempting to connect to your
// guest.
//
// If you end up in this situation, you can use the template option
// `pause_before_connecting`. By default, there is no pause. For example:
//
// <Tabs>
// <Tab heading="JSON">
//
// ```json
// "builders" [{
// ...
// "communicator": "ssh",
// "ssh_username": "myuser",
// "pause_before_connecting": "10m"
// }]
// ```
//
// </Tab>
// <Tab heading="HCL2">
//
// ```hcl
// source "amazon-ebs" "example" {
// communicator = "ssh"
// ssh_username = "myuser"
// pause_before_connecting = "10m"
// }
// ```
//
// </Tab>
// </Tabs>
//
// In this example, Packer will check whether it can connect, as normal. But once
// a connection attempt is successful, it will disconnect and then wait 10 minutes
// before connecting to the guest and beginning provisioning.
// `pause_before_connecting`. By default, there is no pause. For example if
// you set `pause_before_connecting` to `10m` Packer will check whether it
// can connect, as normal. But once a connection attempt is successful, it
// will disconnect and then wait 10 minutes before connecting to the guest
// and beginning provisioning.
PauseBeforeConnect time.Duration `mapstructure:"pause_before_connecting"`
SSH `mapstructure:",squash"`

View File

@ -16,38 +16,13 @@
files.
- `pause_before_connecting` (duration string | ex: "1h5m2s") - We recommend that you enable SSH or WinRM as the very last step in your
guest's bootstrap script, but sometimes you may have a race condition where
you need Packer to wait before attempting to connect to your guest.
guest's bootstrap script, but sometimes you may have a race condition
where you need Packer to wait before attempting to connect to your
guest.
If you end up in this situation, you can use the template option
`pause_before_connecting`. By default, there is no pause. For example:
<Tabs>
<Tab heading="JSON">
```json
"builders" [{
...
"communicator": "ssh",
"ssh_username": "myuser",
"pause_before_connecting": "10m"
}]
```
</Tab>
<Tab heading="HCL2">
```hcl
source "amazon-ebs" "example" {
communicator = "ssh"
ssh_username = "myuser"
pause_before_connecting = "10m"
}
```
</Tab>
</Tabs>
In this example, Packer will check whether it can connect, as normal. But once
a connection attempt is successful, it will disconnect and then wait 10 minutes
before connecting to the guest and beginning provisioning.
`pause_before_connecting`. By default, there is no pause. For example if
you set `pause_before_connecting` to `10m` Packer will check whether it
can connect, as normal. But once a connection attempt is successful, it
will disconnect and then wait 10 minutes before connecting to the guest
and beginning provisioning.