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

    Posts

    Recent Best Controversial
    • 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