Problem with cloudstack and packer is that packer is not able to send keyboard 
commands to the instance at the moment. There is no boot_command functionality 
within the cloudstack packer plugin.
After starting packer build you need to go to the vm console and do install 
steps manually.
We are working right now to implement this feature to the plugin, so packer is 
able to perform a fully automated template creation.

First step is to implement new api createConsoleEndpoint to cloudstack-go 
package. Pull request is here:
https://github.com/apache/cloudstack-go/pull/78

After that we should be able to use this to send keyboard commands to the 
instance.

Regards,
Swen

-----Ursprüngliche Nachricht-----
Von: Kiran Chavala <kiran.chav...@shapeblue.com> 
Gesendet: Donnerstag, 7. März 2024 11:42
An: users@cloudstack.apache.org
Betreff: Re: packer cloudstack

Hi Francisco

Please find the sample template I had created for cloudstack


https://developer.hashicorp.com/packer/integrations/hashicorp/cloudstack/latest/components/builder/cloudstack#basic-example


https://github.com/kiranchavala/cloudstack-marketplace-templates

https://github.com/kiranchavala/cloudstack-marketplace-templates/blob/main/docker-22-04.pkr.hcl



Other useful links
https://github.com/MissionCriticalCloud/bubble-templates-packer
https://github.com/PCextreme/packer-templates

Regards
Kiran

From: Francisco Arencibia Quesada <arencibia.franci...@gmail.com>
Date: Thursday, 7 March 2024 at 4:03 PM
To: users@cloudstack.apache.org <users@cloudstack.apache.org>
Subject: packer cloudstack
Good morning guys,

I'm  using packer, and I'm having some issues, I can't find many examples 
online, at least for cloudstack. Do you guys have any template working to point 
me in the right direction? My file complains about the boot_command
option:

source "cloudstack" "example" {
api_url = "http://X.X.X.X:8080/client/api";
api_key = "XXXXXXX"
secret_key = "XXXXXXX"
disk_offering = "Standard Custom"
disk_size = "20"
hypervisor = "XenServer"
network = "test-packer"
service_offering = "4-8"
source_iso = "Ubuntu 22.04.1 live server amd64"
zone = "EU-MAD1"
ssh_username = "user"
ssh_password = "packer"
template_name = "Ubuntu22.04.1-XCP-Packer"
template_display_text = "ubuntu-22.04.1-XCP-Packer"
template_featured = true
template_password_enabled = true
template_scalable = true
template_os = "Other PV (64-bit)"
http_directory = "http"
http_port_min = 8000
http_port_max = 8099
boot_command = [
"<esc><esc><enter><wait>",
"linux /install/vmlinuz noapic ",
"preseed/url=http://{{ .HTTPIP }}:{{ .HTTPPort }}/preseed.cfg ", 
"debian-installer=en_US auto locale=en_US kbd-chooser/method=us ", "hostname={{ 
user `Name` }} ", "fb=false debconf/frontend=noninteractive ", 
"keyboard-configuration/modelcode=SKIP keyboard-configuration/layout=USA ", 
"keyboard-configuration/variant=USA console-setup/ask_detect=false ", 
"initrd=/install/initrd.gz -- <enter>"
]

}

build {
sources = ["source.cloudstack.example"]

}



pressed.cfg

### set locales
d-i debian-installer/locale string en_US.UTF-8 d-i 
keyboard-configuration/xkb-keymap select us

### Network configuration
d-i netcfg/choose_interface select auto
d-i netcfg/get_hostname string ubuntu
d-i netcfg/get_domain string localdomain

### Ubuntu mirrors
d-i mirror/country string manual
d-i mirror/http/hostname string archive.ubuntu.com d-i mirror/http/directory 
string /ubuntu d-i mirror/http/proxy string

### credentials
d-i passwd/user-fullname string Ubuntu User d-i passwd/username string ubuntu 
d-i passwd/user-password password ubuntu d-i passwd/user-password-again 
password ubuntu d-i user-setup/allow-password-weak boolean true d-i 
user-setup/encrypt-home boolean false

### Timezone configuration
d-i clock-setup/utc boolean true
d-i time/zone string UTC

### Disk partitioning
d-i partman-auto/method string regular
d-i partman-auto/choose_recipe select atomic

d-i partman-partitioning/confirm_write_new_label boolean true d-i 
partman/choose_partition select finish d-i partman/confirm boolean true d-i 
partman/confirm_nooverwrite boolean true

### base system
d-i base-installer/kernel/override-image string linux-server

### Automatic updates
d-i pkgsel/update-policy select none

### Software selection
tasksel tasksel/first multiselect standard d-i pkgsel/include string 
openssh-server

### GRUB install
d-i grub-installer/only_debian boolean true d-i grub-installer/with_other_os 
boolean true

### Finish installation
d-i finish-install/reboot_in_progress note




Thank you all in advance
Regards

--
*Francisco Arencibia Quesada.*
*DevOps Engineer*

 



Reply via email to