-
Notifications
You must be signed in to change notification settings - Fork 20
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
support packer build with ipv6 only #188
Comments
Allow disabling the server's public IPs, and use the first available IP to connect to it (IPv4, IPv6, first private network IP). Closes #188
🤖 I have created a release *beep* *boop* --- ## [1.5.0](v1.4.0...v1.5.0) (2024-06-05) ### Features * add HCP packer support ([#122](#122)) ([85435ef](85435ef)) * allow disabling the server public ips ([#190](#190)) ([82e6cdb](82e6cdb)), closes [#188](#188) ### Bug Fixes * ensure the upgrade server type is not nil ([#182](#182)) ([d297dcb](d297dcb)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please).
@jooola thanks for working on it. I'm getting timed out if I use the following:
Details
packer {
required_plugins {
hcloud = {
source = "github.com/hetznercloud/hcloud"
version = "~> 1.5.0"
}
}
}
variable "hcloud_token" {
type = string
default = "${env("HCLOUD_TOKEN")}"
sensitive = true
}
variable "hcloud_server_type" {
type = map(string)
default = {
# x86 = "cx11"
arm = "cax11"
}
}
variable "channel" {
type = string
default = "beta"
}
variable "version" {
type = string
default = "current"
}
variable "labels" {
// Available replacements:
// $architecture
// $channel
// $version - if "current" was specified, this is resolved to the actual version
type = map(string)
default = {
os = "flatcar"
flatcar-channel = "$channel"
version = "$version"
architecture = "$architecture"
}
}
locals {
architectures = ["x86", "arm"]
// If the user wants the "current" version, we still want to make the
// actual version id available through labels + snapshot description
//
// regex matches: FLATCAR_VERSION=1234.0.0
version = regex("FLATCAR_VERSION=(\\d+\\.\\d+\\.\\d+)", data.http.version_info.body)[0]
}
data "http" "version_info" {
// We assume that both boards have the same version
url = "https://${var.channel}.release.flatcar-linux.net/amd64-usr/${var.version}/version.txt"
}
source "hcloud" "flatcar" {
token = var.hcloud_token
image = "ubuntu-22.04"
location = "fsn1"
rescue = "linux64"
ssh_username = "root"
}
build {
dynamic "source" {
for_each = local.architectures
labels = ["hcloud.flatcar"]
content {
name = source.value
server_type = var.hcloud_server_type[source.value]
snapshot_name = "flatcar-${var.channel}-${local.version}-${source.value}"
public_ipv4_disabled = true
snapshot_labels = {
for k, v in var.labels : k => replace(replace(replace(v,
"$channel", var.channel),
"$version", local.version),
"$architecture", source.value)
}
}
}
provisioner "shell" {
inline = [
# Download script and dependencies
"apt-get -y install gawk",
"curl -fsSLO --retry-delay 1 --retry 60 --retry-connrefused --retry-max-time 60 --connect-timeout 20 https://raw.githubusercontent.com/flatcar/init/flatcar-master/bin/flatcar-install",
"chmod +x flatcar-install",
# Install flatcar
"./flatcar-install -s -o hetzner -C ${var.channel} -V ${var.version} ",
]
}
}
hcloud.arm: output will be in this color.
==> hcloud.arm: Validating server types: cax11
==> hcloud.arm: Validating snapshot name: flatcar-beta-3941.1.0-arm
==> hcloud.arm: Creating temporary RSA SSH key for instance...
==> hcloud.arm: Uploading temporary SSH key for instance...
==> hcloud.arm: Creating server...
hcloud.arm: Using image '103908130'
==> hcloud.arm: Enabling Rescue Mode...
==> hcloud.arm: Rebooting server...
==> hcloud.arm: Using SSH communicator to connect: 2a01:4f8:c013:4a59::
==> hcloud.arm: Waiting for SSH to become available...
==> hcloud.arm: Timeout waiting for SSH.
==> hcloud.arm: Destroying server...
==> hcloud.arm: Deleting temporary SSH key...
Build 'hcloud.arm' errored after 5 minutes 30 seconds: Timeout waiting for SSH.
==> Wait completed after 5 minutes 30 seconds
==> Some builds didn't complete successfully and had errors:
--> hcloud.arm: Timeout waiting for SSH.
==> Builds finished but no artifacts were created. |
Hmm, the ipv6 address is not right. I'll have look. |
Will be fixed with #192 |
Hey @jooola I'm still facing this issue. I am using packer latest version and packer-plugin-hcloud is also on latest which is 1.5.1 environment details$ packer version
Packer v1.11.0
$ packer plugins installed
/home/k7/.config/packer/plugins/github.com/hetznercloud/hcloud/packer-plugin-hcloud_v1.5.1_x5.0_linux_amd64 scenario 1$ packer validate foo.json
The configuration is valid.
$ packer build foo.json
hcloud: output will be in this color.
==> hcloud: Validating server types: cx41
==> hcloud: Validating snapshot name: packer-1717664956
==> hcloud: Creating temporary RSA SSH key for instance...
==> hcloud: Uploading temporary SSH key for instance...
==> hcloud: Creating server...
hcloud: Using image '67794396'
==> hcloud: Using SSH communicator to connect: 2a01:4f8:c013:3d45::1
==> hcloud: Waiting for SSH to become available...
==> hcloud: Timeout waiting for SSH.
==> hcloud: Destroying server...
==> hcloud: Deleting temporary SSH key...
Build 'hcloud' errored after 5 minutes 18 seconds: Timeout waiting for SSH.
==> Wait completed after 5 minutes 18 seconds
==> Some builds didn't complete successfully and had errors:
--> hcloud: Timeout waiting for SSH.
==> Builds finished but no artifacts were created. the foo.json file contains
$ hcloud server list
ID NAME STATUS IPV4 IPV6 PRIVATE NET DATACENTER AGE
48415982 packer-66617cbc-4945-bf22-9ad2-4319d0ac68e4 running - 2a01:4f8:c013:3d45::/64 - fsn1-dc14 2m scenario 2 (using Julian's flatcar repository )hcloud.arm: output will be in this color.
==> hcloud.arm: Validating server types: cax11
==> hcloud.arm: Validating snapshot name: flatcar-beta-3941.1.0-arm
==> hcloud.arm: Creating temporary RSA SSH key for instance...
==> hcloud.arm: Uploading temporary SSH key for instance...
==> hcloud.arm: Creating server...
hcloud.arm: Using image '103908130'
==> hcloud.arm: Enabling Rescue Mode...
==> hcloud.arm: Rebooting server...
==> hcloud.arm: Using SSH communicator to connect: 2a01:4f8:c013:4a59::1
==> hcloud.arm: Waiting for SSH to become available...
==> hcloud.arm: Timeout waiting for SSH.
==> hcloud.arm: Destroying server...
==> hcloud.arm: Deleting temporary SSH key...
Build 'hcloud.arm' errored after 5 minutes 27 seconds: Timeout waiting for SSH.
==> Wait completed after 5 minutes 27 seconds
==> Some builds didn't complete successfully and had errors:
--> hcloud.arm: Timeout waiting for SSH.
==> Builds finished but no artifacts were created. Here I've included
$ hcloud server list
ID NAME STATUS IPV4 IPV6 PRIVATE NET DATACENTER AGE
48416165 packer-66617d26-bb6b-5ddf-bbb6-185924f752c3 running - 2a01:4f8:c013:4a59::/64 - fsn1-dc14 1m Extra details
|
I'll have a look. |
I am having the following errors:
The ipv6 is not properly formatted, should be between brackets : I believe this is a packer bug. I'll dig some more on the packer side. |
We will have to wait for hashicorp/packer-plugin-sdk#246 to be merged and released. Might take some time. |
I was able to build with an ipv6 only server using the new plugin release v1.5.2. |
Thanks very much @jooola, I've tested it and it works good on my end too. |
Please search the existing issues for relevant feature requests, and use the
reaction feature
(https://blog.github.com/2016-03-10-add-reactions-to-pull-requests-issues-and-comments/)
to add upvotes to pre-existing requests.
Community Note
Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request.
Please do not leave "+1" or "me too" comments, they generate extra noise for issue followers and do not help prioritize the request.
If you are interested in working on this issue or have submitted a pull request, please leave a comment.
Description
As of now, when I run packer build, the server gets ipv4 and ipv6 address both. I would like to avoid ipv4 here.
Use Case(s)
I'm hitting limit on my project where I cannot have more ipv4 addresses.
Could not create server: Primary IP limit exceeded (resource_limit_exceeded)
Independent of this as well I think it will be great if the project supports that.
Potential configuration
Potential References
The text was updated successfully, but these errors were encountered: