Gogetit

Libraries with a CLI tool for dealing with things such as MAAS, LXD, Libvirt and Chef. By using this, you will get to use them all together in automated and efficient way.

Features

  • Provides an API and a CLI tool for dealing with Libvirt(KVM) and LXD.
  • Aware of MAAS and works with maas-client to manage IP and FQDN allocation.
  • Aware of Chef knife and its sub commands such as Vault to automate routine tasks.
  • Being used by kitchen-gogetkitchen as a driver for Chef Test Kitchen.

Limitations

  • Network resource awareness is only provided by MAAS.
  • Only LXD and Libvirt(KVM) are available as provider.
  • Only IPv4 is available for IP assignment.
  • It is tested only on Ubuntu 16.04 with OVS as virtual switch.

Installation

dependent packages

sudo apt install -y build-essential lxd-client libvirt-dev libvirt-bin
# logout and in

# to remove default network(virbr0)
virsh net-destroy default
virsh net-undefine default

# chefdk environment

install

$ gem install gogetit
$ gem install gogetit --no-ri --no-rdoc

Usage

gogetit list
gogetit create lxd01
gogetit create lxd01 --provider lxd

# For advanced network configuration
gogetit create lxd01 -p lxd -i 192.168.0.10

# When specifying multiple IPs, the first one will be chosen as gateway.
# And the IP which belongs to the gateway interface will be the IP of the FQDN
# of the container which is set by MAAS.
# The IPs should belong to networks defined and recognized by MAAS.
gogetit create lxd01 -p lxd -i 192.168.10.10 10.0.0.2

# When specifying multiple VLANs, the first one will be chosen as gateway.
# gogetit create lxd01 -p lxd -v 0 10 12
# gogetit create lxd01 -p lxd -v 10 11

gogetit create kvm01 -p libvirt
gogetit create kvm01 -p libvirt -i 192.168.10.10 10.0.0.2

# When specifying alias for LXD provider
gogetit create kvm01 -a centos7
gogetit create kvm01 -p lxd -a centos7

# When specifying distro for Libvirt provider
gogetit create kvm01 -p libvirt -d centos

# to create a LXD container without MAAS awareness
gogetit create lxd01 --no-maas -f lxd_without_maas.yml
gogetit create lxd01 --no-maas -f lxd_without_maas_vlans.yml

# to provision with a bare metal machine
# gogetit create kvm01 -p bare

gogetit destroy lxd01

# This feature is broken and might be deprecated in the future.
# gogetit rebuild kvm01

# to create a container bootstrapping as a chef node
gogetit create chef01 --chef

or

CHEF=true gogetit create chef01


# to destroy a container deleting corresponding chef node and client
gogetit destroy chef01 --chef

# to release a machine(or instance created by libvirt) in MAAS
gogetit release node01
require 'gogetit'

To make Gogetit recognize data bag that needs to be encrypted by Vault

  • Fill this out!

To develop

  • Deploying bare metal machine from machine pool
  • Static IP auto-assignment with VLAN info
  • Working with Multiple LXD and Libvirt hosts

To document

  • How to make Gogetit recognize vault data bag items

Development and Contributing

Clone and then execute followings:

$ cd gogetit
$ gem install bundle
$ bundle

Questions, pull requests, advices and suggestions are always welcome!

License

The gem is available as open source under the terms of the MIT License.

Code of Conduct

Everyone interacting in the Gogetit project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the code of conduct.