Coder Social home page Coder Social logo

virt-init's Introduction

virt-init

This project provides “provisioning” scripts for Alpine Linux virtual machines running on VMware or platforms supporting cloud-init/nocloud (more platforms may be supported in the future).

WIP

Supported platforms

VMware/OVF

OVF properties are mapped to the variables for the provisioning scripts by converting to SCREAMING_CASE and replacing all non-alphanumeric characters with an underscore (_). For example, OVF property admin-user is mapped to variable ADMIN_USER. This mapping can be customized in the config via vmware_ovf_mapping. There’s one predefined mapping: hostname to SET_HOSTNAME. Some special variable names, such as PATH, PWD or RC_* variables, are protected.

VMware/guestinfo

This platform/source reads parameters from the GuestInfo variables.

GuestInfo parameters are mapped to the variables for the provisioning scripts explicitly via vmware_guestinfo_mapping in the config.

Cloud-init/nocloud

This platform reads parameters from files provided on an ISO 9660 (or VFAT) filesystem (typically a virtual CD-ROM) labeled cidata, specifically from the meta-data file and the user-data file in cloud-config format.

By default, $ADMIN_USER is mapped to the first user in the users directive or to the directive user (in this order of precedence).

This integration has been tested on the Proxmox platform.

Scripts

Creates an user account named $ADMIN_USER with primary group users, secondary group $ADMIN_GROUP (defaults to wheel), and shell $ADMIN_SHELL (defaults to /bin/sh).

If $ADMIN_USER is not provided, this script is skipped.

Extends all mounted filesystems to the maximum disk capacity. Only ext3, ext4, and btrfs are currently supported.

If the filesystem resides on a partition (GPT or DOS) and it’s the last partition, it will be expanded before resizing the filesystem.

Note: It’s completely unnecessary and pointless to use partitions on virtual disks, it just adds more complexity and complications, but some broken platforms and tools (e.g. Veeam Backup) require it.

Sets the hostname to $SET_HOSTNAME, if provided. It should contain only alphanumeric ASCII characters and a hyphen ([a-zA-Z0-9-]), all other characters will be replaced with a hyphen (-).

Changes the system timezone to $TIMEZONE (e.g. Europe/Prague, UTC), if provided.

Adds the following lines to /etc/hosts:

127.0.0.1  <fqdn> <hostname> localhost
::1        <fqdn> <hostname> localhost

<fqdn> is $FQDN or, if not provided, $SET_HOSTNAME. It should contain only alphanumeric characters, a hyphen and a period ([a-zA-Z0-9.-]), all other characters will be replaced with a hyphen (-).

<hostname> is the system’s hostname (previously set to $SET_HOSTNAME).

If $ROOT_SSH_KEYS with SSH public key(s) is provided, adds them to /root/.ssh/authorized_keys. If $ADMIN_SSH_KEYS is provided, adds them to authorized_keys of the user specified in $ADMIN_USER (defaults to root).

Requirements

  • POSIX-compatible shell (e.g. ash, bash, dash, zsh)

  • OpenRC

  • btrfs utility and/or resize2fs from e2fsprogs (only for grow-fs script)

  • partx and sfdisk from util-linux (only for grow-fs script if you use partitions)

  • vmware-rpctool from open-vm-tools (only for VMware)

  • yx tool (only for cloud-init)

Installation

Manually

  1. Clone this repository and jump in:

    git clone https://github.com/jirutka/virt-init.git
    cd virt-init
  2. Install files (you may need to run this with sudo):

    make install

    You may use the DESTDIR variable to specify the target prefix.

  3. Add the virt-init service to the boot runlevel:

    rc-update add virt-init boot

License

This project is licensed under MIT License.

virt-init's People

Contributors

jirutka avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar

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.