XCP-ng
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Register
    • Login
    1. Home
    2. wezke
    3. Posts
    W
    Offline
    • Profile
    • Following 0
    • Followers 0
    • Topics 2
    • Posts 12
    • Groups 0

    Posts

    Recent Best Controversial
    • RE: packer template Vdisk issue

      @AtaxyaNetwork
      Glad i can help and give back to the community

      posted in Infrastructure as Code
      W
      wezke
    • RE: packer template Vdisk issue

      @AtaxyaNetwork

      Finaly got a Windows Server 2022 packer template to work with xen server guest tools.

      autounattend.xml in the root dir of the iso along with the guest tool .msi

      https://www.xenserver.com/downloads

      autounattend .txt

      windows server.txt

      posted in Infrastructure as Code
      W
      wezke
    • RE: packer template Vdisk issue

      @AtaxyaNetwork
      Do you mean the actual packer pkr.hcl fiel or the unattented.xml?

      I still need to figure the actual packer file out, hoping it wil be quite similar.

      i do have an windows server unattended.xml that works with proxmox, just will have to slightly adjust.

      however i can share both when im done with it

      posted in Infrastructure as Code
      W
      wezke
    • RE: packer template Vdisk issue

      @AtaxyaNetwork

      That did solve the problem, guess the 386 is the 32bit version, doh!

      succeeded making debian template with packer, now on to the windows server 2022 template

      posted in Infrastructure as Code
      W
      wezke
    • RE: packer template Vdisk issue

      @AtaxyaNetwork Again, thank you for youre time

      i will test the amd64 builder, thats a good suggestion, hopefully that wil solve the issue.

      I also have an issue with the memory config, it will only take 1gb memory.

      perhaps there is an limitation or problem with the windows 386 version

      i will let you know the outcome

      posted in Infrastructure as Code
      W
      wezke
    • RE: packer template Vdisk issue

      packer_log.txt

      Hi, i have added a log file.

      would it matter if i run this on an ssd or not?

      posted in Infrastructure as Code
      W
      wezke
    • RE: packer template Vdisk issue

      @AtaxyaNetwork

      Thank you for testing

      i will (after working hours) deploy again and show the trace.

      i have been testing with different disk size values and on my side anything higher than 2000mb fails back to 2mib.

      at least i know its not the template but something else causing this. i wonder what..
      i do have enough diskspace left so thats not the issue.

      posted in Infrastructure as Code
      W
      wezke
    • RE: packer template Vdisk issue
      packer {
        required_plugins {
          xenserver = {
            version = "= v0.7.3"
            source  = "github.com/ddelnano/xenserver"
          }
        }
      }
      variable "remote_host" {
        type        = string
        description = "The ip or fqdn of your XCP-ng. It must be the master"
        sensitive   = true
        default     = "ip"
      }
      
      variable "remote_username" {
        type        = string
        description = "The username used to interact with your XCP-ng"
        sensitive   = true
        default     = "name"
      }
      
      variable "remote_password" {
        type        = string
        description = "The password used to interact with your XCP-ng"
        sensitive   = true
        default     = "pwd"
      }
      
      variable "sr_iso_name" {
        type        = string
        description = "The ISO-SR to packer will use"
        default     = "ISO"
      }
      
      variable "sr_name" {
        type        = string
        description = "The name of the SR to packer will use"
        default     = "Local storage"
      }
      
      
      source "xenserver-iso" "debian12" {
        iso_checksum = "ee8d8579128977d7dc39d48f43aec5ab06b7f09e1f40a9d98f2a9d149221704a"
        iso_url      = "https://cdimage.debian.org/debian-cd/current/amd64/iso-cd/debian-12.10.0-amd64-netinst.iso"
      
        sr_iso_name    = var.sr_iso_name
        sr_name        = var.sr_name
        tools_iso_name = ""
      
        remote_host     = var.remote_host
        remote_password = var.remote_password
        remote_username = var.remote_username
      
        http_directory = "http"
        ip_getter      = "tools"
      
        boot_command = [
          "<wait><wait><wait><esc><wait><wait><wait>",
          "/install.amd/vmlinuz ",
          "initrd=/install.amd/initrd.gz ",
          "auto=true ",
          "domain= ",
          "url=http://{{.HTTPIP}}:{{.HTTPPort}}/preseed.cfg ",
          "hostname=debian ",
          "interface=auto ",
          "vga=788 noprompt quiet--- <enter>"
        ]
      
        # Change this to match the ISO of debian you are using in the iso_url variable
        clone_template  = "Debian Bookworm 12"
        vm_name         = "Debian 12 template"
        vm_description  = "My first template with packer"
        vcpus_max       = 2
        vcpus_atstartup = 2
        vm_memory       = 1024 #MB
        network_names   = ["eth0"]
        disk_size       = 20480 #MB
        disk_name       = "debian disk"
        vm_tags         = ["Generated by Packer"]
      
        ssh_username           = "debian"
        ssh_password           = "debian"
        ssh_wait_timeout       = "60000s"
        ssh_handshake_attempts = 10000
      
        output_directory = "packer-debian-12"
        keep_vm          = "never"
        format           = "xva_compressed"
      }
      
      build {
        sources = ["xenserver-iso.debian12"]
      }
      
      posted in Infrastructure as Code
      W
      wezke
    • packer template Vdisk issue

      hi, im am trying to use terraform and packer with xcp-ng

      i am running into an issue with the disk only containing 2mb instead of 20gb
      [15:12]
      i am using the packer template as per blog post
      https://xcp-ng.org/blog/2024/02/22/using-packer-with-xcp-ng/
      XCP-ng Blog
      Using Packer with XCP-ng
      Discover how to keep your VM templates always up-to-date and ready to go!

      posted in Infrastructure as Code
      W
      wezke
    • RE: XO and terraform

      @Cyrille

      ive made the template from running an Windows 2022 from my iso storage untill initial process was installed, shutdown the vm and created a template.

      Edit: you are correct, using a builtin template has no issue's.
      going to solve that problem first 🙂

      thank you for the support

      posted in Infrastructure as Code
      W
      wezke
    • RE: XO and terraform

      @nathanael-h

      changed block provider to the latest version

      terraform {
        required_providers {
          xenorchestra = {
            source  = "vatesfr/xenorchestra"
            version = "0.29.0"
          }
        }
      }
      

      acts just the same way i must say.

      posted in Infrastructure as Code
      W
      wezke
    • XO and terraform

      hi guys

      im rather new to XCP and Terraform.

      I am an adult student in system and network engineering (last year) and for my project i have chosen to deploy VMs with terraform. configuring with most likely ansible.

      So far i am able to deploy a VM however at first run of my ''playbook'' it creates the VM and no disk is being created. second run the disk is created and attached but in a diconnected state.

      then i need to shut down the VM in XO and run my terraform template once again, the VM is being powered on and the disk is connected.

      im not sure what causes this behaviour.

      here is my current template.

      here is my current template.

      terraform {
        required_providers {
          xenorchestra = {
            source  = "terra-farm/xenorchestra"
            version = "~> 0.26.0"
          }
        }
      }
      
      provider "xenorchestra" {
        url      = "wss://"my_xo_ip"
        username = "myusername"
        password = "Mypassword"
        insecure = true
      }
      
      # Fetch the template
      data "xenorchestra_template" "vm_template" {
        name_label = "Terraform_Template_Win_Core"
      }
      
      # Fetch the network
      data "xenorchestra_network" "network" {
        name_label = "eth0"
      }
      
      # Fetch the storage repository
      data "xenorchestra_sr" "sr" {
        name_label = "Local storage"
      }
      
      # Create the VM with explicit dependency on the storage repository
      resource "xenorchestra_vm" "vm1" {
        name_label = "terraform_VM"
        template   = data.xenorchestra_template.vm_template.id
        cpus       = 2
        memory_max = 4294967296
      
        # Network configuration
        network {
          network_id = data.xenorchestra_network.network.id
        }
      
        # Disk configuration with explicit dependency on storage repository
        disk {
          sr_id      = data.xenorchestra_sr.sr.id
          size       = 10737418240
          name_label = "VM root volume"
        }
      
        # CD-ROM configuration
        cdrom {
          id = "09ab237e-9a35-4d88-b787-24c1b6fa7779"
        }
      
        # Automatically power on the VM
        power_state = "Running"
      
        # Ensure the VM depends on the successful creation of the storage repository
        depends_on = [data.xenorchestra_sr.sr]
      }
      

      its also suboptimal as i then would need to run the windows ISO from the XO console..

      any tips would be greatly appreciated.

      posted in Infrastructure as Code
      W
      wezke