Giter Club home page Giter Club logo

img-clone's Introduction

img-clone

Clone vm-bhyve cloudinit images

Usage

USAGE: img-clone <template> <target> <userdata> [<instance_config>]

img-clone provides a utility to clone vm-bhyve cloud-init enabled images and dynamically update the cloud-init user data (re-generating the seed.iso)

The source template should be a cloud-init enabled vm-bhyve instance (the utility will use the latest snapshot by default - to use a specific snapshot this should be specified explicitly as template@snapshot)

A new vm-bhyve instance target will be created (using vm clone) and userdata copied into the .cloud-init folder and the the seed.iso image updated with the contents of the .cloud-init folder.

userdata can either be specified as a file (or - for stdin) which will be written as user-data, or can be a directory which will be copied recursively into the .cloud-init folder (which allows additional files to be included in the cloud-init configuration).

If instance_config is specified (either a file or - for stdin) it is written to the .cloud-init folder as CONFIG (this is to allow a common userdata config to be used for multiple instances and just specify separate instance_config)

This approach is much faster than using vm create with a cloud image which uses qemu dd to copy the disk image rather than a zfs clone (which is pretty much instant).

The source vm-bhyve instance should be configured to support cloud-init (vm create -C ....) and the OS image also cloud-init enabled. For FreeBSD it is possible to use the (very simple) bhyve-cloudinit rc.d script included in thsi repository. This will mount the cdrom, set hostname from the meta-data file and run the user-data script. There is very rudimentary support for cloud-config files (add ssh keys, install packages, and runcmd) but this doesnt parse the yaml file properly so will fail with anything unexpected. The utility is mostly intended to just run a shell-script in user-data.

When configuring the source template make sure that there are no artefacts left in the instance (ssh host keys, config files, logs etc) and that the /firstboot flag is set.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.