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

    Posts

    Recent Best Controversial
    • RE: Automating VM creation via Terraform

      @newknowledge Thanks, I'll try it out later.

      posted in Xen Orchestra
      E
      eperez539
    • RE: Created cloud config, but can't select it when creating a new VM.

      @olivierlambert I see the drive attached to the new VM but it is not mounted. After mounting, I can see the contents of cloud-init config and everything looks ok unless I missed something:

      drwxr-xr-x  3 root root 16384 Jan  1  1970 ./
      drwxr-xr-x 24 root root  4096 May 22 18:58 ../
      -rwxr-xr-x  1 root root    50 May 22 18:54 meta-data*
      -rwxr-xr-x  1 root root   104 May 22 18:54 network-config*
      drwxr-xr-x  3 root root  2048 May 22 18:54 openstack/
      -rwxr-xr-x  1 root root   469 May 22 18:54 user-data*
      root@cloudbase:/mnt# cat user-data
      #cloud-config
      hostname: testingtheothertime0
      timezone: America/New_York
      package_update: true
      package_upgrade: true
      packages:
        - htop
        - tree
        - vim
        - ffmpeg
      write_files:
        - content: |
          network:
            ethernets:
              eth0:
                addresses:
                  - 192.168.0.22/24
            gateway4: 192.168.0.1
            nameservers:
              addresses:
                - 192.168.0.1
          version: 2
          path: /etc/netplan/00-installer-config.yaml
      runcmd:
        - [ netplan, apply ]
      root@cloudbase:/mnt# cat network-config
      #network:
      #  version: 1
      #  config:
      #  - type: physical
      #    name: eth0
      #    subnets:
      #      - type: dhcproot@cloudbase:/mnt#
      root@cloudbase:/mnt# cat meta-data
      instance-id: 3824858a-0679-2863-5416-e03640479e8c
      root@cloudbase:/mnt#
      
      

      From the cloud config, the packages were not installed. Also, tried the do the networking in different ways but nothing worked.

      posted in Xen Orchestra
      E
      eperez539
    • RE: Created cloud config, but can't select it when creating a new VM.

      @MrMike nope, not working.

      • Created VM
      • Installed guest-tools
      • Installed cloud init, cloud-initramfs-growroot
      • Updated /etc/cloud/cloud.cfg
      • Updated /usr/lib/cloud-init/ds-identify with lines given above
      • Created template
      • Created new vm from template using cloud init config on XO
      • New VM has nothing from the cloud init config...

      I could see how you could tweak the /etc/cloud/cloud.cfg with the users, etc. But cloud.cfg should have minimal settings on it. All the settings and configuration should come from the cloud init config in XO.

      posted in Xen Orchestra
      E
      eperez539
    • RE: Created cloud config, but can't select it when creating a new VM.

      @MrMike Great, thanks. I'll try this out.

      posted in Xen Orchestra
      E
      eperez539
    • RE: Created cloud config, but can't select it when creating a new VM.

      @MrMike could you please post the changes to ds-identity file? Also, I don't see the /usr/lib/cloud-init/ds-identify.ORIGINAL file. Is this something that gets created after the new VM is created?

      posted in Xen Orchestra
      E
      eperez539
    • RE: Created cloud config, but can't select it when creating a new VM.

      @geek-baba oh ok, so are you bypassing cloud init altogether? How do you handle the network config? I was hoping to at least setup network + ssh key and then I could mange with Ansible after that.

      Initially tried using Terraform with XO, but this cloud init issue may be the problem why I was having an issue getting them to work together.

      posted in Xen Orchestra
      E
      eperez539
    • RE: Created cloud config, but can't select it when creating a new VM.

      @geek-baba Thanks, do you happen to have some steps on the additional changes you made to the VM before converting in to the template?

      posted in Xen Orchestra
      E
      eperez539
    • RE: Created cloud config, but can't select it when creating a new VM.

      @olivierlambert just tried to go through the process again from what the example gave. Included the extra lines you mentioned above for the datasource. But it is still not seeing any of the custom cloud init settings that I configured.

      Is the template VM somehow badly configured? Is there anything on here that is outdated: https://xen-orchestra.com/blog/centos-cloud-template-for-xenserver/

      I'll continue debugging this issue but would be nice to have a guide on how to make cloud init work. Seems like there is something either missing or not working on the current guide (maybe XO bug?).

      Looking at the docs again, seems like the cloud-init config didn't really work:

      Hostname is set to: cloudtest

      200ec739-6000-417d-bbc2-01752045e728-image.png

      Result (host name is not correct )

      f6e92cac-7372-4432-8878-cd341f499d61-image.png

      posted in Xen Orchestra
      E
      eperez539
    • RE: Created cloud config, but can't select it when creating a new VM.

      @olivierlambert Seems like the cloud init config that gets run is the one under:

      /var/lib/cloud/seed/nocloud-net/user-data
      

      Have checked all the different logs and there is nothing about the custom cloud-init config that I selected during VM creation using XenOrchestra.

      posted in Xen Orchestra
      E
      eperez539
    • RE: Created cloud config, but can't select it when creating a new VM.

      @olivierlambert I tried it with Ubuntu 18.04 and installed cloud init when creating the template.

      posted in Xen Orchestra
      E
      eperez539
    • RE: Created cloud config, but can't select it when creating a new VM.

      @olivierlambert Created a VM template and installed cloud init as the link you sent suggested. But the cloud init file is not being read Xen Orchestra or none of the cloud init settings are actually being set on the new VM.

      Is there anything that I need to do on the template VM that is not there in the guide? I followed this link for creating the template: https://xen-orchestra.com/blog/centos-cloud-template-for-xenserver/

      When I create a new vm, and select a custom cloud init config. It doesn't do anything on the new vm. Here is my custom cloud-init config:

      #cloud-config
      timezone: America/New_York
      hostname: testing
      packages:
        - htop
        - tree
      package_update: true
      package_upgrade: true
      

      The hostname is the same as the template hostname.

      posted in Xen Orchestra
      E
      eperez539
    • Created cloud config, but can't select it when creating a new VM.

      Created a cloud config under settings > cloud configs.

      When creating a new VM, I'm unable to select the specific cloud config. Opened the advanced settings, and still no choice for selecting a cloud config.

      5851622e-a4a8-4bcb-a43d-cd7ad349bc74-image.png

      When creating the VM:

      d9ad316b-2ff7-49f7-aeb6-47e22bd2d63d-image.png

      b5345a0d-ed6f-49eb-9da8-6117277dbdff-image.png

      Where exactly can I select the cloud config when creating a new VM?

      posted in Xen Orchestra
      E
      eperez539
    • RE: Automating VM creation via Terraform

      @julien-f Yes, I had the xcp-ng host ip instead of XO ip. After changing that, getting different error now:

      Error: jsonrpc2: code -32000 message: unknown error from the peer
      
        on main.tf line 53, in resource "xenorchestra_vm" "base":
        53: resource "xenorchestra_vm" "base" {
      
      

      Here is what my tf file looks like:

      provider "xenorchestra" {
        url = "ws://XO_IP_HERE"
        username = "USERNAME"
        password = "PASSWORD"
      }
      
      data "xenorchestra_template" "template" {
        name_label = "Ubuntu Bionic Beaver 18.04"
      }
      
      data "xenorchestra_pif" "pif" {
        device = "eth0"
        vlan = -1
      }
      
      resource "xenorchestra_cloud_config" "base" {
        name = "cloudconfig"
        template = <<EOF
      #cloud-init
      tiemzone: America/New_York
      hostname: terraformtest
      package_update: true
      package_upgrade: true
      users:
        - name: test
          gecos: Test User
          groups: sudo
          passwd: test
          sudo: ['ALL=(ALL) NOPASSWD:ALL']
      
      network:
        version: 2
        ethernets:
          eno1:
            dhcp4: no
            addresses: [192.168.0.40/24]
            gateway4: 192.168.0.1
            nameservers:
               addresses: [192.168.0.1]
      
      runcmd:
       - [ ls, -l, / ]
       - [ sh, -xc, "echo $(date) ': hello world!'" ]
       - [ sh, -c, echo "=========hello world'=========" ]
       - ls -l /root
      EOF
      }
      
      resource "xenorchestra_vm" "base" {
          memory_max = 1073733632
          cpus  = 2
          cloud_config = "${xenorchestra_cloud_config.base.template}"
          name_label = "TerraformVM"
          name_description = "Created by Terraform Script"
          template = "${data.xenorchestra_template.template.id}"
          network {
      	    network_id = "${data.xenorchestra_pif.pif.network}"
          }
      
          disk {
            sr_id = "388ccc18-9b21-22cc-dfa9-db4c8c3a4959"
            name_label = "Terraform_disk_imavo"
            size = 32212254720
          }
      }
      
      

      Do you happen to see what I'm doing wrong here? Thanks

      posted in Xen Orchestra
      E
      eperez539
    • Automating VM creation via Terraform

      I'm starting to use Terraform to provision new vms and followed the configuration from the xenorchestra provider for Terraform:
      https://terra-farm.github.io/provider-xenorchestra/index.html
      but running into following issue:

      Error: websocket: bad handshake
      
        on main.tf line 7, in data "xenorchestra_template" "template":
         7: data "xenorchestra_template" "template" {
      
      

      Is there anything I need to enable on XenOrchestra so the websocket connection works?

      posted in Xen Orchestra
      E
      eperez539