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

    m4xm0rris

    @m4xm0rris

    9
    Reputation
    3
    Profile views
    18
    Posts
    0
    Followers
    1
    Following
    Joined
    Last Online

    m4xm0rris Unfollow Follow

    Best posts made by m4xm0rris

    • RE: Terraform with cloud-init

      In case anyone comes here looking for an example (as it took me days of banging head against the proverbial wall to get this working with templatefile function):

      cloud_config.tftpl

      #cloud-config
      hostname: ${hostname}
      user: ops-user
      ssh_authorized_keys:
        - OPS_USER_SSH_KEY
      manage_etc_hosts: true
      fqdn: ${hostname}.${domain}
      package_upgrade: true
      users:
       - default
      

      cloud_network_config.tftpl

      #cloud-config
      version: 1
      config:
          - type: physical
            name: eth0
            subnets:
            - type: static
              address: '${ip}'
              netmask: '255.255.255.0'
              gateway: '10.1.50.1'
      

      vm.tf

      resource "xenorchestra_vm" "unc-lab" {
      ......
       cloud_config = templatefile("cloud_config.tftpl", {
        hostname = "unc-lab"
        domain = "morris.lan"
      })
      cloud_network_config = templatefile("cloud_network_config.tftpl", {
        ip = "10.1.55.34"
      })
      .......
      

      Thanks @ddelnano for your help!

      posted in Xen Orchestra
      M
      m4xm0rris
    • RE: Terraform with cloud-init

      @ppikna97 Hi! How are you calling the templates in your VM resources? As you can see above from my examples I'm simply pulling both user data and network inline with the rest of my config e.g.

      cloud_config = templatefile("cloud_config.tftpl", {
        hostname = "bw-lab"
        domain = var.network["domain"]
      })
      cloud_network_config = templatefile("cloud_network_config.tftpl", {
        ip = "10.1.55.37"
        netmask = var.network["netmask"]
        gateway = var.network["gateway"]
      })
      
      posted in Xen Orchestra
      M
      m4xm0rris
    • RE: Terraform with cloud-init

      Thanks @ddelnano , that worked perfectly!

      Appreciate the help!

      posted in Xen Orchestra
      M
      m4xm0rris

    Latest posts made by m4xm0rris

    • RE: Terraform with cloud-init

      @ppikna97 Np, I was also using template_file originally but as its now deprecated there have been no builds released for M1 based Mac (leading/forcing me down the templatefile function route).

      posted in Xen Orchestra
      M
      m4xm0rris
    • RE: Terraform with cloud-init

      @ppikna97 Hi! How are you calling the templates in your VM resources? As you can see above from my examples I'm simply pulling both user data and network inline with the rest of my config e.g.

      cloud_config = templatefile("cloud_config.tftpl", {
        hostname = "bw-lab"
        domain = var.network["domain"]
      })
      cloud_network_config = templatefile("cloud_network_config.tftpl", {
        ip = "10.1.55.37"
        netmask = var.network["netmask"]
        gateway = var.network["gateway"]
      })
      
      posted in Xen Orchestra
      M
      m4xm0rris
    • RE: Terraform with cloud-init

      @ddelnano Sir, the only thing I could point out from that pull request is the block in your vm.md where you are templating the variables in a separate block.

      "

      # Template the cloudinit if needed
      template = templatefile("cloud_config.tftpl", {
        hostname = "your-hostname"
        domain = "your.domain.com"
      })
      

      "
      I have no where near enough experience with Terraform to tell if makes any practical difference, but I am able to redner the template inline with the rest of my VM resource definition. eg.

      cloud_network_config = templatefile("cloud_network_config.tftpl", {
         ip = "10.1.55.37"
         netmask = var.network["netmask"]
         gateway = var.network["gateway"]
       })
      

      Just a little tidier IMO, but again have no idea if the way you have done this is better practice etc.

      Thanks 🙂

      posted in Xen Orchestra
      M
      m4xm0rris
    • RE: Terraform with cloud-init

      In case anyone comes here looking for an example (as it took me days of banging head against the proverbial wall to get this working with templatefile function):

      cloud_config.tftpl

      #cloud-config
      hostname: ${hostname}
      user: ops-user
      ssh_authorized_keys:
        - OPS_USER_SSH_KEY
      manage_etc_hosts: true
      fqdn: ${hostname}.${domain}
      package_upgrade: true
      users:
       - default
      

      cloud_network_config.tftpl

      #cloud-config
      version: 1
      config:
          - type: physical
            name: eth0
            subnets:
            - type: static
              address: '${ip}'
              netmask: '255.255.255.0'
              gateway: '10.1.50.1'
      

      vm.tf

      resource "xenorchestra_vm" "unc-lab" {
      ......
       cloud_config = templatefile("cloud_config.tftpl", {
        hostname = "unc-lab"
        domain = "morris.lan"
      })
      cloud_network_config = templatefile("cloud_network_config.tftpl", {
        ip = "10.1.55.34"
      })
      .......
      

      Thanks @ddelnano for your help!

      posted in Xen Orchestra
      M
      m4xm0rris
    • RE: Terraform with cloud-init

      @ddelnano Yeah, I only found it as template_file is deprecated apparently and as it hasn't seen any updates, I couldn't use the code you posted from my M1 Macbook 😞

      Anyways, thanks for the help!

      posted in Xen Orchestra
      M
      m4xm0rris
    • RE: Terraform with cloud-init

      Just stumbled upon this provider too which may offer a more streamlined approach, not that I am familiar enough with Terraform yet to say this for sure: https://github.com/hashicorp/terraform-provider-cloudinit

      posted in Xen Orchestra
      M
      m4xm0rris
    • RE: Terraform with cloud-init

      Thanks @ddelnano , that worked perfectly!

      Appreciate the help!

      posted in Xen Orchestra
      M
      m4xm0rris
    • Terraform with cloud-init

      Hi all,

      New to the IaC world, trying to get Terraform to create a couple of VMs through Xen Orchestra but having a little trouble with cloud-init functionality. Network config gets parsed fine and the expected IP is applied.

      However using the cloud-init user config that I usually use on the XO Web UI does not work. Within this cloud-init config, I'm using the name variable as shown below:
      f9903baf-0bc1-487d-b397-872a012880c0-image.png

      However it appears when this is used via Terraform, the variable does not get parsed and the cloud config drive ends up being generated and given to the VM as

      #cloud-config
      hostname: {name}

      If anyone can help with this, would be much appreciated.

      posted in Xen Orchestra
      M
      m4xm0rris
    • RE: Stubdoms and/or Driver Domains in XCP-ng - are they possible?

      @olivierlambert Perfect, thanks again for your time!

      posted in Compute
      M
      m4xm0rris
    • RE: Stubdoms and/or Driver Domains in XCP-ng - are they possible?

      @olivierlambert Thanks for the introduction to DPU, can't say I've heard of it before, but that certainly looks cool!

      Any idea if Stub Domains are at all possible within a XAPI world (if so, any pointers to achieve this would be appreciated).

      Also just wanna say you guys are awesome, XCP-ng + Xen Orchestra are incredible pieces of software, and the few times I've needed help here on the forum, @olivierlambert or one of your colleagues has jumped to the rescue in minutes!

      Appreciate all the work you are doing, XCP-ng FTW! 🙂

      posted in Compute
      M
      m4xm0rris