packer-plugin-openstack
packer-plugin-openstack copied to clipboard
'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