Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Openstack plugin not working #12951

Closed
Teddyhoang opened this issue May 2, 2024 · 2 comments
Closed

Openstack plugin not working #12951

Teddyhoang opened this issue May 2, 2024 · 2 comments
Labels

Comments

@Teddyhoang
Copy link

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 other comments that do not add relevant new information or questions, 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

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 have a simple build file to create a image in openstack provider but i get source code not available errors from usage in a source block

Reproduction Steps

I create 2 file:

  • build file
  • define variable file

Then 1 have a file to declare variable

First i run packer init to download 2 plugin:

  • packer-plugin-openstack_v1.1.2_x5.0_linux_amd64
  • packer-plugin-ansible_v1.1.1_x5.0_linux_amd64

Then i run the packer build command with the declare variable file

Packer version

packer version 1.10.1-1

Simplified Packer Template

The build file:


/*
    DESCRIPTION:
    Ubuntu Server 20.04 LTS template using the Packer Builder for Openstack provider.
*/

//  BLOCK: packer
//  The Packer configuration.

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

//  BLOCK: locals
//  Defines the local variables.

locals {
  build_version     = formatdate("YY.MM.DD_hh.mm", timestamp())
  vm_name           = "ubuntu-20-04-gardener"
}

//  BLOCK: source
//  Defines the builder configuration blocks.

source "openstack" "linux-ubuntu" {
  
  // Openstack Credentials and Endpoint URL
  identity_endpoint             = var.os_url_endpoint
  endpoint_type                 = var.os_endpoint_type
  application_credential_id     = var.os_credential_id
  application_credential_secret = var.os_credential_secret
  insecure                      = var.os_insecure_connection

  // VM Settings
  region                  = var.os_region_name
  availability_zone       = var.vm_zone
  image_name              = local.vm_name
  source_image_name       = var.vm_source_image
  volume_size             = var.vm_disk_size
  flavor                  = var.vm_flavor_name
  networks                = [var.vm_network_id]

  // Boot and Provisioning Settings
  user_data = templatefile("${abspath(path.root)}/data/user-data.pkrtpl.hcl", {
      build_password          = var.build_password
  })

  // Communicator Settings
  communicator        = "ssh"
  ssh_username        = "root"
  ssh_password        = var.build_password
  ssh_port            = var.communicator_port
  ssh_timeout         = var.communicator_timeout
  pause_before_connecting = "1m"

  ssh_proxy_host      = var.communicator_proxy_host
  ssh_proxy_port      = var.communicator_proxy_port
  ssh_proxy_username  = var.communicator_proxy_username
  ssh_proxy_password  = var.communicator_proxy_password
}

//  BLOCK: build
//  Defines the builders to run, provisioners, and post-processors.

build {
  sources = ["source.openstack.linux-ubuntu"]

  provisioner "ansible" {
    user          = "root"
    playbook_file = "${path.cwd}/ansible/main.yml"
    roles_path    = "${path.cwd}/ansible/roles"
    ansible_env_vars = [
      "ANSIBLE_CONFIG=${path.cwd}/ansible/ansible.cfg"
    ]
    extra_arguments = [
      "--extra-vars", "display_skipped_hosts=false",
      "--extra-vars", "BUILD_USERNAME=${var.build_username}",
      "--extra-vars", "BUILD_PASSWORD_ENCRYPTED='${var.build_password_encrypted}'",
      "--extra-vars", "ANSIBLE_USERNAME=root",
      "--extra-vars", "ANSIBLE_SECRET='${var.build_key}'",
      "--skip-tags", "path",
    ]
  }
}

Operating system and Environment details

Ubuntu 20.04.6 LTS

Log Fragments and crash.log files

I run the command PACKER_LOG=1 packer validate --only openstack.linux-ubuntu -var-file=config/build.pkrvars.hcl builds/linux/ubuntu/20-04-lts/. and its show


