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

    XO debian 10 cloud ready VM template (cloud-init)

    Scheduled Pinned Locked Moved Xen Orchestra
    24 Posts 6 Posters 11.8k Views 4 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.
    • M Offline
      mietek
      last edited by

      Great - thanks for the info @fohdeesha.

      1 Reply Last reply Reply Quote 0
      • M Offline
        mietek
        last edited by

        FYI If you are looking for more info on the matter yourself ...

        ver: 20.2-2 of the cloud-init is still the one with the bug mentioned by @olivierlambert earlier:
        https://github.com/vatesfr/xen-orchestra/issues/4449

        There is version 20.3 awaiting to be delivered but still awaiting to be packaged:
        https://tracker.debian.org/pkg/cloud-init

        flipsa created this issue in vatesfr/xen-orchestra

        closed Cloud-init NoCloud block device has wrong dosfslabel --> cloud-init can't find datasource and exits #4449

        1 Reply Last reply Reply Quote 2
        • M Offline
          mietek
          last edited by mietek

          I was able to find the reason XO is not working with cloud-init.
          XO attaches iso with the cloud-config data as additional disk xvdb and it does not work.
          But if you provide it as a cd? It will.

          That is why - as for now you will need to create your own iso and attach it as a cd-rom.
          You do that this way:

          Get your files ready (meta-data network-config user-data). My examples below:

          metadata:

          instance-id: local-nocloud
          local-hostname: myhost.example.com
          

          network-config:

          network:
            version: 1
            config:
              - type: physical
                name: eth0
                subnets:
                   - type: static
                     address: 10.0.0.5/24
                     gateway: 10.0.0.254
              - type: nameserver
                address:
                  - 8.8.8.8
                  - 8.8.4.4
                search:
                  - example.com
              
              - type: physical
                name: eth1
                subnets:
                   - type: static
                     address: 192.168.0.5/24
          

          user-data:

          #cloud-config
          
          ### RUN CMD
          runcmd:
            - /usr/bin/apt -y install mc
            - /usr/bin/date >> /root/testfile
            
          # set system default user
          system_info:
            default_user:
              name: testuser
              gecos: Default Cloud User
          
          # password auth - comment out if not using passwords
          password: testpassword
          ssh_pwauth: true
          chpasswd: { expire: false }
          
          # do some package management
          #package_update: true
          packages:
           - iptraf
           - mtr
           - screen
           - net-tools
           - atop
          

          Generate iso

          genisoimage -output myiso.iso -volid cidata -joliet -rock user-data meta-data network-config
          

          Upload iso to XO
          home -> storage -> iso's -> disks -> new disk

          Prepare VM/template

          • Install Debian 10.6 with xo-tools
          • install cloud-init and cloud-initramfs-growroot
          • remove all network configuration leave just "allow-hotplug ethxxx"
            (network config will be added in /etc/network/interfaces/50-cloud-init. It will not overwrite yours)
          • shutdown the machine and create the template if you want or just restart VM.
          • DO NOT LET IT BOOT! - keep it in grub.
          • attach your iso
          • let it run

          It will do whatever you need on the machine.

          1 Reply Last reply Reply Quote 1
          • B Offline
            bassopt
            last edited by

            This post is deleted!
            1 Reply Last reply Reply Quote 0

            Hello! It looks like you're interested in this conversation, but you don't have an account yet.

            Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

            With your input, this post could be even better 💗

            Register Login
            • First post
              Last post