Coder Social home page Coder Social logo

provision's Introduction

rafaeldtinoco/provision

kvm and lxd being provisioned

Feel free to use these scripts and provide feedback and or merge requests.

Currently, with the way they are organized, you basically have:

directory reason
examples/ same example files to be used as reference if ever needed
kvm/ the kvm provisioner
lxd/ lxd templates to be used
tests/ quick way to test scripts

kvm provisioner

$ ~/devel/provision/kvm/kvm.sh -h
info: logs at /tmp/kvm.log
syntax: /home/rafaeldtinoco/devel/provision/kvm/kvm.sh [options]
option what it means
-c <#.cpus> number of cpus
-m <mem.GB> memory size
-n <vm.name> virtual machine name
-t default/devel (check cloud-init/*.yaml files)
-i vanilla/numa/... (check libvirt/*.xmlfiles)
-d <ubuntu.codename> xenial/bionic/disco/eoan/focal (default: stable)
-u as 1000:1000 in the installed vm (default: ubuntu)
-l <launchpad_id> for the ssh key import (default: rafaeldtinoco)
-p proxy for http/https/ftp
-r <repo.url> url for the ubuntu mirror (default: us.archive)
-w wait until cloud-init is finished (after 1st boot)

As an example you could install a kvm guest called "example":

$ ~/devel/provision/kvm/kvm.sh -w -c 8 -m 4 -n example -t default -i vanilla \
    -d bionic -u rafaeldtinoco -l rafaeldtinoco \
    -p http://192.168.100.252:3128/ \
    -r http://us.archive.ubuntu.com/ubuntu

info: logs at /tmp/kvm.log
option: vcpus=8
option: ramgb=4
option: hostname=example
option: cloudinit=cloud-init/default.yaml
option: libvirt=libvirt/vanilla.xml
option: distro=bionic
option: username=rafaeldtinoco
option: launchpad_id=rafaeldtinoco
option: proxy=http://192.168.100.252:3128/
option: repository=http://us.archive.ubuntu.com/ubuntu
option: wait vm
...
mark: qcow2 image
mark: nbd connecting qcow2 image
mark: disk formatting
mark: vfat partition
mark: ext4 partition
mark: debootstraping
mark: mount {procfs,sysfs,devfs}
mark: setting hostname
mark: adjusting accounts
mark: /etc/fstab
mark: /etc/network/interfaces
mark: /etc/modules
mark: /etc/default/grub
mark: /etc/apt/sources.list
mark: update and upgrade
mark: grub setup
mark: creating vm
mark: meta-data and user-data
mark: adjust user-data
mark: cleaning things up
finish: cleaning up leftovers
mark: waiting cloud-init to complete

$ virsh list --all
 Id   Name      State
-------------------------
 1    testme    running
 2    example   running

rafaeldtinoco@work:~$ ssh example
Welcome to Ubuntu 18.04.3 LTS (GNU/Linux 4.15.0-73-generic x86_64)

 * Documentation:  https://help.ubuntu.com
 * Management:     https://landscape.canonical.com
 * Support:        https://ubuntu.com/advantage

To run a command as administrator (user "root"), use "sudo <command>".
See "man sudo_root" for details.

rafaeldtinoco@example:~$ 

Note: I'm resolving libvirt virtual machine names as "hosts" because libvirt-nss is being used. By running "kvm/fixenv.sh" you will make sure you're also using it.

For these two options:

option what it means
-t default/devel (check cloud-init/*.yaml files)
-i vanilla/numa/... (check libvirt/*.xmlfiles)

You can copy provided examples into your definitions and use those. This gives you the capability of changing provisioned VM environment based on reproducible rules.

lxd templates

  1. edit lxd/profiles/default.yaml file
  2. execute: $ lxc profile edit default < ~/devel/provision/lxd/profiles/default.yaml
  3. keep your profile always updated with the file in that directory
  4. editing lxd profile outside "snap" world (like lxc profile edit does) is better (vim support)
  5. create as many profiles as you want (I maintain default and devel for now)

provision's People

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.