Skip to content
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

RedHat 8 and 9 not getting private IP #115

Open
krkardos opened this issue Oct 22, 2024 · 2 comments
Open

RedHat 8 and 9 not getting private IP #115

krkardos opened this issue Oct 22, 2024 · 2 comments

Comments

@krkardos
Copy link

We are trying to build Red Hat 8 and Red Hat 9 images on OpenTelekomCloud, but Packer can not get the newly created Virtual Machines IP addresses. Packer version is 1.11.2, huawei cloud plugin is 1.2.1

Here is the code:

variable "auth_url" {
  type = string
  default = "https://iam.eu-de.otc.t-systems.com/v3"
}

variable "access_key" {
  type = string
}

variable "secret_key" {
  type = string
}

variable "region" {
  type = string
  default = "eu-de"
}

variable "project_name" {
  type = string
  default = "eu-de"
}

variable "vpc_id" {
  type = string
}

variable "subnet_id" {
  type = string
}

variable "imagever" {
  type = string
}

source "huaweicloud-ecs" "otc" {
  // The name of newly created image
  image_name          = "OTC-test"
  image_description   = "test"
  // auth
  auth_url            = var.auth_url // Standard OpenStack v3 auth endpoint
  access_key          = var.access_key
  secret_key          = var.secret_key
  //user_data           = ""
  // OTC default settings
  region              = var.region
  project_name        = var.project_name
  flavor              = "s3.large.2"
  volume_type         = "SSD"
  volume_size         = 25
  subnets            = [var.subnet_id]
  vpc_id              = var.vpc_id
  //security_groups     = var.security_groups
  //image_tags          = var.image_tags
  source_image_filter {
    filters {
      name = "Enterprise_RedHat_8_amd64_bios_latest"
    }
    most_recent =  true
  }
    // connection settings
    //eip_type            = "5_bgp"
    //eip_bandwidth_size  = 5
  ssh_username        = "linux"
  ssh_ip_version      = "4"
  ssh_timeout         = "30m"
}

build {
  sources = ["source.huaweicloud-ecs.otc"]

  provisioner "ansible" {
    groups          = [ "otc" ]
    playbook_file  = "./test.yml"
    ansible_env_vars = [ "ANSIBLE_HOST_KEY_CHECKING=False" ]
    extra_arguments = [ "--extra-vars", "imagever=${var.imagever}" ]
    use_proxy = "false"
  }
}

Here is the output:

$ PACKER_LOG=1 packer build $DISTRIBUTION.pkr.hcl
2024/10/22 10:08:34 [INFO] Packer version: 1.11.2 [go1.21.12 linux amd64]
2024/10/22 10:08:34 [INFO] PACKER_CONFIG env var not set; checking the default config file path
2024/10/22 10:08:34 [INFO] PACKER_CONFIG env var set; attempting to open config file: /root/.packerconfig

==> huaweicloud-ecs.otc: Loading availability zones...
    huaweicloud-ecs.otc: Availability zones: eu-de-01 eu-de-02 eu-de-03
    huaweicloud-ecs.otc: Select eu-de-02 as the availability zone
==> huaweicloud-ecs.otc: Loading flavor: s3.large.2
==> huaweicloud-ecs.otc: Creating temporary keypair: packer_671779a2-27e2-541f-4266-fbeb6475142e...
2024/10/22 10:08:35 packer-plugin-huaweicloud_v1.2.1_x5.0_linux_amd64 plugin: 2024/10/22 10:08:35 [INFO] skip the verification for flavor s3.large.2 as the method is missing in SDK
==> huaweicloud-ecs.otc: Created temporary keypair: packer_671779a2-27e2-541f-4266-fbeb6475142e
2024/10/22 10:08:36 packer-plugin-huaweicloud_v1.2.1_x5.0_linux_amd64 plugin: 2024/10/22 10:08:36 Using Image Filters ListImagesRequest {"name":"Enterprise_RedHat_8_amd64_bios_prev","sort_dir":"desc","sort_key":"created_at","status":"active"}
    huaweicloud-ecs.otc: Found Image ID: 6b8ad132-0b8c-4d58-a478-31e76f3c6555
    huaweicloud-ecs.otc: the [default] security groups will be used ...
==> huaweicloud-ecs.otc: Launching server in AZ eu-de-02...
    huaweicloud-ecs.otc: Waiting for server to become ready...