2024/05/02 15:44:45 [INFO] Packer version: 1.10.1 [go1.20.12 linux amd64]
2024/05/02 15:44:45 [TRACE] discovering plugins in /usr/bin
2024/05/02 15:44:45 [TRACE] discovering plugins in .
2024/05/02 15:44:45 [TRACE] discovering plugins in /root/.config/packer/plugins
2024/05/02 15:44:45 [INFO] Discovered potential plugin: ansible = /root/.config/packer/plugins/github.com/hashicorp/ansible/packer-plugin-ansible_v1.1.1_x5.0_linux_amd64
2024/05/02 15:44:45 [INFO] Discovered potential plugin: openstack = /root/.config/packer/plugins/github.com/hashicorp/openstack/packer-plugin-openstack_v1.1.1_x5.0_linux_amd64
2024/05/02 15:44:45 [INFO] Discovered potential plugin: openstack = /root/.config/packer/plugins/github.com/hashicorp/openstack/packer-plugin-openstack_v1.1.2_x5.0_linux_amd64
2024/05/02 15:44:45 found external [-packer-default-plugin-name- local] provisioner from ansible plugin
2024/05/02 15:44:46 [INFO] found external [-packer-default-plugin-name-] builders from openstack plugin
2024/05/02 15:44:46 [INFO] PACKER_CONFIG env var not set; checking the default config file path
2024/05/02 15:44:46 [INFO] PACKER_CONFIG env var set; attempting to open config file: /root/.packerconfig
2024/05/02 15:44:46 [WARN] Config file doesn't exist: /root/.packerconfig
2024/05/02 15:44:46 [INFO] Setting cache directory: /root/.cache/packer
2024/05/02 15:44:46 [TRACE] listing potential installations for "github.com/hashicorp/openstack" that match "= 1.1.2". plugingetter.ListInstallationsOptions{FromFolders:[]string{"/usr/bin", ".", "/root/.config/packer/plugins"}, BinaryInstallationOptions:plugingetter.BinaryInstallationOptions{APIVersionMajor:"5", APIVersionMinor:"0", OS:"linux", ARCH:"amd64", Ext:"", Checksummers:[]plugingetter.Checksummer{plugingetter.Checksummer{Type:"sha256", Hash:(*sha256.digest)(0xc000464980)}}}}
2024/05/02 15:44:46 [TRACE] version "v1.1.1" of file "/root/.config/packer/plugins/github.com/hashicorp/openstack/packer-plugin-openstack_v1.1.1_x5.0_linux_amd64" does not match constraint "= 1.1.2"
2024/05/02 15:44:46 [TRACE] Found the following "github.com/hashicorp/openstack" installations: [{/root/.config/packer/plugins/github.com/hashicorp/openstack/packer-plugin-openstack_v1.1.2_x5.0_linux_amd64 v1.1.2}]
2024/05/02 15:44:46 [INFO] found external [-packer-default-plugin-name-] builders from openstack plugin
2024/05/02 15:44:46 [TRACE] listing potential installations for "github.com/hashicorp/ansible" that match ">= 1.1.1". plugingetter.ListInstallationsOptions{FromFolders:[]string{"/usr/bin", ".", "/root/.config/packer/plugins"}, BinaryInstallationOptions:plugingetter.BinaryInstallationOptions{APIVersionMajor:"5", APIVersionMinor:"0", OS:"linux", ARCH:"amd64", Ext:"", Checksummers:[]plugingetter.Checksummer{plugingetter.Checksummer{Type:"sha256", Hash:(*sha256.digest)(0xc000464980)}}}}
2024/05/02 15:44:46 [TRACE] Found the following "github.com/hashicorp/ansible" installations: [{/root/.config/packer/plugins/github.com/hashicorp/ansible/packer-plugin-ansible_v1.1.1_x5.0_linux_amd64 v1.1.1}]
2024/05/02 15:44:46 found external [-packer-default-plugin-name- local] provisioner from ansible plugin
2024/05/02 15:44:46 [TRACE] validateValue: not active for build_password_encrypted, so skipping
2024/05/02 15:44:46 [TRACE] validateValue: not active for build_key, so skipping
2024/05/02 15:44:46 [TRACE] validateValue: not active for os_insecure_connection, so skipping
2024/05/02 15:44:46 [TRACE] validateValue: not active for os_region_name, so skipping
2024/05/02 15:44:46 [TRACE] validateValue: not active for communicator_proxy_password, so skipping
2024/05/02 15:44:46 [TRACE] validateValue: not active for communicator_port, so skipping
2024/05/02 15:44:46 [TRACE] validateValue: not active for communicator_timeout, so skipping
2024/05/02 15:44:46 [TRACE] validateValue: not active for build_username, so skipping
2024/05/02 15:44:46 [TRACE] validateValue: not active for vm_guest_os_timezone, so skipping
2024/05/02 15:44:46 [TRACE] validateValue: not active for vm_disk_size, so skipping
2024/05/02 15:44:46 [TRACE] validateValue: not active for os_credential_secret, so skipping
2024/05/02 15:44:46 [TRACE] validateValue: not active for communicator_proxy_host, so skipping
2024/05/02 15:44:46 [TRACE] validateValue: not active for os_credential_id, so skipping
2024/05/02 15:44:46 [TRACE] validateValue: not active for communicator_proxy_port, so skipping
2024/05/02 15:44:46 [TRACE] validateValue: not active for vm_guest_os_language, so skipping
2024/05/02 15:44:46 [TRACE] validateValue: not active for vm_zone, so skipping
2024/05/02 15:44:46 [TRACE] validateValue: not active for vm_source_image, so skipping
2024/05/02 15:44:46 [TRACE] validateValue: not active for vm_flavor_name, so skipping
2024/05/02 15:44:46 [TRACE] validateValue: not active for os_endpoint_type, so skipping
2024/05/02 15:44:46 [TRACE] validateValue: not active for build_password, so skipping
2024/05/02 15:44:46 [TRACE] validateValue: not active for vm_guest_os_keyboard, so skipping
2024/05/02 15:44:46 [TRACE] validateValue: not active for vm_network_id, so skipping
2024/05/02 15:44:46 [TRACE] validateValue: not active for os_url_endpoint, so skipping
2024/05/02 15:44:46 [TRACE] validateValue: not active for communicator_proxy_username, so skipping
2024/05/02 15:44:46 [INFO] Starting external plugin /<sensitive>/.config/packer/plugins/github.com/hashicorp/openstack/packer-plugin-openstack_v1.1.2_x5.0_linux_amd64 start builder -packer-default-plugin-name-
2024/05/02 15:44:46 Starting plugin: /<sensitive>/.config/packer/plugins/github.com/hashicorp/openstack/packer-plugin-openstack_v1.1.2_x5.0_linux_amd64 []string{"/<sensitive>/.config/packer/plugins/github.com/hashicorp/openstack/packer-plugin-openstack_v1.1.2_x5.0_linux_amd64", "start", "builder", "-packer-default-plugin-name-"}
2024/05/02 15:44:46 Waiting for RPC address for: /<sensitive>/.config/packer/plugins/github.com/hashicorp/openstack/packer-plugin-openstack_v1.1.2_x5.0_linux_amd64
2024/05/02 15:44:46 Received unix RPC address for /<sensitive>/.config/packer/plugins/github.com/hashicorp/openstack/packer-plugin-openstack_v1.1.2_x5.0_linux_amd64: addr is /tmp/packer-plugin3617312075
2024/05/02 15:44:46 packer-plugin-openstack_v1.1.2_x5.0_linux_amd64 plugin: 2024/05/02 15:44:46 Plugin address: unix /tmp/packer-plugin3617312075
2024/05/02 15:44:46 packer-plugin-openstack_v1.1.2_x5.0_linux_amd64 plugin: 2024/05/02 15:44:46 Waiting for connection...
2024/05/02 15:44:46 packer-plugin-openstack_v1.1.2_x5.0_linux_amd64 plugin: 2024/05/02 15:44:46 Serving a plugin connection...
2024/05/02 15:44:46 packer-plugin-openstack_v1.1.2_x5.0_linux_amd64 plugin: 2024/05/02 15:44:46 [TRACE] starting builder -packer-default-plugin-name-

* Resource not found

  on builds/linux/ubuntu/20-04-lts/linux-ubuntu.pkr.hcl line 34:
  (source code not available)

Error: 1 error(s) occurred:

* Resource not found

  on builds/linux/ubuntu/20-04-lts/linux-ubuntu.pkr.hcl line 34:
  (source code not available)


2024/05/02 15:44:46 [INFO] (telemetry) Finalizing.
2024/05/02 15:44:47 waiting for all plugin processes to complete...
2024/05/02 15:44:47 /<sensitive>/.config/packer/plugins/github.com/hashicorp/openstack/packer-plugin-openstack_v1.1.2_x5.0_linux_amd64: plugin process exited

@Teddyhoang
Copy link
Author

There was a declare error on my side of configuration. Sorry for this

Copy link

github-actions bot commented Jun 3, 2024

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.
If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jun 3, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

1 participant