Thanks to Christian Hofstaedtler and Peter van Dijk I discovered Proxmox-VE, an Open Source virtualization platform for running Virtual Appliances and Virtual Machines. I could fill reams of paper telling you about all the things I don’t know about Proxmox, but I won’t; their Web site takes care of that…
Here’s a screen shot of what the rather slick Web console looks like as it’s running in a Virtualbox on my Mac at the moment.
There are a few settings I need tweaked on a container before I can use it: I have to create a user and provision an SSH key for running Ansible against the containers.
One solution would be to extract the content of the template (a compressed tar file), modify its content and repackage, but I supposed it could be done a bit more elegantly, which it can.
In Proxmox, the container configuration files are located in
/etc/pve/nodes/proxmox/openvz. Herein I create
vps.mount which is run by the host when a container is mounted:
talk-to-ct.sh is sourced into the background and then disowned –
we must not block at this point because OpenVZ is starting the container.)
talk-to-ct.sh we have to wait a bit until the container is online
(i.e. running). I’m omitting that here, but I ought to check with
whether the container status actually is
"running". Instead I just wait a
bit, hoping that the container will be ready within ten seconds.
By now, Proxmox has started the container, and our script is sleeping. At the end of it’s rest, it will use
vzctl to run the
run-in-ct script in the actual container: the manual says about
runs specified shell script in the container. Argument script is a file on the host system which contents is read by vzctl and executed in the context of the container. For a run‐ ning container, the command jumps into the container and executes the script.
And what does my
run-in-ct script do? It creates a user and sets up an SSH public key so that I can provision the container with Ansible.
Whether I start containers from the Proxmox CLI with
vzctl or from the Web interface is irrelevant: in both cases these steps are performed. I like to think this is like a mini-kickstart for OpenVZ containers. :-)
I use Proxmox-VE as a portable data center.