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

    Cloud INIT Network and Hostname.

    Scheduled Pinned Locked Moved Xen Orchestra
    13 Posts 3 Posters 4.7k 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.
    • T Offline
      Torodiesel
      last edited by

      Re: Ubuntu 18.04 Cloud-Init Networking Problem

      Thanks for taking the time to read.

      Currently I learning cloud init and am having issues creating a cloud init template to apply the hostname and network config for each VM I would like to deploy. I looked at the above issue as it has been closest to what I am experiencing but cant get anything to work.

      I followed the author of the link provided below and his template seems to work when it comes to providing the VM name in the template to the other VM's I create.

      https://breadnet.co.uk/cloud-init-that-works/?pk_campaign=homeserver

      If you anyone is able to provide any assistance it would be much appreciated and I would be really grateful. Also If logs are needed please let me know how to find them and I would be glad to provide them.

      V/r
      Torodiesel

      1 Reply Last reply Reply Quote 0
      • olivierlambertO Online
        olivierlambert Vates 🪐 Co-Founder CEO
        last edited by

        We provide an Ubuntu template with Cloudinit via our XO Hub 🙂 Feel free to play with it and check the configuration inside to compare with yours!

        T 1 Reply Last reply Reply Quote 0
        • T Offline
          Torodiesel @olivierlambert
          last edited by

          @olivierlambert 368ac75e-1d3f-4f0b-a6ee-28cfd11dc49f-image.png
          This is what I see in the templates.

          1 Reply Last reply Reply Quote 0
          • olivierlambertO Online
            olivierlambert Vates 🪐 Co-Founder CEO
            last edited by

            Please check that your XOA is fully up-to-date 🙂 Is it correctly registered with your email from xen-orchestra.com?

            T 1 Reply Last reply Reply Quote 0
            • T Offline
              Torodiesel @olivierlambert
              last edited by

              @olivierlambert I have not registered it as of now i will register it if needed.

              1 Reply Last reply Reply Quote 0
              • olivierlambertO Online
                olivierlambert Vates 🪐 Co-Founder CEO
                last edited by

                So it's not up to date. You need to register to be able to get the latest version, we do not rebuild an XOA after each release!

                T 1 Reply Last reply Reply Quote 0
                • T Offline
                  Torodiesel @olivierlambert
                  last edited by

                  @olivierlambert Ah i see. It shows up. Much appreciated!

                  1 Reply Last reply Reply Quote 1
                  • T Offline
                    Torodiesel
                    last edited by

                    So I entered the data in the custom fields. The Vm seemed to not take them. Could the way I configure the custom fields be wrong for user data and networking?

                    ddba7e72-7766-4586-8702-f38e5af2f319-image.png

                    I add my ssh key but i dont provide in this screen shot. Also with the hostname set as {name}%, will it pull the name set in the template of XOA?

                    fohdeeshaF 1 Reply Last reply Reply Quote 0
                    • olivierlambertO Online
                      olivierlambert Vates 🪐 Co-Founder CEO
                      last edited by

                      Question for @fohdeesha

                      1 Reply Last reply Reply Quote 0
                      • fohdeeshaF Offline
                        fohdeesha Vates 🪐 Pro Support Team @Torodiesel
                        last edited by fohdeesha

                        @Torodiesel the networking config should go in the network config box when deploying the template, not in the same box as the cloud-config data. Also, I see a few things wrong, including your network config having non-existent fields (you have to define a nameserver type field, then list addresses under it). Here is a known-working config. Note that you don't need to create an xcp-ng user, the templates come configured with a sudo user with the name of the OS, so for our debian template, the default sudo user is debian, just provide a key like below and you can log in as him::

                        #cloud-config
                        hostname: {name}%
                        fqdn: {name}%.localdomain.local
                        ssh_authorized_keys:
                          - ssh-rsa XXXXXXXX
                        packages:
                          - tmux
                        
                          version: 1
                          config:
                            - type: physical
                              name: eth0
                              subnets:
                                - type: static
                                  address: 192.168.1.169/24
                                  gateway: 192.168.1.1
                            - type: nameserver
                              address:
                                - 8.8.8.8
                                - 1.1.1.1
                              search:
                                - home.lan
                        

                        And yes, filling a field with a value of {name}% will pass along the name of the VM, whatever you have named it

                        T 1 Reply Last reply Reply Quote 0
                        • T Offline
                          Torodiesel @fohdeesha
                          last edited by

                          @fohdeesha I see. The networking you see above is just set in studio code just to have it all in one photo. I am able to get the networking to work fine. the 0/24 is just a place holder and does get changed to a IP.

                          I tried adding a SSH key to access the VM after creation and I can't seem to log in with the default ubuntu user. It does accept my key but is asking for a password after I accept the fingerprint for the server. I don't have a password set for the key so I tried making a new user and that didn't seem to work either.

                          I must be messing something up and I'm not sure what it is.

                          fohdeeshaF 1 Reply Last reply Reply Quote 0
                          • fohdeeshaF Offline
                            fohdeesha Vates 🪐 Pro Support Team @Torodiesel
                            last edited by

                            @Torodiesel Are you using the ubuntu or debian hub template? the default user included with the debian template is debian, not ubuntu :)However if you're yusing the ubuntu template, it should indeed be ubuntu. I would start from scratch and copy/paste only my example config above without networking, replacing only the key line with your public key. If that still doesn't work, you can be sure the issue is somewhere on your side (probably the keypair is corrupted, or your ssh client isn't sending the correct privkey)

                            T 1 Reply Last reply Reply Quote 1
                            • T Offline
                              Torodiesel @fohdeesha
                              last edited by Torodiesel

                              @fohdeesha Yes i can confirm user error. I was uncommenting #network in the network side and it was causing issues with my whole config. I read this in another post on the forum. Thank you for your assistance. I really appreciate the time you provided.

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