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

    Question On Cloud-init and ConfigDrive

    Scheduled Pinned Locked Moved Xen Orchestra
    1 Posts 1 Posters 538 Views 1 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.
    • brodiecyberB Offline
      brodiecyber
      last edited by

      Hello

      I was finally been able to get cloud-init working. But i have a question that i can seem to find and answer to

      Must the cloud config drive be permanently attached to the VM to preserve Network configurations? As my custom template applies the network config but when i remove the drive it defaults back to DHCP

      Ive removed removed the network configurations in the /etc/network/interfaces file except for the eth0 hotplug and well as details in the hosts file

      This is my cloud config

      #Cloud-config
      users:
         - default
      
      disable_root: true
      
      #Set hostname
      preserve_hostname: false
      hostname: debian-localhost
      manage_resolv_conf: true
      manage_etc_hosts: true
      apt_preserve_sources_list: true
      
      cloud_init_modules:
       - migrator
       - seed_random
       - bootcmd
       - write-files
       - growpart
       - resizefs
       - disk_setup
       - mounts
       - set_hostname
       - update_hostname
       - update_etc_hosts
       - ca-certs
       - rsyslog
       - users-groups
       - ssh
      
      cloud_config_modules:
       - emit_upstart
       - ssh-import-id
       - locale
       - set-passwords
       - grub-dpkg
       - apt-pipelining
       - apt-configure
       - ntp
       - timezone
       - disable-ec2-metadata
       - runcmd
       - byobu
      
      cloud_final_modules:
       - package-update-upgrade-install
       - fan
       - puppet
       - chef
       - salt-minion
       - mcollective
       - rightscale_userdata
       - scripts-vendor
       - scripts-per-once
       - scripts-per-boot
       - scripts-per-instance
       - scripts-user
       - ssh-authkey-fingerprints
       - keys-to-console
       - phone-home
       - final-message
       - power-state-change
      
      #Install packages
      package_update: true
      package_upgrade: true
      packages:
       - curl
       - sudo
       - unattended-upgrades
       - open-iscsi
       - nfs-common
       - cifs-utils
       - htop
       - net-tools
       - nftables
       - fail2ban
       - unzip
       - rsyslog
      
      #Set date of server creation
      bootcmd:
       - date > /etc/birth_certificate
      
      datasource_list: [ NoCloud, None ]
      datasource:
          NoCloud:
              fs_label: cidata
      
      system_info:
         distro: debian
         default_user:
           name: serveradmin
           lock_passwd: True
           gecos: serveradmin
           groups: [adm, audio, cdrom, dialout, dip, floppy, netdev, plugdev, sudo, video]
           sudo: ["ALL=(ALL) NOPASSWD:ALL"]
           shell: /bin/bash
           ssh_authorized_keys:
            - ssh-rsa xxxxxxxx
         paths:
            cloud_dir: /var/lib/cloud/
            templates_dir: /etc/cloud/templates/
            upstart_dir: /etc/init/
         package_mirrors:
           - arches: [default]
             failsafe:
               primary: http://deb.debian.org/debian
               security: http://security.debian.org/
         ssh_svcname: ssh
      

      this is my 99-fake_cloud.cfg

      # configure cloud-init for NoCloud
      datasource_list: [ NoCloud, None ]
      datasource:
          NoCloud:
              fs_label: cidata
      

      Im using Debain 11.7

      Any ideas.

      thanks

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