Puppet, VirtualBox and Interfaces

At work we’re using a small Python script to

  • do some sanity checking (hostname checks, acquiring IP address etc)
  • clone a VirtualBox machine (needs to be stopped because of Bug 9255)
  • modify machine to according # of CPUs and amount of RAM
  • mount the disk locally,
  • mount the disk’s first partition locally,
  • put SSH keys in place, used during initial provisioning,
  • update network setting files, including udev rules (/etc/udev/rules.d/70-persistent-net.rules) to get predictable network card names and being able to map them to IP addresses
  • unmount all above,
  • generate new DNS and basic Puppet manifest files, reload services (puppet),
  • boot it,
  • run puppet agent on the new machine to generate and push client signing request to puppetmaster
  • sign cert on puppetmaster,
  • run puppet to have the machine finish it’s provisioning (overwrites the SSH keys)

Done. :-)

To issue commands over SSH we’re using Fabric (and might, or might not, move to using Serf).