2024/10/22 10:08:39 packer-plugin-huaweicloud_v1.2.1_x5.0_linux_amd64 plugin: 2024/10/22 10:08:39 [DEBUG] Waiting for state to become: [SUCCESS]
2024/10/22 10:08:49 packer-plugin-huaweicloud_v1.2.1_x5.0_linux_amd64 plugin: 2024/10/22 10:08:49 [TRACE] Waiting 10s before next try
2024/10/22 10:08:59 packer-plugin-huaweicloud_v1.2.1_x5.0_linux_amd64 plugin: 2024/10/22 10:08:59 [TRACE] Waiting 10s before next try
2024/10/22 10:09:09 packer-plugin-huaweicloud_v1.2.1_x5.0_linux_amd64 plugin: 2024/10/22 10:09:09 [TRACE] Waiting 10s before next try
2024/10/22 10:09:19 packer-plugin-huaweicloud_v1.2.1_x5.0_linux_amd64 plugin: 2024/10/22 10:09:19 [TRACE] Waiting 10s before next try
2024/10/22 10:09:29 packer-plugin-huaweicloud_v1.2.1_x5.0_linux_amd64 plugin: 2024/10/22 10:09:29 [TRACE] Waiting 10s before next try
2024/10/22 10:09:39 packer-plugin-huaweicloud_v1.2.1_x5.0_linux_amd64 plugin: 2024/10/22 10:09:39 [TRACE] Waiting 10s before next try
    huaweicloud-ecs.otc: Server ID: 24be6090-b6[88](https://gitlab.ms.otc.t-systems.com/images/RedHat-based/-/jobs/64267#L88)-47c5-8c35-e18bb0840aed
==> huaweicloud-ecs.otc: Using SSH communicator to connect:
2024/10/22 10:09:49 packer-plugin-huaweicloud_v1.2.1_x5.0_linux_amd64 plugin: 2024/10/22 10:09:49 [INFO] Not using winrm communicator, skipping get password...
2024/10/22 10:09:49 packer-plugin-huaweicloud_v1.2.1_x5.0_linux_amd64 plugin: 2024/10/22 10:09:49 [DEBUG] Using floating IP  to connect
2024/10/22 10:09:49 packer-plugin-huaweicloud_v1.2.1_x5.0_linux_amd64 plugin: 2024/10/22 10:09:49 [INFO] Waiting for SSH, up to timeout: 30m0s
2024/10/22 10:09:49 packer-plugin-huaweicloud_v1.2.1_x5.0_linux_amd64 plugin: 2024/10/22 10:09:49 [DEBUG] Using floating IP  to connect
2024/10/22 10:09:49 packer-plugin-huaweicloud_v1.2.1_x5.0_linux_amd64 plugin: 2024/10/22 10:09:49 [DEBUG] TCP connection to SSH ip/port failed: dial tcp :22: connect: connection refused
==> huaweicloud-ecs.otc: Waiting for SSH to become available...
2024/10/22 10:09:54 packer-plugin-huaweicloud_v1.2.1_x5.0_linux_amd64 plugin: 2024/10/22 10:09:54 [DEBUG] Using floating IP  to connect
2024/10/22 10:09:54 packer-plugin-huaweicloud_v1.2.1_x5.0_linux_amd64 plugin: 2024/10/22 10:09:54 [DEBUG] TCP connection to SSH ip/port failed: dial tcp :22: connect: connection refused

At part of "Using SSH communicator to connect: "
Private IP should be appear, but not appears and not receives. On other distribution, for example Centos, Ubuntu, it is working fine with the same code.

With older plugin version, all distribution can be build. ( packer 1.10.3 with huaweicloud plugin 1.1.0 )
Can you please check what can be the problem here ?

@chengxiangdong
Copy link
Collaborator

Currently, the packer-plugin-huaweicloud only supports Huawei Cloud and does not support other partner cloud at this time.

@krkardos
Copy link
Author

Currently, the packer-plugin-huaweicloud only supports Huawei Cloud and does not support other partner cloud at this time.

I think the problem is not that. We are using your plugin for OTC for a long time and it is working fine. Also we can simply create Oracle, Ubuntu, Centos images with this plugin version, but Red Hat 8 and Red Hat 9 images can not be created because packer does not get the ECSs IP address. I have to highlight, that it was working fine with the previous plugin version, my issue only exists with this version and with red hat 8-9 images.

Can you please check what was changed ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants