Code Monkey home page Code Monkey logo

packer-plugin-openstack's Introduction

Packer Plugin Openstack

The Openstack multi-component plugin can be used with HashiCorp Packer to create custom images. For the full list of available features for this plugin see docs.

Installation

Using pre-built releases

Using the packer init command

Starting from version 1.7, Packer supports a new packer init command allowing automatic installation of Packer plugins. Read the Packer documentation for more information.

To install this plugin, copy and paste this code into your Packer configuration . Then, run packer init.

packer {
  required_plugins {
    openstack = {
      version = ">= 1.1.2"
      source  = "github.com/hashicorp/openstack"
    }
  }
}

Manual installation

You can find pre-built binary releases of the plugin here. Once you have downloaded the latest archive corresponding to your target OS, uncompress it to retrieve the plugin binary file corresponding to your platform. To install the plugin, please follow the Packer documentation on installing a plugin.

From Sources

If you prefer to build the plugin from sources, clone the GitHub repository locally and run the command go build from the root directory. Upon successful compilation, a packer-plugin-openstack plugin binary file can be found in the root directory. To install the compiled plugin, please follow the official Packer documentation on installing a plugin.

Configuration

For more information on how to configure the plugin, please read the documentation located in the docs/ directory.

Contributing

  • If you think you've found a bug in the code or you have a question regarding the usage of this software, please reach out to us by opening an issue in this GitHub repository.
  • Contributions to this project are welcome: if you want to add a feature or a fix a bug, please do so by opening a Pull Request in this GitHub repository. In case of feature contribution, we kindly ask you to open an issue to discuss it beforehand.

packer-plugin-openstack's People

Contributors

azr avatar cb-oath avatar cbednarski avatar dependabot[bot] avatar devcamcar avatar hazelesque avatar iandelahorne avatar jen20 avatar jescalan avatar justinsb avatar kmbulebu avatar lbajolet-hashicorp avatar markpeek avatar mitchellh avatar msabramo avatar mwhooker avatar nielspardon avatar nywilken avatar oseiberts11 avatar ozerovandrei avatar priteau avatar psinghal20 avatar rasa avatar rickard-von-essen avatar shield-9 avatar swampdragons avatar sylviamoss avatar takaishi avatar tcarrio avatar zhenggu avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

packer-plugin-openstack's Issues

Cancel Build after receiving interrupt

Overview of the Issue

So whenever I cancel build while its on process of waiting for volume, it seems doesn't delete the volume and now displaying error on openstack. There should be a code that allows deletion of volume upon cancel/termination of build process.

Reproduction Steps

  1. create simple openstack build
  2. press ctrl+c while build process says waiting for volume XXXXXXXXXX to become available...
  3. Volume stays on openstack

Plugin and Packer version

packer version: v1.8.1

Share OpenStack image created by packer with other regions

This issue was originally opened by @guillermo-menjivar as hashicorp/packer#10185. It was migrated here as a result of the Packer plugin split. The original body of the issue is below.


I am using the OpenStack builder to provision images under the OVH cloud provider. They are full OpenStack compliant and they recommend using the Openstack packer builder. However, I do not see an attribute that allows me to share the image with other regions. Can someone help me with this. Thanks

Error: Unknown source type openstack

When filing a bug, please include the following headings if possible. Any
example text in this template can be deleted.

Overview of the Issue

Code below was working with v1.8.5 but not with the latest version v1.9.2

source "openstack" "master" {
  flavor                  = var.flavor
  image_name              = var.master_image_name
  source_image            = var.source_image
  ssh_username            = "localadmin"
  temporary_key_pair_type = "ecdsa"
  ssh_private_key_file    = "ssh_keys/id_ecdsa"
  networks                = var.networks
  availability_zone       = var.availability_zone
  user_data               = templatefile("userdata/master.sh", {public_key=var.public_key})
}

source "openstack" "worker" {
  flavor                  = var.flavor
  image_name              = var.worker_image_name
  source_image            = var.source_image
  ssh_username            = "localadmin"
  temporary_key_pair_type = "ecdsa"
  ssh_private_key_file    = "ssh_keys/id_ecdsa"
  networks                = var.networks
  availability_zone       = var.availability_zone
  user_data               = templatefile("userdata/worker.sh", {public_key=var.public_key})
}

build {
  sources = ["source.openstack.master", "source.openstack.worker"]
  provisioner "shell" {
    inline = [
      "cloud-init status --wait",
    ]
  }
}

I am getting the below error:

$ packer validate -var-file=./inputs.pkrvars.hcl .
Error: Unknown source type openstack
  on master-worker.pkr.hcl line 25:
  (source code not available)
known builders: [file azure-dtl null vmware-vmx qemu azure-arm vsphere-iso
amazon-ebsvolume vmware-iso virtualbox-ovf vagrant virtualbox-vm
amazon-ebssurrogate googlecompute virtualbox-iso azure-chroot amazon-instance
vsphere-clone amazon-ebs amazon-chroot docker]
Error: Unknown source type openstack
  on master-worker.pkr.hcl line [25](https://gitlab.patras5g.eu/apolychronopoulos/bake-k8s-node-images-with-packer/-/jobs/23332#L25):
  (source code not available)
known builders: [amazon-ebssurrogate googlecompute amazon-ebsvolume vmware-iso
virtualbox-ovf vagrant virtualbox-vm amazon-chroot docker virtualbox-iso
azure-chroot amazon-instance vsphere-clone amazon-ebs vmware-vmx qemu file
azure-dtl null azure-arm vsphere-iso]

Reproduction Steps

packer validate -var-file=./inputs.pkrvars.hcl .

Plugin and Packer version

From packer version : v1.9.2

Simplified Packer Buildfile

Mentioned above

Operating system and Environment details

Tested on MacOS arm64 and on linux amd64

Log Fragments and crash.log files

MacBook-Pro:bake-k8s-node-images-with-packer apolychrono$ PACKER_LOG=1 packer validate -var-file=./inputs.pkrvars.hcl .
2023/08/06 12:26:09 [INFO] Packer version: 1.9.2 [go1.20.4 darwin amd64]
2023/08/06 12:26:09 [TRACE] discovering plugins in /usr/local/bin
2023/08/06 12:26:09 [TRACE] discovering plugins in .
2023/08/06 12:26:09 [TRACE] discovering plugins in /Users/apolychrono/.config/packer/plugins
2023/08/06 12:26:09 [INFO] PACKER_CONFIG env var not set; checking the default config file path
2023/08/06 12:26:09 [INFO] PACKER_CONFIG env var set; attempting to open config file: /Users/apolychrono/.packerconfig
2023/08/06 12:26:09 [WARN] Config file doesn't exist: /Users/apolychrono/.packerconfig
2023/08/06 12:26:09 [INFO] Setting cache directory: /Users/apolychrono/.cache/packer
2023/08/06 12:26:09 [TRACE] validateValue: not active for master_image_name, so skipping
2023/08/06 12:26:09 [TRACE] validateValue: not active for networks, so skipping
2023/08/06 12:26:09 [TRACE] validateValue: not active for availability_zone, so skipping
2023/08/06 12:26:09 [TRACE] validateValue: not active for public_key, so skipping
2023/08/06 12:26:09 [TRACE] validateValue: not active for flavor, so skipping
2023/08/06 12:26:09 [TRACE] validateValue: not active for source_image, so skipping
2023/08/06 12:26:09 [TRACE] validateValue: not active for worker_image_name, so skipping

on master-worker.pkr.hcl line 25:
(source code not available)

known builders: [googlecompute amazon-ebs docker null vsphere-iso
amazon-instance vsphere-clone amazon-ebssurrogate virtualbox-ovf file azure-arm
virtualbox-iso vagrant amazon-chroot virtualbox-vm vmware-vmx amazon-ebsvolume
qemu vmware-iso azure-dtl azure-chroot]

Error: Unknown source type openstack

on master-worker.pkr.hcl line 25:
(source code not available)

known builders: [googlecompute amazon-ebs docker null vsphere-iso
amazon-instance vsphere-clone amazon-ebssurrogate virtualbox-ovf file azure-arm
virtualbox-iso vagrant amazon-chroot virtualbox-vm vmware-vmx amazon-ebsvolume
qemu vmware-iso azure-dtl azure-chroot]

Error: Unknown source type openstack

2023/08/06 12:26:09 [INFO] (telemetry) Finalizing.
on master-worker.pkr.hcl line 25:
(source code not available)

known builders: [googlecompute amazon-ebs docker null vsphere-iso
amazon-instance vsphere-clone amazon-ebssurrogate virtualbox-ovf file azure-arm
virtualbox-iso vagrant amazon-chroot virtualbox-vm vmware-vmx amazon-ebsvolume
qemu vmware-iso azure-dtl azure-chroot]

Error: Unknown source type openstack

on master-worker.pkr.hcl line 25:
(source code not available)

known builders: [googlecompute amazon-ebs docker null vsphere-iso
amazon-instance vsphere-clone amazon-ebssurrogate virtualbox-ovf file azure-arm
virtualbox-iso vagrant amazon-chroot virtualbox-vm vmware-vmx amazon-ebsvolume
qemu vmware-iso azure-dtl azure-chroot]

2023/08/06 12:26:10 waiting for all plugin processes to complete...
MacBook-Pro:bake-k8s-node-images-with-packer apolychrono$

glance image upload works fine, but image upload via packer just fails

This issue was originally opened by @a1git as hashicorp/packer#10753. It was migrated here as a result of the Packer plugin split. The original body of the issue is below.


Please let me know how exactly packer upload files to openstack .. the command line it uses .. DEBUG does not show it.
Then I can compare the normal openstack create image command vs packer command to figure out the difference.

This was working in ussuri. This broke with Victoria release. Nothing in openstack is broken. It is working fine .. glance image upload and everything works. Only packer image upload fails.

Overview of the Issue

I am using openstack victoria + ceph ( tried both in naut and octopus version)

Reproduction Steps

packer build packer.json

Packer version

1.3.4 as well as 1.7.0

Simplified Packer Buildfile

{
"builders": [
{
"type": "openstack",
"username": "lab",
"password": "****",
"identity_endpoint": "https://cloud.domain.com:5000",
"domain_name": "default",
"region": "eu",
"tenant_id": "",
"image_name": "ubuntu-focal-new",
"ssh_username": "ubuntu",
"source_image": "2d377406-5009-4486-a00d-80a90c93e522",
"flavor": "32a4133c-8b7a-4f8e-8316-254f0134e40b",
"ssh_ip_version": "4",
"networks": [
"f5f9fa3f-c9d4-42ce-b513-d71c81ad90a1"
]
}
],
"provisioners": [
{
"script": "setup_vm.sh",
"type": "shell"
}
]

Operating system and Environment details

openstack + ceph + buildVM ( this machine ) all on latest ubuntu-focal lts

Log Fragments and crash.log files

2021/03/11 19:34:21 [INFO] Packer version: 1.3.4
2021/03/11 19:34:21 Packer Target OS/Arch: linux amd64
2021/03/11 19:34:21 Built with Go Version: go1.10.4
2021/03/11 19:34:21 Detected home directory from env var: /root
2021/03/11 19:34:21 Using internal plugin for virtualbox-ovf
2021/03/11 19:34:21 Using internal plugin for alicloud-ecs
2021/03/11 19:34:21 Using internal plugin for file
2021/03/11 19:34:21 Using internal plugin for null
2021/03/11 19:34:21 Using internal plugin for openstack
2021/03/11 19:34:21 Using internal plugin for virtualbox-iso
2021/03/11 19:34:21 Using internal plugin for qemu
2021/03/11 19:34:21 Using internal plugin for amazon-instance
2021/03/11 19:34:21 Using internal plugin for digitalocean
2021/03/11 19:34:21 Using internal plugin for docker
2021/03/11 19:34:21 Using internal plugin for hyperv-iso
2021/03/11 19:34:21 Using internal plugin for lxd
2021/03/11 19:34:21 Using internal plugin for parallels-pvm
2021/03/11 19:34:21 Using internal plugin for vmware-iso
2021/03/11 19:34:21 Using internal plugin for vmware-vmx
2021/03/11 19:34:21 Using internal plugin for amazon-ebs
2021/03/11 19:34:21 Using internal plugin for amazon-ebsvolume
2021/03/11 19:34:21 Using internal plugin for googlecompute
2021/03/11 19:34:21 Using internal plugin for hyperv-vmcx
2021/03/11 19:34:21 Using internal plugin for parallels-iso
2021/03/11 19:34:21 Using internal plugin for amazon-chroot
2021/03/11 19:34:21 Using internal plugin for amazon-ebssurrogate
2021/03/11 19:34:21 Using internal plugin for cloudstack
2021/03/11 19:34:21 Using internal plugin for lxc
2021/03/11 19:34:21 Using internal plugin for converge
2021/03/11 19:34:21 Using internal plugin for puppet-server
2021/03/11 19:34:21 Using internal plugin for shell
2021/03/11 19:34:21 Using internal plugin for windows-restart
2021/03/11 19:34:21 Using internal plugin for chef-solo
2021/03/11 19:34:21 Using internal plugin for salt-masterless
2021/03/11 19:34:21 Using internal plugin for shell-local
2021/03/11 19:34:21 Using internal plugin for ansible-local
2021/03/11 19:34:21 Using internal plugin for chef-client
2021/03/11 19:34:21 Using internal plugin for ansible
2021/03/11 19:34:21 Using internal plugin for breakpoint
2021/03/11 19:34:21 Using internal plugin for file
2021/03/11 19:34:21 Using internal plugin for powershell
2021/03/11 19:34:21 Using internal plugin for puppet-masterless
2021/03/11 19:34:21 Using internal plugin for windows-shell
2021/03/11 19:34:21 Using internal plugin for artifice
2021/03/11 19:34:21 Using internal plugin for compress
2021/03/11 19:34:21 Using internal plugin for docker-import
2021/03/11 19:34:21 Using internal plugin for docker-push
2021/03/11 19:34:21 Using internal plugin for googlecompute-export
2021/03/11 19:34:21 Using internal plugin for amazon-import
2021/03/11 19:34:21 Using internal plugin for docker-tag
2021/03/11 19:34:21 Using internal plugin for manifest
2021/03/11 19:34:21 Using internal plugin for vagrant
2021/03/11 19:34:21 Using internal plugin for docker-save
2021/03/11 19:34:21 Using internal plugin for checksum
2021/03/11 19:34:21 Using internal plugin for googlecompute-import
2021/03/11 19:34:21 Using internal plugin for vagrant-cloud
2021/03/11 19:34:21 Using internal plugin for vsphere
2021/03/11 19:34:21 Using internal plugin for vsphere-template
2021/03/11 19:34:21 Using internal plugin for alicloud-import
2021/03/11 19:34:21 Using internal plugin for shell-local
2021/03/11 19:34:21 Detected home directory from env var: /root
2021/03/11 19:34:21 Attempting to open config file: /root/.packerconfig
2021/03/11 19:34:21 [WARN] Config file doesn't exist: /root/.packerconfig
2021/03/11 19:34:21 Packer config: &{DisableCheckpoint:false DisableCheckpointSignature:false PluginMinPort:10000 PluginMaxPort:25000 Builders:map[amazon-ebsvolume:/usr/bin/packer-PACKERSPACE-plugin-PACKERSPACE-packer-builder-amazon-ebsvolume virtualbox-iso:/usr/bin/packer-PACKERSPACE-plugin-PACKERSPACE-packer-builder-virtualbox-iso digitalocean:/usr/bin/packer-PACKERSPACE-plugin-PACKERSPACE-packer-builder-digitalocean lxd:/usr/bin/packer-PACKERSPACE-plugin-PACKERSPACE-packer-builder-lxd amazon-ebs:/usr/bin/packer-PACKERSPACE-plugin-PACKERSPACE-packer-builder-amazon-ebs googlecompute:/usr/bin/packer-PACKERSPACE-plugin-PACKERSPACE-packer-builder-googlecompute hyperv-vmcx:/usr/bin/packer-PACKERSPACE-plugin-PACKERSPACE-packer-builder-hyperv-vmcx amazon-chroot:/usr/bin/packer-PACKERSPACE-plugin-PACKERSPACE-packer-builder-amazon-chroot amazon-ebssurrogate:/usr/bin/packer-PACKERSPACE-plugin-PACKERSPACE-packer-builder-amazon-ebssurrogate virtualbox-ovf:/usr/bin/packer-PACKERSPACE-plugin-PACKERSPACE-packer-builder-virtualbox-ovf amazon-instance:/usr/bin/packer-PACKERSPACE-plugin-PACKERSPACE-packer-builder-amazon-instance vmware-iso:/usr/bin/packer-PACKERSPACE-plugin-PACKERSPACE-packer-builder-vmware-iso hyperv-iso:/usr/bin/packer-PACKERSPACE-plugin-PACKERSPACE-packer-builder-hyperv-iso vmware-vmx:/usr/bin/packer-PACKERSPACE-plugin-PACKERSPACE-packer-builder-vmware-vmx alicloud-ecs:/usr/bin/packer-PACKERSPACE-plugin-PACKERSPACE-packer-builder-alicloud-ecs null:/usr/bin/packer-PACKERSPACE-plugin-PACKERSPACE-packer-builder-null openstack:/usr/bin/packer-PACKERSPACE-plugin-PACKERSPACE-packer-builder-openstack parallels-pvm:/usr/bin/packer-PACKERSPACE-plugin-PACKERSPACE-packer-builder-parallels-pvm parallels-iso:/usr/bin/packer-PACKERSPACE-plugin-PACKERSPACE-packer-builder-parallels-iso cloudstack:/usr/bin/packer-PACKERSPACE-plugin-PACKERSPACE-packer-builder-cloudstack lxc:/usr/bin/packer-PACKERSPACE-plugin-PACKERSPACE-packer-builder-lxc file:/usr/bin/packer-PACKERSPACE-plugin-PACKERSPACE-packer-builder-file qemu:/usr/bin/packer-PACKERSPACE-plugin-PACKERSPACE-packer-builder-qemu docker:/usr/bin/packer-PACKERSPACE-plugin-PACKERSPACE-packer-builder-docker] PostProcessors:map[artifice:/usr/bin/packer-PACKERSPACE-plugin-PACKERSPACE-packer-post-processor-artifice docker-tag:/usr/bin/packer-PACKERSPACE-plugin-PACKERSPACE-packer-post-processor-docker-tag vagrant:/usr/bin/packer-PACKERSPACE-plugin-PACKERSPACE-packer-post-processor-vagrant checksum:/usr/bin/packer-PACKERSPACE-plugin-PACKERSPACE-packer-post-processor-checksum googlecompute-export:/usr/bin/packer-PACKERSPACE-plugin-PACKERSPACE-packer-post-processor-googlecompute-export amazon-import:/usr/bin/packer-PACKERSPACE-plugin-PACKERSPACE-packer-post-processor-amazon-import vsphere-template:/usr/bin/packer-PACKERSPACE-plugin-PACKERSPACE-packer-post-processor-vsphere-template shell-local:/usr/bin/packer-PACKERSPACE-plugin-PACKERSPACE-packer-post-processor-shell-local docker-import:/usr/bin/packer-PACKERSPACE-plugin-PACKERSPACE-packer-post-processor-docker-import docker-push:/usr/bin/packer-PACKERSPACE-plugin-PACKERSPACE-packer-post-processor-docker-push docker-save:/usr/bin/packer-PACKERSPACE-plugin-PACKERSPACE-packer-post-processor-docker-save vagrant-cloud:/usr/bin/packer-PACKERSPACE-plugin-PACKERSPACE-packer-post-processor-vagrant-cloud vsphere:/usr/bin/packer-PACKERSPACE-plugin-PACKERSPACE-packer-post-processor-vsphere alicloud-import:/usr/bin/packer-PACKERSPACE-plugin-PACKERSPACE-packer-post-processor-alicloud-import compress:/usr/bin/packer-PACKERSPACE-plugin-PACKERSPACE-packer-post-processor-compress manifest:/usr/bin/packer-PACKERSPACE-plugin-PACKERSPACE-packer-post-processor-manifest googlecompute-import:/usr/bin/packer-PACKERSPACE-plugin-PACKERSPACE-packer-post-processor-googlecompute-import] Provisioners:map[windows-restart:/usr/bin/packer-PACKERSPACE-plugin-PACKERSPACE-packer-provisioner-windows-restart chef-solo:/usr/bin/packer-PACKERSPACE-plugin-PACKERSPACE-packer-provisioner-chef-solo salt-masterless:/usr/bin/packer-PACKERSPACE-plugin-PACKERSPACE-packer-provisioner-salt-masterless chef-client:/usr/bin/packer-PACKERSPACE-plugin-PACKERSPACE-packer-provisioner-chef-client powershell:/usr/bin/packer-PACKERSPACE-plugin-PACKERSPACE-packer-provisioner-powershell puppet-masterless:/usr/bin/packer-PACKERSPACE-plugin-PACKERSPACE-packer-provisioner-puppet-masterless converge:/usr/bin/packer-PACKERSPACE-plugin-PACKERSPACE-packer-provisioner-converge breakpoint:/usr/bin/packer-PACKERSPACE-plugin-PACKERSPACE-packer-provisioner-breakpoint file:/usr/bin/packer-PACKERSPACE-plugin-PACKERSPACE-packer-provisioner-file windows-shell:/usr/bin/packer-PACKERSPACE-plugin-PACKERSPACE-packer-provisioner-windows-shell ansible:/usr/bin/packer-PACKERSPACE-plugin-PACKERSPACE-packer-provisioner-ansible shell-local:/usr/bin/packer-PACKERSPACE-plugin-PACKERSPACE-packer-provisioner-shell-local ansible-local:/usr/bin/packer-PACKERSPACE-plugin-PACKERSPACE-packer-provisioner-ansible-local puppet-server:/usr/bin/packer-PACKERSPACE-plugin-PACKERSPACE-packer-provisioner-puppet-server shell:/usr/bin/packer-PACKERSPACE-plugin-PACKERSPACE-packer-provisioner-shell]}
2021/03/11 19:34:21 Setting cache directory: /home/ubuntu/packer_cache
2021/03/11 19:34:21 Detected home directory from env var: /root
2021/03/11 19:34:21 Loading builder: openstack
2021/03/11 19:34:21 Plugin could not be found. Checking same directory as executable.
2021/03/11 19:34:21 Current exe path: /usr/bin/packer
2021/03/11 19:34:21 Creating plugin client for path: /usr/bin/packer
2021/03/11 19:34:21 Starting plugin: /usr/bin/packer []string{"/usr/bin/packer", "plugin", "packer-builder-openstack"}
2021/03/11 19:34:21 Waiting for RPC address for: /usr/bin/packer
2021/03/11 19:34:21 packer: 2021/03/11 19:34:21 [INFO] Packer version: 1.3.4
2021/03/11 19:34:21 packer: 2021/03/11 19:34:21 Packer Target OS/Arch: linux amd64
2021/03/11 19:34:21 packer: 2021/03/11 19:34:21 Built with Go Version: go1.10.4
2021/03/11 19:34:21 packer: 2021/03/11 19:34:21 Detected home directory from env var: /root
2021/03/11 19:34:21 packer: 2021/03/11 19:34:21 Attempting to open config file: /root/.packerconfig
2021/03/11 19:34:21 packer: 2021/03/11 19:34:21 [WARN] Config file doesn't exist: /root/.packerconfig
2021/03/11 19:34:21 packer: 2021/03/11 19:34:21 Packer config: &{DisableCheckpoint:false DisableCheckpointSignature:false PluginMinPort:10000 PluginMaxPort:25000 Builders:map[] PostProcessors:map[] Provisioners:map[]}
2021/03/11 19:34:21 packer: 2021/03/11 19:34:21 Setting cache directory: /home/ubuntu/packer_cache
2021/03/11 19:34:21 packer: 2021/03/11 19:34:21 args: []string{"packer-builder-openstack"}
2021/03/11 19:34:21 packer: 2021/03/11 19:34:21 Plugin minimum port: 10000
2021/03/11 19:34:21 packer: 2021/03/11 19:34:21 Plugin maximum port: 25000
2021/03/11 19:34:21 packer: 2021/03/11 19:34:21 Plugin address: unix /tmp/packer-plugin220024909
2021/03/11 19:34:21 packer: 2021/03/11 19:34:21 Waiting for connection...
2021/03/11 19:34:21 packer: 2021/03/11 19:34:21 Detected home directory from env var: /root
2021/03/11 19:34:21 packer: 2021/03/11 19:34:21 Serving a plugin connection...
2021/03/11 19:34:21 Loading provisioner: shell
2021/03/11 19:34:21 Plugin could not be found. Checking same directory as executable.
2021/03/11 19:34:21 Current exe path: /usr/bin/packer
2021/03/11 19:34:21 Creating plugin client for path: /usr/bin/packer
2021/03/11 19:34:21 Starting plugin: /usr/bin/packer []string{"/usr/bin/packer", "plugin", "packer-provisioner-shell"}
2021/03/11 19:34:21 Waiting for RPC address for: /usr/bin/packer
2021/03/11 19:34:21 packer: 2021/03/11 19:34:21 [INFO] Packer version: 1.3.4
2021/03/11 19:34:21 packer: 2021/03/11 19:34:21 Packer Target OS/Arch: linux amd64
2021/03/11 19:34:21 packer: 2021/03/11 19:34:21 Built with Go Version: go1.10.4
2021/03/11 19:34:21 packer: 2021/03/11 19:34:21 Detected home directory from env var: /root
2021/03/11 19:34:21 packer: 2021/03/11 19:34:21 Attempting to open config file: /root/.packerconfig
2021/03/11 19:34:21 packer: 2021/03/11 19:34:21 [WARN] Config file doesn't exist: /root/.packerconfig
2021/03/11 19:34:21 packer: 2021/03/11 19:34:21 Packer config: &{DisableCheckpoint:false DisableCheckpointSignature:false PluginMinPort:10000 PluginMaxPort:25000 Builders:map[] PostProcessors:map[] Provisioners:map[]}
2021/03/11 19:34:21 packer: 2021/03/11 19:34:21 Setting cache directory: /home/ubuntu/packer_cache
2021/03/11 19:34:21 packer: 2021/03/11 19:34:21 args: []string{"packer-provisioner-shell"}
2021/03/11 19:34:21 packer: 2021/03/11 19:34:21 Plugin minimum port: 10000
2021/03/11 19:34:21 packer: 2021/03/11 19:34:21 Plugin maximum port: 25000
2021/03/11 19:34:21 packer: 2021/03/11 19:34:21 Plugin address: unix /tmp/packer-plugin546949077
2021/03/11 19:34:21 packer: 2021/03/11 19:34:21 Waiting for connection...
2021/03/11 19:34:21 packer: 2021/03/11 19:34:21 Detected home directory from env var: /root
2021/03/11 19:34:21 packer: 2021/03/11 19:34:21 Serving a plugin connection...
2021/03/11 19:34:21 Build debug mode: false
2021/03/11 19:34:21 Force build: false
2021/03/11 19:34:21 On error:
2021/03/11 19:34:21 Preparing build: openstack
openstack output will be in this color.

2021/03/11 19:34:22 Waiting on builds to complete...
2021/03/11 19:34:22 Starting build run: openstack
2021/03/11 19:34:22 Running builder: openstack
==> openstack: Loading flavor: 32a4133c-8b7a-4f8e-8316-254f0134e40b
2021/03/11 19:34:22 packer: 2021/03/11 19:34:22 [INFO] Loading flavor by ID: 32a4133c-8b7a-4f8e-8316-254f0134e40b
openstack: Verified flavor. ID: 32a4133c-8b7a-4f8e-8316-254f0134e40b
==> openstack: Creating temporary keypair: packer_604a70be-6349-88ba-44d9-d2cc78792094 ...
==> openstack: Created temporary keypair: packer_604a70be-6349-88ba-44d9-d2cc78792094
==> openstack: Launching server...
==> openstack: Launching server...
openstack: Server ID: a20f97b3-8bef-4d3a-be13-a2ea93fd9097
2021/03/11 19:34:23 packer: 2021/03/11 19:34:23 server id: a20f97b3-8bef-4d3a-be13-a2ea93fd9097
==> openstack: Waiting for server to become ready...
2021/03/11 19:34:23 packer: 2021/03/11 19:34:23 Waiting for state to become: [ACTIVE]
2021/03/11 19:34:24 packer: 2021/03/11 19:34:24 Waiting for state to become: [ACTIVE] currently BUILD (0%)
2021/03/11 19:34:26 packer: 2021/03/11 19:34:26 Waiting for state to become: [ACTIVE] currently BUILD (0%)
2021/03/11 19:34:28 packer: 2021/03/11 19:34:28 Waiting for state to become: [ACTIVE] currently BUILD (0%)
2021/03/11 19:34:30 packer: 2021/03/11 19:34:30 [INFO] Not using winrm communicator, skipping get password...
openstack: Floating IP not required
2021/03/11 19:34:30 packer: 2021/03/11 19:34:30 [DEBUG] Detected address: 192.168.0.103
2021/03/11 19:34:30 packer: 2021/03/11 19:34:30 [DEBUG] Using IP address 192.168.0.103 to connect
==> openstack: Using ssh communicator to connect: 192.168.0.103
2021/03/11 19:34:30 packer: 2021/03/11 19:34:30 [INFO] Waiting for SSH, up to timeout: 5m0s
==> openstack: Waiting for SSH to become available...
2021/03/11 19:34:30 packer: 2021/03/11 19:34:30 [DEBUG] Detected address: 192.168.0.103
2021/03/11 19:34:30 packer: 2021/03/11 19:34:30 [DEBUG] Using IP address 192.168.0.103 to connect
2021/03/11 19:34:33 packer: 2021/03/11 19:34:33 [DEBUG] TCP connection to SSH ip/port failed: dial tcp 192.168.0.103:22: connect: no route to host
2021/03/11 19:34:38 packer: 2021/03/11 19:34:38 [DEBUG] Detected address: 192.168.0.103
2021/03/11 19:34:38 packer: 2021/03/11 19:34:38 [DEBUG] Using IP address 192.168.0.103 to connect
2021/03/11 19:34:38 packer: 2021/03/11 19:34:38 [DEBUG] TCP connection to SSH ip/port failed: dial tcp 192.168.0.103:22: connect: connection refused
2021/03/11 19:34:43 packer: 2021/03/11 19:34:43 [DEBUG] Detected address: 192.168.0.103
2021/03/11 19:34:43 packer: 2021/03/11 19:34:43 [DEBUG] Using IP address 192.168.0.103 to connect
2021/03/11 19:34:43 packer: 2021/03/11 19:34:43 [DEBUG] TCP connection to SSH ip/port failed: dial tcp 192.168.0.103:22: connect: connection refused
2021/03/11 19:34:48 packer: 2021/03/11 19:34:48 [DEBUG] Detected address: 192.168.0.103
2021/03/11 19:34:48 packer: 2021/03/11 19:34:48 [DEBUG] Using IP address 192.168.0.103 to connect
2021/03/11 19:34:48 packer: 2021/03/11 19:34:48 [INFO] Attempting SSH connection...
2021/03/11 19:34:48 packer: 2021/03/11 19:34:48 [DEBUG] reconnecting to TCP connection for SSH
2021/03/11 19:34:48 packer: 2021/03/11 19:34:48 [DEBUG] handshaking with SSH
2021/03/11 19:34:48 packer: 2021/03/11 19:34:48 [DEBUG] handshake complete!
2021/03/11 19:34:48 packer: 2021/03/11 19:34:48 [INFO] no local agent socket, will not connect agent
==> openstack: Connected to SSH!
2021/03/11 19:34:48 packer: 2021/03/11 19:34:48 Running the provision hook
==> openstack: Provisioning with shell script: setup_vm.sh
2021/03/11 19:34:48 packer: 2021/03/11 19:34:48 Opening setup_vm.sh for reading
2021/03/11 19:34:48 packer: 2021/03/11 19:34:48 [INFO] 80 bytes written for 'uploadData'
2021/03/11 19:34:48 [INFO] 80 bytes written for 'uploadData'
2021/03/11 19:34:48 packer: 2021/03/11 19:34:48 [DEBUG] Opening new ssh session
2021/03/11 19:34:49 packer: 2021/03/11 19:34:49 [DEBUG] Starting remote scp process: scp -vt /tmp
2021/03/11 19:34:49 packer: 2021/03/11 19:34:49 [DEBUG] Started SCP session, beginning transfers...
2021/03/11 19:34:49 packer: 2021/03/11 19:34:49 [DEBUG] Copying input data into temporary file so we can read the length
2021/03/11 19:34:49 packer: 2021/03/11 19:34:49 [DEBUG] scp: Uploading script_3020.sh: perms=C0644 size=80
2021/03/11 19:34:49 packer: 2021/03/11 19:34:49 [DEBUG] SCP session complete, closing stdin pipe.
2021/03/11 19:34:49 packer: 2021/03/11 19:34:49 [DEBUG] Waiting for SSH session to complete.
2021/03/11 19:34:49 packer: 2021/03/11 19:34:49 [DEBUG] scp stderr (length 30): Sink: C0644 80 script_3020.sh
2021/03/11 19:34:49 packer: 2021/03/11 19:34:49 [DEBUG] Opening new ssh session
2021/03/11 19:34:49 packer: 2021/03/11 19:34:49 [DEBUG] starting remote command: chmod 0755 /tmp/script_3020.sh
2021/03/11 19:34:49 packer: 2021/03/11 19:34:49 [INFO] RPC endpoint: Communicator ended with: 0
2021/03/11 19:34:49 [INFO] RPC client: Communicator ended with: 0
2021/03/11 19:34:49 [INFO] RPC endpoint: Communicator ended with: 0
2021/03/11 19:34:49 packer: 2021/03/11 19:34:49 [INFO] RPC client: Communicator ended with: 0
2021/03/11 19:34:49 packer: 2021/03/11 19:34:49 [DEBUG] Opening new ssh session
2021/03/11 19:34:49 packer: 2021/03/11 19:34:49 [DEBUG] starting remote command: chmod +x /tmp/script_3020.sh; PACKER_BUILDER_TYPE='openstack' PACKER_BUILD_NAME='openstack' /tmp/script_3020.sh
2021/03/11 19:34:49 packer: 2021/03/11 19:34:49 [INFO] RPC endpoint: Communicator ended with: 0
2021/03/11 19:34:49 [INFO] 0 bytes written for 'stdout'
2021/03/11 19:34:49 [INFO] 0 bytes written for 'stderr'
2021/03/11 19:34:49 [INFO] RPC client: Communicator ended with: 0
2021/03/11 19:34:49 [INFO] RPC endpoint: Communicator ended with: 0
2021/03/11 19:34:49 packer: 2021/03/11 19:34:49 [INFO] 0 bytes written for 'stdout'
2021/03/11 19:34:49 packer: 2021/03/11 19:34:49 [INFO] 0 bytes written for 'stderr'
2021/03/11 19:34:49 packer: 2021/03/11 19:34:49 [INFO] RPC client: Communicator ended with: 0
2021/03/11 19:34:49 packer: 2021/03/11 19:34:49 [DEBUG] Opening new ssh session
2021/03/11 19:34:49 packer: 2021/03/11 19:34:49 [DEBUG] starting remote command: rm -f /tmp/script_3020.sh
2021/03/11 19:34:49 packer: 2021/03/11 19:34:49 [INFO] RPC endpoint: Communicator ended with: 0
2021/03/11 19:34:49 [INFO] RPC client: Communicator ended with: 0
2021/03/11 19:34:49 [INFO] RPC endpoint: Communicator ended with: 0
2021/03/11 19:34:49 packer: 2021/03/11 19:34:49 [INFO] RPC client: Communicator ended with: 0
2021/03/11 19:34:49 packer: 2021/03/11 19:34:49 [DEBUG] Opening new ssh session
2021/03/11 19:34:49 packer: 2021/03/11 19:34:49 [DEBUG] starting remote command: rm -f
2021/03/11 19:34:49 packer: 2021/03/11 19:34:49 [INFO] RPC endpoint: Communicator ended with: 0
2021/03/11 19:34:49 [INFO] RPC client: Communicator ended with: 0
2021/03/11 19:34:49 [INFO] RPC endpoint: Communicator ended with: 0
2021/03/11 19:34:49 packer: 2021/03/11 19:34:49 [INFO] RPC client: Communicator ended with: 0
==> openstack: Stopping server: a20f97b3-8bef-4d3a-be13-a2ea93fd9097 ...
openstack: Waiting for server to stop: a20f97b3-8bef-4d3a-be13-a2ea93fd9097 ...
2021/03/11 19:34:49 packer: 2021/03/11 19:34:49 Waiting for state to become: [SHUTOFF STOPPED]
2021/03/11 19:34:49 packer: 2021/03/11 19:34:49 Waiting for state to become: [SHUTOFF STOPPED] currently ACTIVE (0%)
==> openstack: Creating the image: ubuntu-focal-new
openstack: Image: 40c2c8f0-8d1e-4626-aa8f-e78c05cd5865
==> openstack: Waiting for image ubuntu-focal-new (image id: 40c2c8f0-8d1e-4626-aa8f-e78c05cd5865) to become ready...
2021/03/11 19:34:52 packer: 2021/03/11 19:34:52 Waiting for image creation status: SAVING (25%)
2021/03/11 19:34:55 packer: 2021/03/11 19:34:55 Waiting for image creation status: SAVING (25%)
2021/03/11 19:34:57 packer: 2021/03/11 19:34:57 Waiting for image creation status: SAVING (25%)
2021/03/11 19:34:59 packer: 2021/03/11 19:34:59 Waiting for image creation status: SAVING (50%)
2021/03/11 19:35:01 ui error: ==> openstack: Error waiting for image: Resource not found
==> openstack: Error waiting for image: Resource not found
==> openstack: Terminating the source server: a20f97b3-8bef-4d3a-be13-a2ea93fd9097 ...
2021/03/11 19:35:01 packer: 2021/03/11 19:35:01 Waiting for state to become: [DELETED]
2021/03/11 19:35:02 packer: 2021/03/11 19:35:02 Waiting for state to become: [DELETED] currently SHUTOFF (0%)
2021/03/11 19:35:04 packer: 2021/03/11 19:35:04 [INFO] 404 on ServerStateRefresh, returning DELETED
==> openstack: Deleting temporary keypair: packer_604a70be-6349-88ba-44d9-d2cc78792094 ...
2021/03/11 19:35:04 ui error: Build 'openstack' errored: Error waiting for image: Resource not found
Build 'openstack' errored: Error waiting for image: Resource not found
2021/03/11 19:35:04 Builds completed. Waiting on interrupt barrier...

2021/03/11 19:35:04 machine readable: error-count []string{"1"}
2021/03/11 19:35:04 ui error:
==> Some builds didn't complete successfully and had errors:
2021/03/11 19:35:04 machine readable: openstack,error []string{"Error waiting for image: Resource not found"}
2021/03/11 19:35:04 ui error: --> openstack: Error waiting for image: Resource not found
==> Builds finished but no artifacts were created.
==> Some builds didn't complete successfully and had errors:
--> openstack: Error waiting for image: Resource not found

==> Builds finished but no artifacts were created.
2021/03/11 19:35:04 waiting for all plugin processes to complete...
2021/03/11 19:35:04 /usr/bin/packer: plugin process exited
2021/03/11 19:35:04 /usr/bin/packer: plugin process exited

openstack builder hangs when using use_blockstorage_volume if volume size is too small

This issue was originally opened by @puetzk as hashicorp/packer#6957. It was migrated here as a result of the Packer plugin split. The original body of the issue is below.


From hashicorp/packer#6956 (comment)

If the value determined by GetVolumeSize is actually too low, perhaps an image with no value set for MinDiskGigabytes, in a format (e.g. qcow2) where the file is considerably smaller than the minimum volume that can unpack it, the volume is created but the status shown in cinder list becomes "error". WaitForVolume doesn't seem to recognize this case, and just keeps looping (and waiting) indefinitely), since volumes.Get is succeeding (the GUID does exist and has a status to read), and "error" != "available".

Openstack builder doesn't support Openstack API Microversion

This issue was originally opened by @ArKam as hashicorp/packer#10906. It was migrated here as a result of the Packer plugin split. The original body of the issue is below.


Overview of the Issue

When trying to launch a new image build using block storage volume feature, the build fail.

It come from the fact that the instance created will be attached on a volume type (the default one) that use multi-attach feature, packer fail to launch the VM as there is no way to specify the nova API microversion (min 2.60).

Even using environment variables such as OS_COMPUTE_API_VERSION=2.79 or a local clouds.yaml file doesn't work.

The targeted Openstack platform DO SUPPORT nova api microversion 2.79.
The targeted Openstack platform DO WORK as intended as we have a bunch of ansible playbooks that use it and that need to get this microversion specified within either an environment variable or within the system-wide or local clouds.yaml file.

Reproduction Steps

Create a packer template using Openstack builder and the use_blockstorage_volume directive.
Have your default __DEFAULT__ openstack volume type to use multi-attach feature.
launch the build.
The build fail with the following message:

==> openstack: Error launching source server: Bad request with: [POST https://sub.domain.tld:8774/v2.1/servers], error message: {"badRequest": {"message": "Multiattach volumes are only supported starting with compute API version 2.60.", "code": 400}}

Packer version

Packer v1.5.6

Simplified Packer Buildfile

https://gist.github.com/ArKam/275ecfb0cfbb43cbdf447bcd9a6696f0

Operating system and Environment details

OS: CentOS Linux release 7.9.2009 (Core).

Log Fragments and crash.log files

https://gist.github.com/ArKam/71d075c6faa08415cf39c85970d2e5ad

Post Processor Glance / Openstack

This issue was originally opened by @imduffy15 as hashicorp/packer#2678. It was migrated here as a result of the Packer plugin split. The original body of the issue is below.


Hey All,

I've gone through some of the past pull requests and issues, I've found two around the topic of uploading images to openstack/glance directly from packer:

Neither of these have been merged though. I have started writing my own one outside of packer and would love to get feedback, improve it, and eventually merge it in with master.

I have extended gophercloud to support the creation of images and the uploads of their binaries:

Using this extended gophercloud I've built out a packer plugin to upload a qcow2 or raw file outputted by qemu up

I'm currently working on tests... Got any recommendations/examples on how to mock up the openstack service client? I took a brief look at other tests and they just seemed to avoid talking to external sources.

Thanks,
Ian.

Source image not found when searching by image name

This issue was originally opened by @v0lumehi as hashicorp/packer#8630. It was migrated here as a result of the Packer plugin split. The original body of the issue is below.


Hello guys,

I think I discovered a bug in the openstack builder.
I have following packer version:

$ packer --version
1.5.1

This is my packer config and it is working fine:

{
  "variables": {
    "git_username": "",
    "git_password": ""
  },
  "builders": [{
    "type": "openstack",
    "flavor": "m.large",
    "image_name": "jenkins-chef-slave-nightly",
    "source_image": "ubuntu-18.04-x86_64-latest",
    "ssh_username": "ubuntu",
    "identity_endpoint": "https://my.great.cloud:5000/v3",
    "networks": ["6e80f6c6-3a24-44be-b15c-54b1f9d86c6e"],
    "floating_ip_network": "6541b7d0-db72-4a17-9d7e-de5d5b894ead",
    "security_groups": ["97e99840-e6f0-4fff-8f67-2afd3b8a3c43"],
    "use_blockstorage_volume": true,
    "volume_size": 10,
    "volume_name": "jenkins-chef-slave-nightly-volume",
    "image_disk_format": "qcow2",
    "metadata": {
      "image_name": "jenkins-chef-slave-nightly"
    }
  }],
  "provisioners": [{
      "type": "shell",
      "environment_vars": [
        "GIT_USERNAME={{user `git_username`}}",
        "GIT_PASSWORD={{user `git_password`}}"
      ],
      "scripts": [
        "./common/scripts/ubuntu/base.sh",
        "./common/scripts/ubuntu/docker.sh",
        "./common/scripts/ubuntu/chefdk.sh",
        "./common/scripts/ubuntu/users.sh",
        "./common/scripts/ubuntu/cleanup.sh"
      ]
    }
  ]
}

Now if I remove this block:

"use_blockstorage_volume": true,
"volume_size": 10,
"volume_name": "jenkins-chef-slave-nightly-volume",
"image_disk_format": "qcow2",

and run packer, packer throws this error:

$ packer build build.json
openstack output will be in this color.

==> openstack: Loading flavor: m.large
    openstack: Verified flavor. ID: 92506745-0305-4997-a58a-0f1a6be40a08
==> openstack: Creating temporary keypair: packer_5e26cac3-61bd-d7be-f4b1-463cc436cbc4 ...
==> openstack: Created temporary keypair: packer_5e26cac3-61bd-d7be-f4b1-463cc436cbc4
==> openstack: Launching server...
==> openstack: Launching server...
==> openstack: Error launching source server: Bad request with: [POST https://my.great.cloud:8774/v2.1/2b1777b0d2ec4263a6f0a63a0f313670/servers], error message: {"badRequest": {"message": "Invalid input for field/attribute imageRef. Value: ubuntu-18.04-x86_64-latest. u'ubuntu-18.04-x86_64-latest' is not valid under any of the given schemas", "code": 400}}
==> openstack: Terminating the source server:  ...
==> openstack: Error terminating server, may still be around: Resource not found
==> openstack: Deleting temporary keypair: packer_5e26cac3-61bd-d7be-f4b1-463cc436cbc4 ...
Build 'openstack' errored: Error launching source server: Bad request with: [POST https://my.great.cloud:8774/v2.1/2b1777b0d2ec4263a6f0a63a0f313670/servers], error message: {"badRequest": {"message": "Invalid input for field/attribute imageRef. Value: ubuntu-18.04-x86_64-latest. u'ubuntu-18.04-x86_64-latest' is not valid under any of the given schemas", "code": 400}}

==> Some builds didn't complete successfully and had errors:
--> openstack: Error launching source server: Bad request with: [POST https://my.great.cloud:8774/v2.1/2b1777b0d2ec4263a6f0a63a0f313670/servers], error message: {"badRequest": {"message": "Invalid input for field/attribute imageRef. Value: ubuntu-18.04-x86_64-latest. u'ubuntu-18.04-x86_64-latest' is not valid under any of the given schemas", "code": 400}}

==> Builds finished but no artifacts were created.

If I replace the source_image name with its ID, it's working properly:

$ packer build build.json
openstack output will be in this color.

==> openstack: Loading flavor: m.large
    openstack: Verified flavor. ID: 92506745-0305-4997-a58a-0f1a6be40a08
==> openstack: Creating temporary keypair: packer_5e26cb83-cafb-8502-3cd6-727f291199f5 ...
==> openstack: Created temporary keypair: packer_5e26cb83-cafb-8502-3cd6-727f291199f5
==> openstack: Launching server...
==> openstack: Launching server...
    openstack: Server ID: 0c516d5d-d23e-4ee4-8355-b78d28bdc6b3
==> openstack: Waiting for server to become ready...
==> openstack: Creating floating IP using network 6541b7d0-db72-4a17-9d7e-de5d5b894ead ...
    openstack: Created floating IP: 'f58318df-3644-420a-af6b-fdfa3c803549' (10.0.30.38)
==> openstack: Associating floating IP 'f58318df-3644-420a-af6b-fdfa3c803549' (10.0.30.38) with instance port...
    openstack: Added floating IP 'f58318df-3644-420a-af6b-fdfa3c803549' (10.0.30.38) to instance!
==> openstack: Using ssh communicator to connect: 10.0.30.38
==> openstack: Waiting for SSH to become available...
==> openstack: Connected to SSH!
==> openstack: Provisioning with shell script: ./common/scripts/ubuntu/base.sh
...
==> openstack: Deleting temporary keypair: packer_5e26cb83-cafb-8502-3cd6-727f291199f5 ...
Build 'openstack' finished.

==> Builds finished. The artifacts of successful builds are:
--> openstack: An image was created: 0983f994-6de4-4894-8fd1-4f700c2dc644

Do you got any idea what causes this? Am I overseeing something?
Best Regards

OpenStack Builder: source_image_filter with wildcards for "name" field

This issue was originally opened by @stefankaufmann as hashicorp/packer#10675. It was migrated here as a result of the Packer plugin split. The original body of the issue is below.


Description

When using the OpenStack Builder, there is no possibility to filter for source images which contain a certain string in its name.
The feature should work like https://www.packer.io/docs/builders/amazon/ebs#source_ami_filter

Use Case(s)

Our openstack is set up to automatically sync base images for different ubuntu versions. Since timestamps are contained in the name of the image, we always need to change the base image accordingly. This could be prevented if this feature was present.

The configuration could look like

"source_image_filter": {
    "name" : "auto-sync/ubuntu-focal-*"
}

temporary_key_pair_type is ignored, RSA is always used

Overview of the Issue

Hi,
I noticed that building an image with OpenStack and a non-default (i.e. non-RSA) temporary SSH key type is not possible.

Reproduction Steps

To reproduce, one can simply attempt to build an image with a buildfile containing "temporary_key_pair_type": "ed25519" (the value seems to be entirely ignored, it could be "ecdsa" or even "foobar").

Plugin and Packer version

Packer v1.7.8 (installed via apt from the official repo).

Simplified Packer Buildfile

{
  "builders": [
    {
      "flavor": "xx",
      "image_name": "fedora35_test",
      "name": "builder",
      "networks": "xxx-xxx",
      "source_image_name": "Fedora 35",
      "ssh_clear_authorized_keys": "true",
      "ssh_ip_version": "4",
      "ssh_username": "fedora",
      "temporary_key_pair_type": "ed25519",
      "type": "openstack"
    }
  ]
}

Operating system and Environment details

Debian 11.

Log Fragments and crash.log files

From the Packer log:

==> builder: Created temporary keypair: packer_61c5efec-a241-87f9-0f96-ae9c43f3e468                                                                                                     
    builder: Saving key for debug purposes: os_builder.pem                                                                                                                              

If I dump the key, it clearly is an RSA key:

$ head -n1 os_builder.pem 
-----BEGIN RSA PRIVATE KEY-----

More logs from Packer:

2021/12/24 16:09:09 packer-builder-openstack plugin: [DEBUG] Detected address: w.x.y.z                                                                                            
2021/12/24 16:09:09 packer-builder-openstack plugin: [DEBUG] Using IP address w.x.y.z to connect                                                                                  
2021/12/24 16:09:09 packer-builder-openstack plugin: [INFO] Attempting SSH connection to w.x.y.z:22...                                             
2021/12/24 16:09:09 packer-builder-openstack plugin: [DEBUG] reconnecting to TCP connection for SSH                                                                                     
2021/12/24 16:09:09 packer-builder-openstack plugin: [DEBUG] handshaking with SSH                                                                                                       
2021/12/24 16:09:09 packer-builder-openstack plugin: [DEBUG] SSH handshake err: ssh: handshake failed: ssh: unable to authenticate, attempted methods [none publickey], no supported met
hods remain                                                                                                                                                                             
2021/12/24 16:09:09 packer-builder-openstack plugin: [DEBUG] Detected authentication error. Increasing handshake attempts.                                                              

Because OpenSSH can use the right key exchange algorithm, I'm able to SSH onto the server and check its logs with ssh -l fedora -i os_builder.pem w.x.y.z journalctl -u sshd.
This shows Dec 24 16:09:23 fedora35-test sshd[897]: userauth_pubkey: key type ssh-rsa not in PubkeyAcceptedAlgorithms [preauth].

I have noticed a similar issue for the Amazon builder: hashicorp/packer-plugin-amazon#144

It would be great to see this fixed because it is really problematic when dealing with modern images such as Fedora 35.

Misleading error message on validate when identity_endpoint is not set.

When filing a bug, please include the following headings if possible. Any
example text in this template can be deleted.

Overview of the Issue

The parameter that is to be set is named identity_endpoint, but the error message is Missing input for argument [auth_url].

Reproduction Steps

packer validate .

Plugin and Packer version

packer v1.8.2

Simplified Packer Buildfile

source "openstack" "otc_packer_image" {
  }
  
build {
    sources = ["source.openstack.otc_packer_image"]
}

Operating system and Environment details

ubuntu 22.04

Log Fragments and crash.log files

Screen output:

Error: 5 error(s) occurred:

* Missing input for argument [auth_url]
* An image_name must be specified
* An ssh_username must be specified
  Note: some builders used to default ssh_username to "root".
* Either a source_image, a source_image_name, an external_source_image_url or source_image_filter must be specified
* A flavor must be specified

  on test.pkr.hcl line 8:
  (source code not available)

Add Properties to image

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

Please allow the ability to add properties to the image

Use Case(s)

openstack image set --property key=value needs to be run after the image is created using an external process.

Setting properties in OpenStack for the image should be part of packer proper

Potential configuration

"properties": {
	                 "os_distro": "ubuntu"
                         "os_version": "22.04"
	             }

Potential References

use_blockstorage_volume option causes error 'There is no such action: os-set_image_metadata","code":400'

This issue was originally opened by @vertrost as hashicorp/packer#8429. It was migrated here as a result of the Packer plugin split. The original body of the issue is below.


Overview of the Issue

I am building suse15 image with packer and ansible scripts, however when I am adding parameter "use_blockstorage_volume": "true" - image building fails with error:

Build 'openstack' errored: Error setting image metadata: Bad request with: [POST https://<openstack_url>/v3/0c2ea4d147794927b81dd1a3807788de/volumes/b8057af7-e582-4f38-993c-20085e958d22/action], error message: {"badRequest":{"message":"There is no such action: os-set_image_metadata","code":400}}

Reproduction Steps

Build image with provided json.

Packer version

1.4.5

Simplified Packer Buildfile

{
  "provisioners": [{
    "type": "shell-local",
    "inline": ["echo 'rubber ducky'> ducky.txt"]
  }],
  "builders": [{
    "type": "openstack",
    "identity_endpoint": "...",
    "tenant_name": "{{user `dev_tenant_name`}}",
    "domain_name": "{{user `dev_domain_name`}}", 
    "username": "{{user `dev_username`}}",
    "password": "{{user `dev_password`}}",
    "ssh_username": "linux",
    "region": "...",
    "image_name": "suse15",
    "instance_name": "suse15-packer",
    "source_image_name": "Beta_SLES15_SP0_latest",
    "availability_zone": "...",
    "flavor": "s2.medium.1",
    "networks": ["..."],
    "security_groups" : ["sg-packer"],
    "use_blockstorage_volume": "true"
  }],
  "post-processors": [{
    "strip_path": true,
    "output": "packer-template-centos-updating-result.log",
    "type": "manifest"
  }]
}

Log Fragments and crash.log files

packer-log.txt

OpenStack Image creation failing

This issue was originally opened by @parjun8840 as hashicorp/packer#9977. It was migrated here as a result of the Packer plugin split. The original body of the issue is below.


When filing a bug, please include the following headings if possible. Any
example text in this template can be deleted.

Overview of the Issue

While creating Image it fails- openstack: Error waiting for server (6c6b5ff7-cc58-451e-b69b-c04a3a1eba26) to become ready: unexpected state 'ERROR', wanted target '[ACTIVE]' .

tail -200 /var/log/nova/nova-api.log | grep -B 5 -A 5 57a44b05-fcd4-49ac-a592-34a993fd18c3
2020-09-22 06:27:45.766 20945 INFO nova.osapi_compute.wsgi.server [req-8fcfa6b3-41f6-4bee-9883-17c69e69766c d7306399300a41378120b6a8887178e7 ef8b4874092945e2985cf60e8a9dadf8 - default default] 10.3.252.171 "GET /v2.1/servers/1691a1cf-c220-468d-b6b1-5ed1e5c6b1e4 HTTP/1.1" status: 404 len: 527 time: 0.0342519
2020-09-22 06:28:06.395 20951 INFO nova.osapi_compute.wsgi.server [req-84abb9a0-3882-418f-8eed-5af23812465e d7306399300a41378120b6a8887178e7 ef8b4874092945e2985cf60e8a9dadf8 - default default] 10.3.252.171 "GET /v2.1/os-floating-ips HTTP/1.1" status: 200 len: 413 time: 0.1900549
2020-09-22 06:28:07.099 20949 INFO nova.osapi_compute.wsgi.server [req-d7a06e53-09c4-4c4e-bef8-4caa1b4bb010 d7306399300a41378120b6a8887178e7 ef8b4874092945e2985cf60e8a9dadf8 - default default] 10.3.252.171 "GET /v2.1/servers/detail HTTP/1.1" status: 200 len: 3462 time: 0.6158741
2020-09-22 06:28:44.924 20942 INFO nova.osapi_compute.wsgi.server [req-7841b93e-7154-4e83-9eb9-cdd0a2995ca6 d7306399300a41378120b6a8887178e7 ef8b4874092945e2985cf60e8a9dadf8 - default default] 10.3.252.171 "GET /v2.1/flavors/e4b38f05-ba89-4e81-87b8-30d3cfa2a0ea HTTP/1.1" status: 200 len: 860 time: 0.1292100
2020-09-22 06:28:45.516 20946 INFO nova.osapi_compute.wsgi.server [req-e19eb307-5cc0-4c2b-a98b-6982c365e71d d7306399300a41378120b6a8887178e7 ef8b4874092945e2985cf60e8a9dadf8 - default default] 10.3.252.171 "POST /v2.1/servers HTTP/1.1" status: 202 len: 860 time: 0.3597310
2020-09-22 06:28:45.643 20943 INFO nova.osapi_compute.wsgi.server [req-a64f321a-10cf-4fdf-bc8f-87573664349e d7306399300a41378120b6a8887178e7 ef8b4874092945e2985cf60e8a9dadf8 - default default] 10.3.252.171 "GET /v2.1/servers/57a44b05-fcd4-49ac-a592-34a993fd18c3 HTTP/1.1" status: 200 len: 1750 time: 0.0371089
2020-09-22 06:28:47.825 20942 INFO nova.osapi_compute.wsgi.server [req-b0cfe954-e886-44c3-8158-d28d68a8d902 d7306399300a41378120b6a8887178e7 ef8b4874092945e2985cf60e8a9dadf8 - default default] 10.3.252.171 "GET /v2.1/servers/57a44b05-fcd4-49ac-a592-34a993fd18c3 HTTP/1.1" status: 200 len: 1885 time: 0.0919571
2020-09-22 06:28:47.857 20946 INFO nova.api.openstack.compute.server_external_events [req-1e77e11a-661f-4337-90cb-75d3be73bde5 c80304baa13340868e03176f8e0220dd 40f0cae4d9e844a1abcc139e827ccb4c - default default] Creating event network-changed:abbf7ffc-6ce4-4cbc-b1bc-c03dd4b59902 for instance 57a44b05-fcd4-49ac-a592-34a993fd18c3 on buffalo-new
2020-09-22 06:28:47.859 20946 INFO nova.osapi_compute.wsgi.server [req-1e77e11a-661f-4337-90cb-75d3be73bde5 c80304baa13340868e03176f8e0220dd 40f0cae4d9e844a1abcc139e827ccb4c - default default] 10.102.0.34 "POST /v2.1/os-server-external-events HTTP/1.1" status: 200 len: 578 time: 0.1586082
2020-09-22 06:28:48.911 20951 INFO nova.api.openstack.wsgi [req-bf115b42-5b1c-4abf-bd47-e8a861750d64 c80304baa13340868e03176f8e0220dd 40f0cae4d9e844a1abcc139e827ccb4c - default default] HTTP exception thrown: No instances found for any event
2020-09-22 06:28:48.912 20951 INFO nova.osapi_compute.wsgi.server [req-bf115b42-5b1c-4abf-bd47-e8a861750d64 c80304baa13340868e03176f8e0220dd 40f0cae4d9e844a1abcc139e827ccb4c - default default] 10.102.0.34 "POST /v2.1/os-server-external-events HTTP/1.1" status: 404 len: 498 time: 0.1021891
2020-09-22 06:28:49.999 20943 INFO nova.osapi_compute.wsgi.server [req-9576b418-7260-4df5-903e-b15288d16e3f d7306399300a41378120b6a8887178e7 ef8b4874092945e2985cf60e8a9dadf8 - default default] 10.3.252.171 "GET /v2.1/servers/57a44b05-fcd4-49ac-a592-34a993fd18c3 HTTP/1.1" status: 200 len: 2524 time: 0.0842030
2020-09-22 06:28:50.182 20950 WARNING nova.compute.api [req-87f55e72-9926-429d-a85f-add754ef2b9f d7306399300a41378120b6a8887178e7 ef8b4874092945e2985cf60e8a9dadf8 - default default] [instance: 57a44b05-fcd4-49ac-a592-34a993fd18c3] instance's host None is down, deleting from database
2020-09-22 06:28:50.428 20950 INFO nova.osapi_compute.wsgi.server [req-87f55e72-9926-429d-a85f-add754ef2b9f d7306399300a41378120b6a8887178e7 ef8b4874092945e2985cf60e8a9dadf8 - default default] 10.3.252.171 "DELETE /v2.1/servers/57a44b05-fcd4-49ac-a592-34a993fd18c3 HTTP/1.1" status: 204 len: 400 time: 0.3393259
2020-09-22 06:28:50.572 20946 INFO nova.api.openstack.wsgi [req-6d6f7ff4-3ef1-46f5-9b19-5ecc7b652a5f d7306399300a41378120b6a8887178e7 ef8b4874092945e2985cf60e8a9dadf8 - default default] HTTP exception thrown: Instance 57a44b05-fcd4-49ac-a592-34a993fd18c3 could not be found.
2020-09-22 06:28:50.575 20946 INFO nova.osapi_compute.wsgi.server [req-6d6f7ff4-3ef1-46f5-9b19-5ecc7b652a5f d7306399300a41378120b6a8887178e7 ef8b4874092945e2985cf60e8a9dadf8 - default default] 10.3.252.171 "GET /v2.1/servers/57a44b05-fcd4-49ac-a592-34a993fd18c3 HTTP/1.1" status: 404 len: 527 time: 0.0552299
2020-09-22 06:29:06.353 20946 INFO nova.osapi_compute.wsgi.server [req-61e331de-ac30-433d-8909-cc831d596901 d7306399300a41378120b6a8887178e7 ef8b4874092945e2985cf60e8a9dadf8 - default default] 10.3.252.171 "GET /v2.1/os-floating-ips HTTP/1.1" status: 200 len: 413 time: 0.1523890
2020-09-22 06:29:06.747 20946 INFO nova.osapi_compute.wsgi.server [req-6fc66a0b-d5d6-473d-9786-308e3e96ffa7 d7306399300a41378120b6a8887178e7 ef8b4874092945e2985cf60e8a9dadf8 - default default] 10.3.252.171 "GET /v2.1/servers/detail HTTP/1.1" status: 200 len: 3462 time: 0.3006909
2020-09-22 06:30:06.495 20941 INFO nova.osapi_compute.wsgi.server [req-acc8cffe-368d-4059-8317-443efe04d6a4 d7306399300a41378120b6a8887178e7 ef8b4874092945e2985cf60e8a9dadf8 - default default] 10.3.252.171 "GET /v2.1/os-floating-ips HTTP/1.1" status: 200 len: 413 time: 0.2963970
2020-09-22 06:30:06.863 20944 INFO nova.osapi_compute.wsgi.server [req-70192faf-2f40-4248-9c58-04c57f8d2dbd d7306399300a41378120b6a8887178e7 ef8b4874092945e2985cf60e8a9dadf8 - default default] 10.3.252.171 "GET /v2.1/servers/detail HTTP/1.1" status: 200 len: 3462 time: 0.2758498
2020-09-22 06:31:06.799 20941 INFO nova.osapi_compute.wsgi.server [req-d9579aad-a1cc-42db-aeea-8e5c5631def0 d7306399300a41378120b6a8887178e7 ef8b4874092945e2985cf60e8a9dadf8 - default default] 10.3.252.171 "GET /v2.1/os-floating-ips HTTP/1.1" status: 200 len: 413 time: 0.6033480

Reproduction Steps

PACKER_LOG=1 packer build os.json

Packer version

1.6.2

Simplified Packer Buildfile

{
  "builders": [{
      "type": "openstack",
      "image_name": "custom-solr-image01",
      "source_image": "364daa7d-4de8-4ef7-a8b9-ab407fe42622",
      "flavor": "e4b38f05-ba89-4e81-87b8-30d3cfa2a0ea",
      "floating_ip_pool": "Public",
      "security_groups": ["default"],
      "ssh_username": "root",
      "ssh_password": "password123",
      "networks": "afd08831-7dec-4885-8f19-0ca54aaef033",
      "volume_name": "custom-solr-image01",
      "volume_size": 35
    }
  ],
  "provisioners": [{
    "type": "shell",
    "inline": [
      "sleep 30",
      "yum install httpd -y",
      "systemctl start httpd",
      "systemctl enable httpd",
      "echo 'Hi' > /var/www/index.html"

    ]
  }]
}

Operating system and Environment details

nova-manage --version
20.4.0
openstack --version
openstack 4.0.1
openstack versions show
+-------------+---------------+---------+------------+--------------------------------+------------------+------------------+
| Region Name | Service Type  | Version | Status     | Endpoint                       | Min Microversion | Max Microversion |
+-------------+---------------+---------+------------+--------------------------------+------------------+------------------+
| RegionOne   | block-storage | 2.0     | DEPRECATED | http://XXXX:8776/v2/   | None             | None             |
| RegionOne   | block-storage | 3.0     | CURRENT    | http://XXXX:8776/v3/   | 3.0              | 3.59             |
| RegionOne   | placement     | 1.0     | CURRENT    | http://XXXX:8778/      | 1.0              | 1.36             |
| RegionOne   | network       | 2.0     | CURRENT    | http://XXXX:9696/v2.0/ | None             | None             |
| RegionOne   | image         | 2.0     | SUPPORTED  | http://XXXX:9292/v2/   | None             | None             |
| RegionOne   | image         | 2.1     | SUPPORTED  | http://XXXX:9292/v2/   | None             | None             |
| RegionOne   | image         | 2.2     | SUPPORTED  | http://XXXX:9292/v2/   | None             | None             |
| RegionOne   | image         | 2.3     | SUPPORTED  | http://XXXX:9292/v2/   | None             | None             |
| RegionOne   | image         | 2.4     | SUPPORTED  | http://XXXX:9292/v2/   | None             | None             |
| RegionOne   | image         | 2.5     | SUPPORTED  | http://XXXX:9292/v2/   | None             | None             |
| RegionOne   | image         | 2.6     | SUPPORTED  | http://XXXX:9292/v2/   | None             | None             |
| RegionOne   | image         | 2.7     | SUPPORTED  | http://XXXX:9292/v2/   | None             | None             |
| RegionOne   | image         | 2.9     | CURRENT    | http://XXXX:9292/v2/   | None             | None             |
| RegionOne   | compute       | 2.0     | SUPPORTED  | http://XXXX:8774/v2/   | None             | None             |
| RegionOne   | compute       | 2.1     | CURRENT    | http://XXXX:8774/v2.1/ | 2.1              | 2.79             |
| RegionOne   | identity      | 3.13    | CURRENT    | http://XXXX:5000/v3/   | None             | None             |
+-------------+---------------+---------+------------+--------------------------------+------------------+------------------+

Log Fragments and crash.log files

PACKER_LOG=1 packer build os.json 
2020/09/22 06:37:44 [INFO] Packer version: 1.6.2 [go1.13.15 linux amd64]
2020/09/22 06:37:44 Checking 'PACKER_CONFIG' for a config file path
2020/09/22 06:37:44 'PACKER_CONFIG' not set; checking the default config file path
2020/09/22 06:37:44 Attempting to open config file: /root/.packerconfig
2020/09/22 06:37:44 [WARN] Config file doesn't exist: /root/.packerconfig
2020/09/22 06:37:44 Setting cache directory: /opt/image-create/packer_cache
2020/09/22 06:37:44 Creating plugin client for path: /usr/sbin/cracklib-packer
2020/09/22 06:37:44 Starting plugin: /usr/sbin/cracklib-packer []string{"/usr/sbin/cracklib-packer", "plugin", "packer-builder-openstack"}
2020/09/22 06:37:44 Waiting for RPC address for: /usr/sbin/cracklib-packer
2020/09/22 06:37:44 cracklib-packer plugin: [INFO] Packer version: 1.6.2 [go1.13.15 linux amd64]
2020/09/22 06:37:44 cracklib-packer plugin: Checking 'PACKER_CONFIG' for a config file path
2020/09/22 06:37:44 cracklib-packer plugin: 'PACKER_CONFIG' not set; checking the default config file path
2020/09/22 06:37:44 cracklib-packer plugin: Attempting to open config file: /root/.packerconfig
2020/09/22 06:37:44 cracklib-packer plugin: [WARN] Config file doesn't exist: /root/.packerconfig
2020/09/22 06:37:44 cracklib-packer plugin: Setting cache directory: /opt/image-create/packer_cache
2020/09/22 06:37:44 cracklib-packer plugin: args: []string{"packer-builder-openstack"}
2020/09/22 06:37:44 Received unix RPC address for /usr/sbin/cracklib-packer: addr is /tmp/packer-plugin275366570
2020/09/22 06:37:44 cracklib-packer plugin: Plugin address: unix /tmp/packer-plugin275366570
2020/09/22 06:37:44 cracklib-packer plugin: Waiting for connection...
2020/09/22 06:37:44 cracklib-packer plugin: Serving a plugin connection...
2020/09/22 06:37:44 Creating plugin client for path: /usr/sbin/cracklib-packer
2020/09/22 06:37:44 Starting plugin: /usr/sbin/cracklib-packer []string{"/usr/sbin/cracklib-packer", "plugin", "packer-provisioner-shell"}
2020/09/22 06:37:44 Waiting for RPC address for: /usr/sbin/cracklib-packer
2020/09/22 06:37:45 cracklib-packer plugin: [INFO] Packer version: 1.6.2 [go1.13.15 linux amd64]
2020/09/22 06:37:45 cracklib-packer plugin: Checking 'PACKER_CONFIG' for a config file path
2020/09/22 06:37:45 cracklib-packer plugin: 'PACKER_CONFIG' not set; checking the default config file path
2020/09/22 06:37:45 cracklib-packer plugin: Attempting to open config file: /root/.packerconfig
2020/09/22 06:37:45 cracklib-packer plugin: [WARN] Config file doesn't exist: /root/.packerconfig
2020/09/22 06:37:45 cracklib-packer plugin: Setting cache directory: /opt/image-create/packer_cache
2020/09/22 06:37:45 cracklib-packer plugin: args: []string{"packer-provisioner-shell"}
2020/09/22 06:37:45 Received unix RPC address for /usr/sbin/cracklib-packer: addr is /tmp/packer-plugin817340970
2020/09/22 06:37:45 cracklib-packer plugin: Plugin address: unix /tmp/packer-plugin817340970
2020/09/22 06:37:45 cracklib-packer plugin: Waiting for connection...
2020/09/22 06:37:45 cracklib-packer plugin: Serving a plugin connection...
2020/09/22 06:37:45 Preparing build: openstack
openstack: output will be in this color.

2020/09/22 06:37:45 Build debug mode: false
2020/09/22 06:37:45 Force build: false
2020/09/22 06:37:45 On error: 
2020/09/22 06:37:45 Waiting on builds to complete...
2020/09/22 06:37:45 Starting build run: openstack
2020/09/22 06:37:45 Running builder: openstack
2020/09/22 06:37:45 [INFO] (telemetry) Starting builder openstack
==> openstack: Loading flavor: e4b38f05-ba89-4e81-87b8-30d3cfa2a0ea
2020/09/22 06:37:45 cracklib-packer plugin: [INFO] Loading flavor by ID: e4b38f05-ba89-4e81-87b8-30d3cfa2a0ea
    openstack: Verified flavor. ID: e4b38f05-ba89-4e81-87b8-30d3cfa2a0ea
==> openstack: Not using temporary keypair
==> openstack: Launching server...
==> openstack: Launching server...
    openstack: Server ID: 6c6b5ff7-cc58-451e-b69b-c04a3a1eba26
2020/09/22 06:37:46 cracklib-packer plugin: server id: 6c6b5ff7-cc58-451e-b69b-c04a3a1eba26
==> openstack: Waiting for server to become ready...
2020/09/22 06:37:46 cracklib-packer plugin: Waiting for state to become: [ACTIVE]
2020/09/22 06:37:47 cracklib-packer plugin: Waiting for state to become: [ACTIVE] currently BUILD (0%)
2020/09/22 06:37:49 cracklib-packer plugin: Waiting for state to become: [ACTIVE] currently BUILD (0%)
==> openstack: Error waiting for server (6c6b5ff7-cc58-451e-b69b-c04a3a1eba26) to become ready: unexpected state 'ERROR', wanted target '[ACTIVE]'
==> openstack: Terminating the source server: 6c6b5ff7-cc58-451e-b69b-c04a3a1eba26 ...
2020/09/22 06:37:51 cracklib-packer plugin: Waiting for state to become: [DELETED]
2020/09/22 06:37:52 cracklib-packer plugin: [INFO] 404 on ServerStateRefresh, returning DELETED
2020/09/22 06:37:52 [INFO] (telemetry) ending openstack
==> Wait completed after 6 seconds 663 milliseconds
2020/09/22 06:37:52 machine readable: error-count []string{"1"}
==> Some builds didn't complete successfully and had errors:
2020/09/22 06:37:52 machine readable: openstack,error []string{"Error waiting for server (6c6b5ff7-cc58-451e-b69b-c04a3a1eba26) to become ready: unexpected state 'ERROR', wanted target '[ACTIVE]'"}
==> Builds finished but no artifacts were created.
2020/09/22 06:37:52 [INFO] (telemetry) Finalizing.
Build 'openstack' errored after 6 seconds 663 milliseconds: Error waiting for server (6c6b5ff7-cc58-451e-b69b-c04a3a1eba26) to become ready: unexpected state 'ERROR', wanted target '[ACTIVE]'

==> Wait completed after 6 seconds 663 milliseconds

==> Some builds didn't complete successfully and had errors:
--> openstack: Error waiting for server (6c6b5ff7-cc58-451e-b69b-c04a3a1eba26) to become ready: unexpected state 'ERROR', wanted target '[ACTIVE]'

==> Builds finished but no artifacts were created.
2020/09/22 06:37:52 waiting for all plugin processes to complete...
2020/09/22 06:37:52 /usr/sbin/cracklib-packer: plugin process exited
2020/09/22 06:37:52 /usr/sbin/cracklib-packer: plugin process exited

Packer keeps trying to pull a non existent source image

Overview of the Issue

I've noticed that one Packer CI job was running for a very long time: more than 30 minutes, when the average job's duration is less than 10 minutes. The following message was logged over and over again:

openstack.debian: Image not Active, retrying in 10 seconds

I killed the job and found the issue: the image declared in the external_source_image_url variable did not exist: the HTTP endpoint was returning a 404 error.

Reproduction Steps

Set the external_source_image_url variable to a non existent image.

Plugin and Packer version

Packer 1.7.8
Openstack plugin 1.0.0

Simplified Packer Buildfile

packer {
  required_version = "1.7.8"
  required_plugins {
    openstack = {
      version = "1.0.0"
      source  = "github.com/hashicorp/openstack"
    }
  }
}

source "openstack" "debian" {
  cloud                        = "dc1"
  external_source_image_format = "raw"
  external_source_image_url    = "http://cdimage.debian.org/cdimage/openstack/10.11.1-20211029/debian-10.11.1-20211029-openstack-amd64.raw"
  image_min_disk               = "10"
  image_name                   = "bla"
  flavor                       = "packer"
  ssh_username                 = "debian"
}

build {
  sources = ["source.openstack.debian"]
}

Operating system and Environment details

Debian Buster

Log Fragments and crash.log files

$ packer build debian.pkr.hcl
116openstack.debian: output will be in this color.
117==> openstack.debian: Loading flavor: packer
118    openstack.debian: Verified flavor. ID: 121d18c3-f0e0-4096-ba60-54c4050ea109
119==> openstack.debian: Creating temporary keypair: packer_61d470f3-fd3e-a797-819b-21b31030b544 ...
120==> openstack.debian: Created temporary keypair: packer_61d470f3-fd3e-a797-819b-21b31030b544
121==> openstack.debian: Creating image using external source image with name packer_61d470f3-fcb1-75b4-1c99-251728853883
122==> openstack.debian: Using disk format raw
123==> openstack.debian: Created image with ID 4964814c-7512-4293-879d-50b5b25b37cb
124==> openstack.debian: Importing External Source Image from URL http://cdimage.debian.org/cdimage/openstack/10.11.1-20211029/debian-10.11.1-20211029-openstack-amd64.raw
125    openstack.debian: Image not Active, retrying in 10 seconds
126    openstack.debian: Image not Active, retrying in 10 seconds
127    openstack.debian: Image not Active, retrying in 10 seconds
128    openstack.debian: Image not Active, retrying in 10 seconds
129    openstack.debian: Image not Active, retrying in 10 seconds
130    openstack.debian: Image not Active, retrying in 10 seconds
131    openstack.debian: Image not Active, retrying in 10 seconds
132    openstack.debian: Image not Active, retrying in 10 seconds

If there are no networks in project, packer just moves on

When filing a bug, please include the following headings if possible. Any
example text in this template can be deleted.

Overview of the Issue

If there are no networks in project, packer just moves on next step, creates volume, image, and try to connect to server without interfaces.

Reproduction Steps

Remove all network from openstack
Remove network id, cidr, any info about network in buildfile

Plugin and Packer version

From v1.0.1

Simplified Packer Buildfile

source "openstack" "test-1" {
flavor = var.flavor
identity_endpoint = var.identity_endpoint
image_disk_format = "raw"
image_name = "${local.image_name}"
image_tags = ["packer"]
region = "region"
source_image_name = var.source_image_name
ssh_clear_authorized_keys = true
ssh_username = "root"
use_blockstorage_volume = true
},
build {
sources = [
"source.openstack.test-1",
]
}

Operating system and Environment details

Log Fragments and crash.log files

2022-12-08T18:42:34+03:00: ==> openstack.test-1: Loading flavor: m1.tiny
2022-12-08T18:42:35+03:00: openstack.test-1: Verified flavor. ID: 1
2022-12-08T18:42:35+03:00: ==> openstack.test-1: Creating temporary RSA SSH key for instance...
2022-12-08T18:42:37+03:00: ==> openstack.test-1: Creating temporary keypair: packer_639205ea-c1ed-6490-cd4c-6e24092f53fd ...
2022-12-08T18:42:38+03:00: ==> openstack.test-1: Created temporary keypair: packer_639205ea-c1ed-6490-cd4c-6e24092f53fd
2022-12-08T18:42:38+03:00: openstack.test-1: Found Image ID: 56eeddc3-d88b-4138-84b8-2cd728419d47
2022-12-08T18:42:39+03:00: ==> openstack.test-1: Creating volume...
2022-12-08T18:42:40+03:00: ==> openstack.test-1: Waiting for volume packer_639205ea-4806-247b-2ee9-12f349cd4c3d (volume id: 2f9301b5-9b5f-4064-9435-daf0583ec3df) to become available...
2022-12-08T18:42:42+03:00: openstack.test-1: Volume ID: 2f9301b5-9b5f-4064-9435-daf0583ec3df
2022-12-08T18:42:42+03:00: ==> openstack.test-1: Launching server...
2022-12-08T18:42:42+03:00: ==> openstack.test-1: Launching server...
2022-12-08T18:42:48+03:00: openstack.test-1: Server ID: 97703c5d-e66e-44a7-82e5-46d3b0720ed6
2022-12-08T18:42:48+03:00: ==> openstack.test-1: Waiting for server to become ready...
2022-12-08T18:42:57+03:00: openstack.test-1: Floating IP not required
2022-12-08T18:42:58+03:00: ==> openstack.test-1: Waiting for SSH to become available...
2022-12-08T18:47:58+03:00: ==> openstack.test-1: Timeout waiting for SSH.
2022-12-08T18:47:58+03:00: ==> openstack.test-1: Timeout waiting for SSH.
2022-12-08T18:47:58+03:00: ==> openstack.test-1: Step "StepConnect" failed

OpenStack Builder: using WinRM connector produces error "An invalid 'name' value was provided."

This issue was originally opened by @JimPruitt as hashicorp/packer#7646. It was migrated here as a result of the Packer plugin split. The original body of the issue is below.


FOR BUGS:
Describe the problem and include the following information:
I am attempting to use the Packer "OpenStack" builder with the WinRM connector. I can confirm that the builder is able to connect to OpenStack successfully and it successfully detects the OpenStack "flavor" ID (by using the flavor name). However, when it tries to launch the source server I get an error:

openstack: Error launching source server: Bad request with: [POST https://...:****/v2.1/servers], error message: {"badRequest": {"message": "An invalid 'name' value was provided. The name must be: printable characters. Can not start or end with whitespace.", "code": 400}}

(Note that the ip address and port are obscured in the above error message)

Openstack image gets deleted after their creation with packer

This issue was originally opened by @unnikrishnan262 in hashicorp/packer#11136 and has been migrated to this repository. The original issue description is below.


When filing a bug, please include the following headings if possible. Any
example text in this template can be deleted.

Overview of the Issue

I encounter the same issue as the one described here (7312). (which is closed - i've tested all the workaround shown there)

Every time I create an image on Openstack, it is get deleted at the end of the process. Here is the basic output of the packer command. We are using VMware as OpenStack backend. If I run the packer build with '-debug' option, the image creation is successful.

It looks like from the Nova logs that there is a race condition in which vmware snapshot get deleted before the image upload completes and when we run with debug, there are few secs delay while we hit enter multiple time. Can we introduce a pause before the "Terminating the source server" step or do more check to make sure image is created successfully?

it reads like packer only looks at the image and when it's available, while there's an endpoint in Nova for checking if an asynchronous task is done.
https://docs.openstack.org/api-guide/compute/faults.html#server-actions

openstack: [DEBUG] Request GET https://image-3.ap-ae-1.cloud.sap/v2/images/5404d85a-aef5-42d2-ab5b-5562f86e11e6 200
openstack: [DEBUG] Request GET https://image-3.ap-ae-1.cloud.sap/v2/images/5404d85a-aef5-42d2-ab5b-5562f86e11e6 200

==> openstack: Pausing after run of step 'stepCreateImage'. Press enter to continue.
==> openstack: Pausing after run of step 'stepUpdateImageTags'. Press enter to continue.
==> openstack: Pausing after run of step 'stepUpdateImageVisibility'. Press enter to continue.
==> openstack: Pausing after run of step 'stepAddImageMembers'. Press enter to continue.
==> openstack: Pausing after run of step 'stepUpdateImageMinDisk'. Press enter to continue.
==> openstack: Pausing before cleanup of step 'stepUpdateImageMinDisk'. Press enter to continue.
==> openstack: Pausing before cleanup of step 'stepAddImageMembers'. Press enter to continue.
==> openstack: Pausing before cleanup of step 'stepUpdateImageVisibility'. Press enter to continue.
==> openstack: Pausing before cleanup of step 'stepUpdateImageTags'. Press enter to continue.
==> openstack: Pausing before cleanup of step 'stepCreateImage'. Press enter to continue.
==> openstack: Pausing before cleanup of step 'StepDetachVolume'. Press enter to continue.
==> openstack: Pausing before cleanup of step 'StepStopServer'. Press enter to continue.
==> openstack: Pausing before cleanup of step 'StepCleanupTempKeys'. Press enter to continue.
==> openstack: Pausing before cleanup of step 'StepProvision'. Press enter to continue.
==> openstack: Pausing before cleanup of step 'StepConnect'. Press enter to continue.
==> openstack: Pausing before cleanup of step 'StepAllocateIp'. Press enter to continue.
==> openstack: Pausing before cleanup of step 'StepWaitForRackConnect'. Press enter to continue.
==> openstack: Pausing before cleanup of step 'StepGetPassword'. Press enter to continue.
==> openstack: Pausing before cleanup of step 'StepRunSourceServer'. Press enter to continue.
==> openstack: Terminating the source server: 33e859df-d6c6-4885-b383-4c7fb3a1dd99 ...
openstack: [DEBUG] Request POST https://compute-3.ap-ae-1.cloud.sap:443/v2.1/servers/33e859df-d6c6-4885-b383-4c7fb3a1dd99/action 202
openstack: [DEBUG] Request GET https://compute-3.ap-ae-1.cloud.sap:443/v2.1/servers/33e859df-d6c6-4885-b383-4c7fb3a1dd99 200
openstack: [DEBUG] Request GET https://compute-3.ap-ae-1.cloud.sap:443/v2.1/servers/33e859df-d6c6-4885-b383-4c7fb3a1dd99 200

[root@test100 ~]# /usr/local/bin/packer2 build -on-error=ask -force rhel.json
openstack: output will be in this color.

==> openstack: Loading flavor: 20
openstack: Verified flavor. ID: 20
==> openstack: Creating temporary keypair: packer_60e3fa23-14b7-398b-3c79-61a5899874f6 ...
==> openstack: Created temporary keypair: packer_60e3fa23-14b7-398b-3c79-61a5899874f6
==> openstack: Launching server...
==> openstack: Launching server...
openstack: Server ID: dfd3de80-6f6e-4398-8fbd-c0e83f802b49
==> openstack: Waiting for server to become ready...
openstack: Floating IP not required
==> openstack: Using SSH communicator to connect: 10.209.251.152
==> openstack: Waiting for SSH to become available...
==> openstack: Connected to SSH!
==> openstack: Stopping server: dfd3de80-6f6e-4398-8fbd-c0e83f802b49 ...
openstack: Waiting for server to stop: dfd3de80-6f6e-4398-8fbd-c0e83f802b49 ...
==> openstack: Creating the image: rhel-6-vmware
openstack: Image: f01cbcb0-ea30-4cac-a3bb-f7c2ca747c70
==> openstack: Waiting for image rhel-6-vmware (image id: f01cbcb0-ea30-4cac-a3bb-f7c2ca747c70) to become ready...
==> openstack: Terminating the source server: dfd3de80-6f6e-4398-8fbd-c0e83f802b49 ...
==> openstack: Deleting temporary keypair: packer_60e3fa23-14b7-398b-3c79-61a5899874f6 ...
Build 'openstack' finished after 5 minutes 12 seconds.

==> Wait completed after 5 minutes 12 seconds

==> Builds finished. The artifacts of successful builds are:
--> openstack: An image was created: f01cbcb0-ea30-4cac-a3bb-f7c2ca747c70
[root@test100 ~]#

Packer version

1.6.6

Simplified Packer Buildfile

If the file is longer than a few dozen lines, please include the URL to the
gist of the log or use the Github detailed
format

instead of posting it directly in the issue.

Operating system and Environment details

I tried running packer on my Mac, RHEL7 but same result.

The Openstack nova log shows the below error.

2021-07-01 06:59:32,511.511 6 ERROR oslo_messaging.rpc.server [req-9e3cd3c3-b2cc-471b-9d1d-940ec32ec1e3 greq-522d7578-a4db-f848-f209-788fb4149167 fdda6904f2d786d6092ca89c0e991d96f9e823fac746ed4ea635ab0199cea8ae 184f96ee29874bb488574a0fc130b094 - 4f18f794e1f04441a4607200295b7f2e 4f18f794e1f04441a4607200295b7f2e] Exception during message handling: ManagedObjectNotFoundException: The object 'vim.vm.Snapshot:snapshot-2028228' has already been deleted or has not been completely created

Unable to build image when using root block storage volume

I have been building the glance image without using Cinder block storage volume and that works fine. However, building the a packer Openstack image using block storage volume errored out with HTTP 403 Forbidden: Access was denied to this resource.: Attribute &#x27;os_glance_failed_import&#x27; is reserved.

I have also did a manual test by:

  • Create a bootable volume in Openstack using the external image.
  • Run cinder upload-to-image.
  • The glance image is successful created.

cinder upload-to-image uses the same API endpoint as Packer Openstack plugin

http://api.openstack.cloud:8776/v3/0a3ec33c5c634ae58ed420ff1daa222e/volumes/5f42fd30-23cb-4956-95ab-ae885c66ca24/action

We are running Openstack Yoga. I suspect this is due to the really old version of gophercloud that this plugin uses:
https://github.com/hashicorp/packer-plugin-openstack/blob/main/go.mod#L7

The current stable gophercloud release is already at v1.1.0 and on track to release v2.0.0.

Reproduction Steps

Steps to reproduce this issue:

packer build ubuntu.pkr.hcl

Plugin and Packer version

packer --version
Packer v1.10.2
packer plugins installed
/home/ubuntu/.config/packer/plugins/github.com/hashicorp/openstack/packer-plugin-openstack_v1.1.2_x5.0_linux_amd64

Simplified Packer Buildfile

source "openstack" "linux" {
  image_tags                    = ["ubuntu-lts", "ubuntu-20.04"]
  external_source_image_url     = "https://cloud-images.ubuntu.com/focal/current/focal-server-cloudimg-amd64.img"
  external_source_image_format  = "qcow2"
  cloud                         = "packer-image-builder"
  flavor                        = "small"
  region                        = "nova"
  availability_zone             = "nova"
  image_disk_format             = "raw"
  image_visibility              = "private"
  image_min_disk                = 10
  networks                      = ["cdcdb248-9cba-498b-9227-ca04b03c038e"]
  security_groups               = ["dff27e7d-56dc-49a8-a3f9-e8bc3dd0972a"]
  communicator                  = "ssh"
  ssh_clear_authorized_keys     = true
  ssh_timeout                   = "10m"
  ssh_bastion_host              = "packer-bastion"
  ssh_bastion_username          = "ubuntu"
  ssh_bastion_private_key_file  = "~/.ssh/id_rsa"
  ssh_username                  = "ubuntu"
  use_blockstorage_volume       = true
  volume_size                   = 10
  volume_type                   = "ssd"
}

build {
  source "openstack.linux" {
    name                      = "ubuntu-20.04-plain"
    image_name                = "Ubuntu 20.04 LTS Server amd64-${local.timestamp}"
  }
}

Log Fragments and crash.log files

$ packer build no1-u2004-plain.pkr.hcl
openstack.ubuntu-20.04-plain: output will be in this color.

==> openstack.ubuntu-20.04-plain: Loading flavor: small
    openstack.ubuntu-20.04-plain: Verified flavor. ID: 3afdf992-b8a3-41ff-8bf7-c2003ec93822
==> openstack.ubuntu-20.04-plain: Creating temporary RSA SSH key for instance...
==> openstack.ubuntu-20.04-plain: Creating temporary keypair: packer_6617b261-5ac5-5a6c-3377-9f024c66fa6e ...
==> openstack.ubuntu-20.04-plain: Created temporary keypair: packer_6617b261-5ac5-5a6c-3377-9f024c66fa6e
==> openstack.ubuntu-20.04-plain: Creating image using external source image with name packer_6617b261-f0b0-e9b8-72ef-b047343b09bd
==> openstack.ubuntu-20.04-plain: Using disk format qcow2
==> openstack.ubuntu-20.04-plain: Created image with ID ecaa1141-310a-492a-8c10-858d5aeb1599
==> openstack.ubuntu-20.04-plain: Importing External Source Image from URL https://cloud-images.ubuntu.com/focal/current/focal-server-cloudimg-amd64.img
    openstack.ubuntu-20.04-plain: Image not Active, retrying in 10 seconds
    openstack.ubuntu-20.04-plain: Image not Active, retrying in 10 seconds
==> openstack.ubuntu-20.04-plain: Creating volume...
==> openstack.ubuntu-20.04-plain: Waiting for volume packer_6617b261-84d9-da68-ce53-25d674bb7fde (volume id: 5f42fd30-23cb-4956-95ab-ae885c66ca24) to become available...
    openstack.ubuntu-20.04-plain: Volume ID: 5f42fd30-23cb-4956-95ab-ae885c66ca24
==> openstack.ubuntu-20.04-plain: Launching server...
==> openstack.ubuntu-20.04-plain: Launching server...
    openstack.ubuntu-20.04-plain: Server ID: 83b4e3ae-a02e-47cb-bf98-06bc6ff3f0a3
==> openstack.ubuntu-20.04-plain: Waiting for server to become ready...
    openstack.ubuntu-20.04-plain: Floating IP not required
==> openstack.ubuntu-20.04-plain: Using SSH communicator to connect: 10.0.1.58
==> openstack.ubuntu-20.04-plain: Waiting for SSH to become available...
==> openstack.ubuntu-20.04-plain: Connected to SSH!
==> openstack.ubuntu-20.04-plain: Trying to remove ephemeral keys from authorized_keys files
==> openstack.ubuntu-20.04-plain: Stopping server: 83b4e3ae-a02e-47cb-bf98-06bc6ff3f0a3 ...
    openstack.ubuntu-20.04-plain: Waiting for server to stop: 83b4e3ae-a02e-47cb-bf98-06bc6ff3f0a3 ...
==> openstack.ubuntu-20.04-plain: Terminating the source server: 83b4e3ae-a02e-47cb-bf98-06bc6ff3f0a3 ...
==> openstack.ubuntu-20.04-plain: Creating the image: Ubuntu 20.04 LTS Server amd64-20240411
==> openstack.ubuntu-20.04-plain: Error creating image: Bad request with: [POST http://api.openstack.cloud:8776/v3/0a3ec33c5c634ae58ed420ff1daa222e/volumes/5f42fd30-23cb-4956-95ab-ae885c66ca24/action], error message: {"badRequest": {"code": 400, "message": "HTTP 403 Forbidden: Access was denied to this resource.: Attribute &#x27;os_glance_failed_import&#x27; is reserved."}}
==> openstack.ubuntu-20.04-plain: Provisioning step had errors: Running the cleanup provisioner, if present...
==> openstack.ubuntu-20.04-plain: Terminating the source server: 83b4e3ae-a02e-47cb-bf98-06bc6ff3f0a3 ...
==> openstack.ubuntu-20.04-plain: Error terminating server, may still be around: Resource not found
==> openstack.ubuntu-20.04-plain: Deleting volume: 5f42fd30-23cb-4956-95ab-ae885c66ca24 ...
==> openstack.ubuntu-20.04-plain: Deleting temporary external source image: packer_6617b261-f0b0-e9b8-72ef-b047343b09bd ...
==> openstack.ubuntu-20.04-plain: Deleting temporary keypair: packer_6617b261-5ac5-5a6c-3377-9f024c66fa6e ...
Build 'openstack.ubuntu-20.04-plain' errored after 1 minute 31 seconds: Error creating image: Bad request with: [POST http://api.openstack.cloud:8776/v3/0a3ec33c5c634ae58ed420ff1daa222e/volumes/5f42fd30-23cb-4956-95ab-ae885c66ca24/action], error message: {"badRequest": {"code": 400, "message": "HTTP 403 Forbidden: Access was denied to this resource.: Attribute &#x27;os_glance_failed_import&#x27; is reserved."}}

Timeout while `waiting for image creation`

Hello,

I'm currently running packer to generate image inside openshift.
Overall it works very well, but it seems the infrastructure is too slow for the defined timeout.
Is there a way to increate the retry/waiting time on the "waiting for image creation" step ?
I have check the packer manual of course, but havent found anything related to it.

[...]
2022/01/25 10:58:31 ui: ๏ฟฝ[1;32m==> openstack: Detaching volume packer_61efb527-xxx-a1e1-16de-217ae407587c (volume id: 2d17f222-xxx-4ecf-b7da-33f6e3ca07d5)๏ฟฝ[0m
2022/01/25 10:58:32 ui: ๏ฟฝ[1;32m==> openstack: Waiting for volume packer_61efb527-xxx-a1e1-16de-217ae407587c (volume id: 2d17f222-xxx-4ecf-b7da-33f6e3ca07d5) to become available...๏ฟฝ[0m
2022/01/25 10:58:32 ui: ๏ฟฝ[1;32m==> openstack: Creating the image: Packer-Build ๏ฟฝ[0m
2022/01/25 10:58:32 ui: ๏ฟฝ[0;32m    openstack: Image: 2c9b4f10-xxx-44e9-869f-0311a10ed250๏ฟฝ[0m
2022/01/25 10:58:32 ui: ๏ฟฝ[1;32m==> openstack: Waiting for image Packer-Build (image id: 2c9b4f10-xxx-44e9-869f-0311a10ed250) to become ready...๏ฟฝ[0m
2022/01/25 10:58:32 packer-builder-openstack plugin: Waiting for image creation status: queued
2022/01/25 10:58:35 packer-builder-openstack plugin: Waiting for image creation status: saving
2022/01/25 10:58:37 packer-builder-openstack plugin: Waiting for image creation status: saving
[...]
2022/01/25 11:03:18 packer-builder-openstack plugin: Waiting for image creation status: saving
2022/01/25 11:03:29 packer-builder-openstack plugin: Waiting for image creation status: queued
2022/01/25 11:03:31 ui error: ๏ฟฝ[1;31m==> openstack: Error waiting for image: Resource not found๏ฟฝ[0m
2022/01/25 11:03:31 ui: ๏ฟฝ[1;32m==> openstack: Provisioning step had errors: Running the cleanup provisioner, if present...๏ฟฝ[0m
2022/01/25 11:03:34 ui: ๏ฟฝ[1;32m==> openstack: Deleted temporary floating IP '6583ad84-xxx-484b-91b4-0104fd8b9a97' (193.148.170.211)๏ฟฝ[0m
2022/01/25 11:03:34 ui: ๏ฟฝ[1;32m==> openstack: Terminating the source server: 6f3a12e1-xxx-4da5-82f5-055e9ca5b768 ...๏ฟฝ[0m
[...]

I have no rush so I can just wait for the conversion for an hour... but only 5 minutes seems to be way to short for 150gb image :(

Packer(v1.10.1)+Ansible(2.10)+openstack + name Flavor = Error API 404, but If use Flavor ID its working.

If I use Packer + Ansible + openstack + name Flavor = Error 404
########################################################################
ะกะฝะธะผะพะบ ัะบั€ะฐะฝะฐ 2024-03-01 ะฒ 21 07 25

########################################################################
ะกะฝะธะผะพะบ ัะบั€ะฐะฝะฐ 2024-02-28 ะฒ 14 07 04
########################################################################

ะกะฝะธะผะพะบ ัะบั€ะฐะฝะฐ 2024-03-01 ะฒ 21 02 45 ######################################################################## ะกะฝะธะผะพะบ ัะบั€ะฐะฝะฐ 2024-03-01 ะฒ 20 53 09 Packer Config HCL ะกะฝะธะผะพะบ ัะบั€ะฐะฝะฐ 2024-03-01 ะฒ 21 19 37 ######################################################################## $ packer init debian12-OStack-base.pkr.hcl Installed plugin github.com/hashicorp/openstack v1.1.1 in "/root/.config/packer/plugins/github.com/hashicorp/openstack/packer-plugin-openstack_v1.1.1_x5.0_linux_amd64" Installed plugin github.com/hashicorp/ansible v1.1.1 in "/root/.config/packer/plugins/github.com/hashicorp/ansible/packer-plugin-ansible_v1.1.1_x5.0_linux_amd64" $ packer build -force -debug debian12-OStack-base.pkr.hcl Debug mode enabled. Builds will not be parallelized. openstack.base: output will be in this color. ==> openstack.base: Loading flavor: custom1.ram4cpu2 openstack.base: [DEBUG] Request GET https://cloud-dev.555.domain:8774/v2.1/flavors/custom1.ram4cpu2 404 openstack.base: [DEBUG] Response Error: {"itemNotFound": {"code": 404, "message": "Flavor custom1.ram4cpu2 could not be found."}} openstack.base: openstack.base: [DEBUG] Request GET https://cloud-dev.555.domain:8774/v2.1/flavors/detail 200 openstack.base: Verified flavor. ID: c7ca335b-33d4-41e1-b17e-28b596a3fd30 ==> openstack.base: Creating temporary RSA SSH key for instance... ==> openstack.base: Creating temporary keypair: packer_65de7444-7bec-3191-cd66-bf63ca869200 ... openstack.base: [DEBUG] Request POST https://cloud-dev.555.domain:8774/v2.1/os-keypairs 200 ==> openstack.base: Created temporary keypair: packer_65de7444-7bec-3191-cd66-bf63ca869200 openstack.base: Saving key for debug purposes: os_base.pem ==> openstack.base: Launching server... ==> openstack.base: Launching server... openstack.base: [DEBUG] Request POST https://cloud-dev.555.domain:8774/v2.1/servers 400 openstack.base: [DEBUG] Response Error: {"badRequest": {"code": 400, "message": "Invalid input for field/attribute imageRef. Value: https://cloud.debian.org/images/cloud/bookworm/20231013-1532/debian-12-generic-amd64-20231013-1532.qcow2. 'https://cloud.debian.org/images/cloud/bookworm/20231013-1532/debian-12-generic-amd64-20231013-1532.qcow2' is not valid under any of the given schemas"}} openstack.base: ==> openstack.base: Error launching source server: Bad request with: [POST https://cloud-dev.555.domain:8774/v2.1/servers], error message: {"badRequest": {"code": 400, "message": "Invalid input for field/attribute imageRef. Value: https://cloud.debian.org/images/cloud/bookworm/20231013-1532/debian-12-generic-amd64-20231013-1532.qcow2. 'https://cloud.debian.org/images/cloud/bookworm/20231013-1532/debian-12-generic-amd64-20231013-1532.qcow2' is not valid under any of the given schemas"}} ==> openstack.base: Terminating the source server: ... openstack.base: [DEBUG] Request DELETE https://cloud-dev.555.domain:8774/v2.1/servers/ 404 openstack.base: [DEBUG] Response Error: {"message": "The resource could not be found.

\n\n\n", "code": "404 Not Found", "title": "Not Found"} openstack.base: ==> openstack.base: Error terminating server, may still be around: Resource not found ==> openstack.base: Deleting temporary keypair: packer_65de7444-7bec-3191-cd66-bf63ca869200 ... openstack.base: [DEBUG] Request DELETE https://cloud-dev.555.domain:8774/v2.1/os-keypairs/packer_65de7444-7bec-3191-cd66-bf63ca869200 202 Build 'openstack.base' errored after 4 seconds 31 milliseconds: Error launching source server: Bad request with: [POST https://cloud-dev.555.domain:8774/v2.1/servers], error message: {"badRequest": {"code": 400, "message": "Invalid input for field/attribute imageRef. Value: https://cloud.debian.org/images/cloud/bookworm/20231013-1532/debian-12-generic-amd64-20231013-1532.qcow2. 'https://cloud.debian.org/images/cloud/bookworm/20231013-1532/debian-12-generic-amd64-20231013-1532.qcow2' is not valid under any of the given schemas"}} ==> Wait completed after 4 seconds 31 milliseconds ==> Some builds didn't complete successfully and had errors: --> openstack.base: Error launching source server: Bad request with: [POST https://cloud-dev.555.domain:8774/v2.1/servers], error message: {"badRequest": {"code": 400, "message": "Invalid input for field/attribute imageRef. Value: https://cloud.debian.org/images/cloud/bookworm/20231013-1532/debian-12-generic-amd64-20231013-1532.qcow2. 'https://cloud.debian.org/images/cloud/bookworm/20231013-1532/debian-12-generic-amd64-20231013-1532.qcow2' is not valid under any of the given schemas"}} ==> Builds finished but no artifacts were created.

[openstack] choke on volumes which end up in error state

This issue was originally opened by @dave2 as hashicorp/packer#8737. It was migrated here as a result of the Packer plugin split. The original body of the issue is below.


Overview of the Issue

Packer chokes waiting on a volume to become ready if the volume instead transitions to 'error' state. This should be caught and immediately passed back to the user, along with abandoning any build in progress.

Probably needs to be tested for as explicit state somewhere around here:
https://github.com/hashicorp/packer/blob/master/builder/openstack/volume.go#L35

Reproduction Steps

Specify a block device smaller than the launch image allows. Seems to always force error state, should choke on that.

Packer version

1.5.1

Simplified Packer Buildfile

Any valid openstack build file will do this, since it's a backend issue with OpenStack and errors.

Operating system and Environment details

Ubuntu 18.04 64-bit. The OpenStack deployment used is a private cloud implementation.

Log Fragments and crash.log files

==> openstack: Creating volume...
==> openstack: Waiting for volume packer_5e45dff6-e5e1-06f4-bda8-60b973283d77 (volume id: 6730cb8e-ad13-401e-a52d-535aad2ade66) to become available...
2020/02/13 23:47:04 packer-builder-openstack plugin: Waiting for volume creation status: creating
2020/02/13 23:47:07 packer-builder-openstack plugin: Waiting for volume creation status: creating
2020/02/13 23:47:09 packer-builder-openstack plugin: Waiting for volume creation status: error
2020/02/13 23:47:11 packer-builder-openstack plugin: Waiting for volume creation status: error
[.. endlessly reports error ..]

Attach additionnal block volumes to VM in Openstack

This issue was originally opened by @gvcgael as hashicorp/packer#8098. It was migrated here as a result of the Packer plugin split. The original body of the issue is below.


Hello,

Currently, the openstack builder does not support adding additionnal blockstorage volumes to VM.

This is a case useful to add persistent data disks to VMs.

It is available on Azure builder ( https://www.packer.io/docs/builders/azure.html#disk_additional_size ) and AWS builder ( https://www.packer.io/docs/builders/amazon-instance.html#ami_block_device_mappings ) but not in Openstack builder.

There references API are :

[OpenStack] floating_ip is actually floating_ip_id

This issue was originally opened by @gkoudjou as hashicorp/packer#8300. It was migrated here as a result of the Packer plugin split. The original body of the issue is below.


Overview of the Issue

According to the documentation, with the Openstack builders, we can defined a specific floating IP address.

https://www.packer.io/docs/builders/openstack.html#floating_ip

While testing, it appears that packer expects an ID.

Reproduction Steps

Here is some json file :

    "builders": [
        {
            "type": "openstack",
            "username": "{{user `username`}}",
            "password": "{{user `password`}}",
            "identity_endpoint": "XXXXXXXXX",
            "region": "regionOne",
            "image_name": "{{user `image_name`}}",
            "instance_name": "packer-test",
            "ssh_timeout": "5m",
            "floating_ip_network": "external",
            "floating_ip": "10.121.240.228",
            ]
        }
    ],

And here is the result :

openstack output will be in this color.

==> openstack: Loading flavor: Tiny_Linux
    openstack: Verified flavor. ID: 1
==> openstack: Not using temporary keypair
    openstack: Found Image ID: d91327b6-ef25-4632-b866-8773927c6a83
==> openstack: Launching server...
==> openstack: Launching server...
    openstack: Server ID: 805257ad-79fa-4e38-904c-ef1951e158bd
==> openstack: Waiting for server to become ready...
==> openstack: Error using provided floating IP '10.121.240.228': Resource not found
==> openstack: Terminating the source server: 805257ad-79fa-4e38-904c-ef1951e158bd ...
Build 'openstack' errored: Error using provided floating IP '10.121.240.228': Resource not found

==> Some builds didn't complete successfully and had errors:
--> openstack: Error using provided floating IP '10.121.240.228': Resource not found

But if a use the ID used by requesting openstack, it's working.

openstack output will be in this color.

==> openstack: Loading flavor: Tiny_Linux
    openstack: Verified flavor. ID: 1
==> openstack: Not using temporary keypair
    openstack: Found Image ID: d91327b6-ef25-4632-b866-8773927c6a83
==> openstack: Launching server...
==> openstack: Launching server...
    openstack: Server ID: 324e2b3c-5f83-4829-ad6f-ce706f87f79a
==> openstack: Waiting for server to become ready...
    openstack: Selected floating IP: '1d869a1f-9378-4069-a087-7050d337d8a3' (10.121.240.228)
==> openstack: Associating floating IP '1d869a1f-9378-4069-a087-7050d337d8a3' (10.121.240.228) with instance port...
    openstack: Added floating IP '1d869a1f-9378-4069-a087-7050d337d8a3' (10.121.240.228) to instance!

Packer version

1.5.0 (yesterday nightly build)

Simplified Packer Buildfile

Please see above

Operating system and Environment details

OS: RHEL 7.3
Architecture: x86_64

Log Fragments and crash.log files

openstack: Found Image ID: d91327b6-ef25-4632-b866-8773927c6a83
==> openstack: Launching server...
==> openstack: Launching server...
openstack: Server ID: dc67299d-0523-44cf-8ac9-7495d6cd6b61
2019/10/31 14:45:31 packer_linux_amd64: 2019/10/31 14:45:31 server id: dc67299d-0523-44cf-8ac9-7495d6cd6b61
2019/10/31 14:45:31 packer_linux_amd64: 2019/10/31 14:45:31 Waiting for state to become: [ACTIVE]
==> openstack: Waiting for server to become ready...
2019/10/31 14:45:32 packer_linux_amd64: 2019/10/31 14:45:32 Waiting for state to become: [ACTIVE] currently BUILD (0%)
2019/10/31 14:45:34 packer_linux_amd64: 2019/10/31 14:45:34 Waiting for state to become: [ACTIVE] currently BUILD (0%)
2019/10/31 14:45:38 packer_linux_amd64: 2019/10/31 14:45:38 Waiting for state to become: [ACTIVE] currently BUILD (0%)
2019/10/31 14:45:41 packer_linux_amd64: 2019/10/31 14:45:41 Waiting for state to become: [ACTIVE] currently BUILD (0%)
2019/10/31 14:45:44 packer_linux_amd64: 2019/10/31 14:45:44 [INFO] Not using winrm communicator, skipping get password...
==> openstack: Error using provided floating IP '10.121.240.228': Resource not found
==> openstack: Terminating the source server: dc67299d-0523-44cf-8ac9-7495d6cd6b61 ...
2019/10/31 14:45:45 packer_linux_amd64: 2019/10/31 14:45:45 Waiting for state to become: [DELETED]
2019/10/31 14:45:46 packer_linux_amd64: 2019/10/31 14:45:46 Waiting for state to become: [DELETED] currently ACTIVE (0%)
Build 'openstack' errored: Error using provided floating IP '10.121.240.228': Resource not found

==> Some builds didn't complete successfully and had errors:
--> openstack: Error using provided floating IP '10.121.240.228': Resource not found

==> Builds finished but no artifacts were created.
2019/10/31 14:45:48 [INFO] (telemetry) ending openstack
2019/10/31 14:45:48 machine readable: error-count []string{"1"}
==> Some builds didn't complete successfully and had errors:
2019/10/31 14:45:48 machine readable: openstack,error []string{"Error using provided floating IP '10.121.240.228': Resource not found"}
==> Builds finished but no artifacts were created.
2019/10/31 14:45:48 [INFO] (telemetry) Finalizing.
2019/10/31 14:45:48 packer_linux_amd64: 2019/10/31 14:45:48 [INFO] 404 on ServerStateRefresh, returning DELETED
2019/10/31 14:45:48 [WARN] (telemetry) Error finalizing report. This is safe to ignore. Post https://checkpoint-api.hashicorp.com/v1/telemetry/packer: proxyconnect tcp: tls: first record does not look like a TLS handshake
2019/10/31 14:45:48 waiting for all plugin processes to complete...
2019/10/31 14:45:48 /home/vagrant/btp_base_image/packer_linux_amd64: plugin process exited
2019/10/31 14:45:48 /home/vagrant/btp_base_image/packer_linux_amd64: plugin process exited

SSH hadnshake failure in packer 1.8.6

I previously reported a similar bug here hashicorp/packer#11656 but since I couldn't comment there , I am opening up a new issue here.

Packer version: 1.8.6
Tested with: CentOS Stream 9 and Ubuntu 22.04

Error:

Error waiting for SSH: Packer experienced an authentication error when trying to connect via SSH. This can happen if your username/password are wrong. You may want to double-check your credentials as part of your debugging process. original error: ssh: handshake failed: ssh: unable to authenticate, attempted methods [none publickey], no supported methods remain

Packer log:

2023/04/25 12:12:55 ui: ==> openstack: Using SSH communicator to connect: xx.xx.xx.xx
2023/04/25 12:12:55 packer-builder-openstack plugin: [INFO] Waiting for SSH, up to timeout: 5m0s
2023/04/25 12:12:55 ui: ==> openstack: Waiting for SSH to become available...
2023/04/25 12:12:55 packer-builder-openstack plugin: [DEBUG] Using floating IP xx.xx.xx.xx to connect
2023/04/25 12:12:57 packer-builder-openstack plugin: [DEBUG] TCP connection to SSH ip/port failed: dial tcp xx.xx.xx.xx:22: connect: connection refused
2023/04/25 12:13:02 packer-builder-openstack plugin: [DEBUG] Using floating IP xx.xx.xx.xx to connect
2023/04/25 12:13:02 packer-builder-openstack plugin: [DEBUG] TCP connection to SSH ip/port failed: dial tcp xx.xx.xx.xx:22: connect: connection refused
2023/04/25 12:13:07 packer-builder-openstack plugin: [DEBUG] Using floating IP xx.xx.xx.xx to connect
2023/04/25 12:13:07 packer-builder-openstack plugin: [DEBUG] TCP connection to SSH ip/port failed: dial tcp xx.xx.xx.xx:22: connect: connection refused
2023/04/25 12:13:12 packer-builder-openstack plugin: [DEBUG] Using floating IP xx.xx.xx.xx to connect
2023/04/25 12:13:12 packer-builder-openstack plugin: [INFO] Attempting SSH connection to xx.xx.xx.xx:22...
2023/04/25 12:13:12 packer-builder-openstack plugin: [DEBUG] reconnecting to TCP connection for SSH

Workaround:
Adding the following in builder template works:
"temporary_key_pair_type": "ed25519"

Builder Openstack image_min_disk

This issue was originally opened by @possani as hashicorp/packer#9549. It was migrated here as a result of the Packer plugin split. The original body of the issue is below.


Overview of the Issue

Hi, I am trying to create a new image, but I am getting the following behavior:

When specifying the image_min_disk, I would expect to see what the description says, "Minimum disk size needed to boot image, in gigabytes"; instead, I am setting the disk size.

Screenshot from 2020-07-08 09-44-05

image_min_disk and image_min_ram are not available. Instead, the current option should be named image_size.

It also takes a very long time to save the image, maybe due to the image size.

Reproduction Steps

packer build template.json

Packer version

Packer v1.6.0

Simplified Packer Buildfile

{
    "builders": [
        {
            "type": "openstack",
            "ssh_username": "ubuntu",
            "image_name": "Ubuntu-18.04-LTS-bionic-packer",
            "image_min_disk": 20,
            "source_image_name": "Ubuntu-18.04-LTS-bionic",
            "insecure": "true",
            ...
            "use_blockstorage_volume": "true"
        }
    ]
}

Operating system and Environment details

NAME="Ubuntu"
VERSION="20.04 LTS (Focal Fossa)"

DomainID or DomainName validation is inconsistent

Overview of the Issue

Using hashicorp/packer container with a HCL file that contains token:

  • Setting domain_id (without domain_name) ask to remove it because is not required while using token
  • If neither domain_name or domain_id is used then error asking for one of them
  • If neither domain_name or domain_id is used but OS_DOMAIN_ID env var exported then is OK

Reproduction Steps

packer validate test.pkr.hcl

If domain_id = "default" + token = '...' then:

packer validate vault-raft.pkr.hcl
Error: 1 error(s) occurred:
* DomainID may not be provided when authenticating with a TokenID
  on vault-raft.pkr.hcl line 1:
  (source code not available)

If #domain_id = "default" = token = '...' then:

Error: 1 error(s) occurred:
* You must provide exactly one of DomainID or DomainName in a Scope with ProjectName
  on vault-raft.pkr.hcl line 1:
  (source code not available)

If #domain_id = "default" = token = '...' + export OS_DOMAIN_ID=default then:

The configuration is valid.

Plugin and Packer version

packer version
Packer v1.8.0

Simplified Packer Buildfile

test.pkr.hcl file:

source "openstack" "hello" {
  #domain_id                 = "default"
  token                     = "TheRealTokenWasHere"
  identity_endpoint         = "https://auth.cloud.ovh.net/v3"
  image_name                = "debian-hello-test"
  source_image_name         = "Debian 11"
  flavor                    = "s1-2"
  tenant_name               = "TheTenantNameWasHere"
  region                    = "GRA7"
  ssh_username              = "debian"
  networks                   = ["TheNetworkIdWasHere"]
}
build {
  sources = ["source.openstack.hello"]
  provisioner "shell" {
      execute_command = "sudo -S sh -c '{{ .Vars }} {{ .Path }}'"
      scripts         = fileset(".", "scripts/{install,secure}.sh")
  }
}

Operating system and Environment details

Docker image hashicorp/packer running in GitlabCI runner ignoring the entrypoint

Also tested in a Debian 11 laptop running the same Packer version.

Build fails with error "Resource not found" after Packer terminates the source server

Overview of the Issue

In v1.1.1 build fails just after Packer terminates the source server. The server is terminated but Packer returns the error "Error getting server to terminate: Resource not found".

Reproduction Steps

Simply run a build.

Plugin and Packer version

Packer version: 1.8.6
packer-plugin-openstack: v1.1.1

Simplified Packer Buildfile

This buildfile uses block storage volume but I have also tested with no volume and got the same result.

packer {
  required_plugins {
    openstack = {
      version = "1.1.1"
      source = "github.com/hashicorp/openstack"
    }
  }
}

source "openstack" "ol8" {
  username                 = "OS_USERNAME"
  password                 = "OS_PASSWORD"
  identity_endpoint        = "OS_AUTH_URL"
  tenant_id                = "OS_TENANT_ID"
  domain_id                = "OS_DOMAIN_ID"
  region                   = "OS_REGION_NAME"
  insecure                 = true
  source_image             = "xxxxxxxxxxxx"
  flavor                   = "xxxxxxxxxxx"
  config_drive             = true
  networks                 = local.networks
  use_blockstorage_volume  = true
  volume_size              = 20
  image_disk_format        = "qcow2"
  image_name               = "test"
  image_visibility         = "shared"
  image_min_disk           = 20
  ssh_username             = "cloud-user"
  instance_name            = local.instance_name
  ssh_read_write_timeout   = "5m"
}

build {
  name = "OL8 Custom Image"
  sources = ["source.openstack.ol8"]

  provisioner "shell" {
    remote_folder = "/home/cloud-user"
    inline = [
      "sudo timedatectl set-timezone UTC",
      "sudo dnf upgrade -y",
      "sudo reboot"
    ]
    expect_disconnect = true
  }

  provisioner "ansible" {
    pause_before       = "60s"
    galaxy_file        = var.galaxy_file
    playbook_file      = var.playbook_file
    use_proxy          = var.use_proxy  
    extra_arguments    = var.extra_arguments
  }
}

Operating system and Environment details

alpine 3.17.2

Log Fragments and crash.log files

Log

Openstack builder connects to wrong endpoint

This issue was originally opened by @JoelFeiner as hashicorp/packer#5201. It was migrated here as a result of the Packer plugin split. The original body of the issue is below.


I am attempting to build an image using the OpenStack provider. It ultimately fails at launching the server with the following message: "Error launching source server: Invalid request due to incorrect syntax or missing required parameters".

It is able to connect to the identity service, verify the flavor and set up the keypair (which might be a local thing).

One thing I am noticing is that tcpdump shows a lot of connections to ec2-54-235-77-197.compute-1.amazonaws.com, whereas when I launch the server with the nova client, there are none. I'm wondering if there's a hardcoded URL in Packer somewhere.

I'm unable to further debug this because Packer or the underlying library does not provide the response from the OpenStack server. From Googling, I see that this is simply not supported at the current juncture.

Packer 1.0.3
Ubuntu 17.04 64-bit
Build output: https://gist.github.com/JoelFeiner/7f7102e3324e4efc00980600217a07aa

Builder config in JSON file:

        {
            "type": "openstack",
            "flavor": "A1.2",
            "source_image": "7925b8a6-b439-4991-9adf-092a202ff16e",
            "ssh_username": "root",
            "networks": [ "bf7a7067-8739-4421-9a08-c940d7fd435d" ],
            "image_name": "{{user `image_type`}}-{{user `image_verson`}}"
        }

Environment variables set:
OS_AUTH_URL
OS_REGION_NAME
OS_IDENTITY_API_VERSION
OS_TENANT_NAME
OS_PASSWORD
OS_USERNAME

qcow2 image creation

Hi, I'm trying to create openstack qcow2 images using packer.
Everything goes well, the image was created and i was able to create instances using default opensztack options.

The problem is that the instanced launched using this image fail if created using --boot-from-volume in the command for the server creation openstack server create.

Error:
error: build of instance <instance-id> aborted: volume <volume-id> did not finish being created even after we waited 181 seconds or 19 attempts. and its status is error

This does not happen if the image is first created in raw format and then converted to qcow2 later using qemu-img convert.

{
    "builders": [
        {
            "type": "openstack",
            "username": "*****",
            "password": "******",
            "identity_endpoint": "******",
            "region": "<region>",
            "tenant_id": "<id>",
            "domain_name":"<domain-name>",
            "image_name": "centos7-packer-test",
            "ssh_username": "centos",
            "source_image": "<centos7-image-id>",
            "availability_zone": "nova",
            "flavor": "4",
            "ssh_ip_version": "4",
            "use_blockstorage_volume": "true",
            "volume_size": "10",
            "volume_availability_zone": "nova",
            "image_disk_format": "qcow2",
            "networks": [
                "<network-id>"
            ]
        }
    ],
    "provisioners": [
            {
                    "type": "shell",
                    "inline": ["sudo yum install -y vim"]
                    }

    ]
}

I wanted to ask, I need to set some additional variables in the json to enable the image to be launched using --boot-from-volume ? or is a error in the image format conversion in packer?

Verify checksums of images imported via external_source_image_url

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

Add verification of checksums for images imported via external URLs.

Potential configuration

external_source_image_url = "https://cloud.debian.org/images/cloud/bookworm/20231013-1532/debian-12-generic-amd64-20231013-1532.qcow2"
external_source_image_checksum = "b2ddc01e8d13dabbcfde6661541aae92219be2d442653950f0e44613ddebaeb80dc7a83e0202c5509c5e72f4bd1f4edee4c83f35191f2562b3f31e20e9e87ec2"

'ssh_agent_auth' and 'ssh_keypair_name' params doesnt work w/o 'ssh_private_key_file'

'ssh_agent_auth' and 'ssh_keypair_name' parameters not working as expected

The folowing param set

ssh_username = "<image user name>"
ssh_keypair_name = "<existing keypair name>"
ssh_agent_auth = true

creates VM without any keypair. As a result SSH-auth falls.
Adding the path to a completely random private key to the ssh_private_key_file parameter fixes this as a workaround (although it doesn't make sense)

Reproduction Steps

see above

Plugin and Packer version

Packer v1.7.8
packer-plugin-openstack_v1.0.0_x5.0_linux_amd64

Simplified Packer Buildfile

packer {
  required_plugins {
    openstack = {
      version = "1.0.0"
      source  = "github.com/hashicorp/openstack"
    }
  }
}
source "openstack" "centos8" {
  identity_endpoint =  "https://some.domain:13000"
  application_credential_id = var.openstack_app_credid
  application_credential_secret = var.openstack_app_secret
  
  source_image_name = "centos_8.4"
  image_name  = "centos_8.4_new"
  flavor = "Standard-2-4"
  networks = ["42692968-11a7-4010-b958-a03ee9f2431e"]
  use_blockstorage_volume = true

  # # Provision
  communicator = "ssh"
  ssh_username = "centos"
  ssh_keypair_name = "existed_key"
  # Uncomment following line for workaround fix
  #ssh_private_key_file = "/root/.ssh/id_rsa" 
  ssh_agent_auth = true
}

build {
  sources = ["source.vsphere-iso.centos8","source.openstack.centos8"]
  provisioner "shell" {
    environment_vars = var.shell_envs[*]
    use_env_var_file = true
    scripts          = fileset(".", "${path.root}/.build/scripts/*")
  }
}

Operating system and Environment details

docker.io/hashicorp/packer
x86_64

Log Fragments and crash.log files

2021/11/16 14:18:33 packer-provisioner-shell plugin: [INFO] Packer version: 1.7.8 [go1.17.2 linux amd64]
2021/11/16 14:18:33 packer-provisioner-shell plugin: [INFO] PACKER_CONFIG env var not set; checking the default config file path
2021/11/16 14:18:33 packer-provisioner-shell plugin: [INFO] PACKER_CONFIG env var set; attempting to open config file: /root/.packerconfig
2021/11/16 14:18:33 packer-provisioner-shell plugin: [WARN] Config file doesn't exist: /root/.packerconfig
2021/11/16 14:18:33 packer-provisioner-shell plugin: [INFO] Setting cache directory: /root/.cache/packer
2021/11/16 14:18:33 packer-provisioner-shell plugin: args: []string{"packer-provisioner-shell"}
2021/11/16 14:18:33 packer-provisioner-shell plugin: Plugin address: unix /tmp/packer-plugin3998114135
2021/11/16 14:18:33 packer-provisioner-shell plugin: Waiting for connection...
2021/11/16 14:18:33 Received unix RPC address for /usr/bin/packer: addr is /tmp/packer-plugin3998114135
2021/11/16 14:18:33 packer-provisioner-shell plugin: Serving a plugin connection...
2021/11/16 14:18:33 Build debug mode: false
2021/11/16 14:18:33 Force build: true
openstack.centos8: output will be in this color.
2021/11/16 14:18:33 On error:

2021/11/16 14:18:33 Waiting on builds to complete...
2021/11/16 14:18:33 Starting build run: openstack.centos8
2021/11/16 14:18:33 Running builder:
2021-11-16T14:18:33+03:00: ==> openstack.centos8: Loading flavor: Standard-2-4
2021/11/16 14:18:33 packer-plugin-openstack_v1.0.0_x5.0_linux_amd64 plugin: 2021/11/16 14:18:33 [INFO] Loading flavor by ID: Standard-2-4
2021/11/16 14:18:34 packer-plugin-openstack_v1.0.0_x5.0_linux_amd64 plugin: 2021/11/16 14:18:34 [ERROR] Failed to find flavor by ID: Resource not found
2021/11/16 14:18:34 packer-plugin-openstack_v1.0.0_x5.0_linux_amd64 plugin: 2021/11/16 14:18:34 [INFO] Loading flavor by name: Standard-2-4
2021-11-16T14:18:34+03:00:     openstack.centos8: Verified flavor. ID: 2a1f1c8a-32f4-498d-8594-a7146ac167bf
2021/11/16 14:18:34 packer-plugin-openstack_v1.0.0_x5.0_linux_amd64 plugin: 2021/11/16 14:18:34 Using Image Filters {ID: Limit:0 Marker: Name:centos_8.4 Visibility: MemberStatus: Owner: Status: SizeMin:0 SizeMax:0 Sort: SortKey: SortDir: Tags:[] CreatedAtQuery:<nil> UpdatedAtQuery:<nil> ContainerFormat: DiskFormat:}
2021-11-16T14:18:34+03:00: ==> openstack.centos8: Using SSH Agent for existing key pair existed_key
2021-11-16T14:18:34+03:00:     openstack.centos8: Found Image ID: ea5e0e16-809b-4faf-b96f-601804a79a78
2021-11-16T14:18:34+03:00: ==> openstack.centos8: Creating volume...
2021-11-16T14:18:35+03:00: ==> openstack.centos8: Waiting for volume packer_61939389-0b00-9f71-91bb-e06facfc4644 (volume id: 595ca0de-1b48-49d9-a46a-fc0e427f70a6) to become available...
2021/11/16 14:18:35 packer-plugin-openstack_v1.0.0_x5.0_linux_amd64 plugin: 2021/11/16 14:18:35 Waiting for volume creation status: creating
2021-11-16T14:18:37+03:00:     openstack.centos8: Volume ID: 595ca0de-1b48-49d9-a46a-fc0e427f70a6
2021-11-16T14:18:37+03:00: ==> openstack.centos8: Launching server...
2021-11-16T14:18:37+03:00: ==> openstack.centos8: Launching server...
2021-11-16T14:18:39+03:00:     openstack.centos8: Server ID: daae0e0f-0aa5-4043-ba88-0ef8d8989d7c
2021/11/16 14:18:39 packer-plugin-openstack_v1.0.0_x5.0_linux_amd64 plugin: 2021/11/16 14:18:39 server id: daae0e0f-0aa5-4043-ba88-0ef8d8989d7c
2021-11-16T14:18:39+03:00: ==> openstack.centos8: Waiting for server to become ready...
....
2021/11/16 14:20:56 packer-plugin-openstack_v1.0.0_x5.0_linux_amd64 plugin: 2021/11/16 14:20:56 [DEBUG] SSH handshake err: ssh: handshake failed: ssh: unable to authenticate, attempted methods [none publickey], no supported methods remain
2021/11/16 14:20:56 packer-plugin-openstack_v1.0.0_x5.0_linux_amd64 plugin: 2021/11/16 14:20:56 [DEBUG] Detected authentication error. Increasing handshake attempts.
2021-11-16T14:20:56+03:00: ==> openstack.centos8: Error waiting for SSH: Packer experienced an authentication error when trying to connect via SSH. This can happen if your username/password are wrong. You may want to double-check your credentials as part of your debugging process. original error: ssh: handshake failed: ssh: unable to authenticate, attempted methods [none publickey], no supported methods remain

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.