XCP-ng
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Register
    • Login

    cloud-init does not set hostname

    Scheduled Pinned Locked Moved Advanced features
    2 Posts 1 Posters 452 Views 2 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • J Offline
      jon
      last edited by

      Howdy folks, I saw a couple posts similar to this but not quite what I've experienced.

      I'm trying to create a cloud config template for Ubuntu 20.04 (haven't done this before). Using the standard 20.04 ISO image, I followed the instructions to setup a template VM with the guest tools and cloud config stuff installed. It generally works great to deploy with, but whenever I create a new VM from this template using the below cloud config, the hostname is not updated (it stays with the original template VM hostname). I know I'm doing something right, because the ssh keys are being set properly.

      I've tried some variations of the following Cloud config (even tried a hardcoded hostname to no effect).

      #cloud-config
      hostname: {name}%
      ssh_authorized_keys:
        - ssh-rsa <pubkey here>
      

      The only difference I can see is I'm on Ubuntu 20.04 instead of 22.04 - would that really make the difference? I also saw some chatter about having to set a network config and that it breaks if blank, but that didn't seem to make a difference for me.

      Versions (XOCE):
      Xen Orchestra, commit dfc62
      xo-server 5.106.1
      xo-web 5.107.0

      1 Reply Last reply Reply Quote 0
      • J Offline
        jon
        last edited by

        I re-ran everything using the latest 22.04 Ubuntu ISO instead of 20.04. Hostname templating is now working properly. Must have read too fast the first time when I went for 20.04. There must be some critical difference between the cloud init or distribution versions that caused my issue.

        1 Reply Last reply Reply Quote 0
        • First post
          Last post