propellor-5.12: property-based host configuration management in haskell

MaintainerSean Whitton <spwhitton@spwhitton.name>
Safe HaskellNone
LanguageHaskell98

Propellor.Property.Libvirt

Description

 
Synopsis

Documentation

newtype NumVCPUs Source #

The number of virtual CPUs to assign to the virtual machine

Constructors

NumVCPUs Int 

newtype MiBMemory Source #

The number of MiB of memory to assign to the virtual machine

Constructors

MiBMemory Int 

data AutoStart Source #

Whether the virtual machine should be started after it is defined, and at host system boot

Constructors

AutoStart 
NoAutoStart 

data DiskImageType Source #

Which type of disk image to build for the virtual machine

Constructors

Raw 

installed :: Property DebianLike Source #

Install basic libvirt components

defaultNetworkAutostarted :: Property DebianLike Source #

Ensure that the default libvirt network is set to autostart, and start it.

On Debian, it is not started by default after installation of libvirt.

defaultNetworkStarted :: Property DebianLike Source #

Ensure that the default libvirt network is started.

defined :: DiskImageType -> MiBMemory -> NumVCPUs -> AutoStart -> Host -> Property (HasInfo + DebianLike) Source #

Builds a disk image with the properties of the given Host, installs a libvirt configuration file to boot the image, and if it is set to autostart, start the VM.

Note that building the disk image happens only once. So if you change the properties of the given Host, this property will not modify the disk image. In order to later apply properties to the VM, you should spin it directly, or arrange to have it spun with a property like runPropellor, or use Conductor from the VM host.

Suggested usage in config.hs:

mybox = host "mybox.example.com" $ props
	& osDebian (Stable "stretch") X86_64
	& Libvirt.defaultNetworkAutostarted
	& Libvirt.defined Libvirt.Raw
		(Libvirt.MiBMemory 2048) (Libvirt.NumVCPUs 2)
		Libvirt.NoAutoStart subbox

subbox = host "subbox.mybox.example.com" $ props
	& osDebian Unstable X86_64
	& hasPartition
		( partition EXT4
			`mountedAt` "/"
			`addFreeSpace` MegaBytes 10240
		)
	& Apt.installed ["linux-image-amd64"]
	& Grub.installed PC

	& ipv4 "192.168.122.31"
	& Network.static "ens3" (IPv4 "192.168.122.31")
		(Just (Network.Gateway (IPv4 "192.168.122.1")))
		`requires` Network.cleanInterfacesFile
	& Hostname.sane