Submodules Module


Bases: object

VMware machine settings template

get_template(memory_setup=False, cpu_setup=False, network_setup=False, iso_setup=False, disk_controller='ide', iso_controller='ide')[source]

VMware machine configuration template

  • memory_setup (bool) – with main memory setup true|false

  • cpu_setup (bool) – with number of CPU’s setup true|false

  • network_setup (bool) – with network emulation true|false

  • iso_setup (bool) – with CD/DVD drive emulation true|false

  • disk_controller (string) – add disk controller setup to template

  • iso_controller (string) – add CD/DVD controller setup to template

  • network_mac (string) – add static MAC address setup to template

  • network_driver (string) – add network driver setup to template

  • network_connection_type (string) – add connection type to template

Return type

Template Module


Bases: object

Generate a Vagrantfile configuration template

This class creates a simple template for the Vagrantfile that is included inside a vagrant box.

The included Vagrantfile carries additional information for vagrant: by default that is just the boxes’ MAC address, but depending on the provider additional information need to be present. These can be passed via the parameter custom_settings to the method get_template().

Example usage:

The default without any additional settings will result in this Vagrantfile:

>>> vagrant_config = VagrantConfigTemplate()
>>> print(
...     vagrant_config.get_template()
...     .substitute({'mac_address': 'deadbeef'})
... )
Vagrant.configure("2") do |config|
  config.vm.base_mac = "deadbeef"

If your provider/box requires additional settings, provide them as follows:

>>> extra_settings = dedent('''
... config.vm.hostname = "no-dead-beef"
... config.vm.provider :special do |special|
...   special.secret_settings = "please_work"
... end
... ''').strip()
>>> print(
...     vagrant_config.get_template(extra_settings)
...     .substitute({'mac_address': 'DEADBEEF'})
... )
Vagrant.configure("2") do |config|
  config.vm.base_mac = "DEADBEEF"
  config.vm.hostname = "no-dead-beef"
  config.vm.provider :special do |special|
    special.secret_settings = "please_work"

Return a new template with custom_settings included and indented appropriately.


custom_settings (str) – String of additional settings that get pasted into the Vagrantfile template. The string is put at the correct indentation level for you, but the internal indentation has to be provided by the caller.


A template with custom_settings inserted at the appropriate position. The template has one the variable mac_address that must be substituted.

Return type

string.Template Module


Bases: object

Generate a OVF file template for a vagrant virtualbox box

This class provides a template for virtualbox’ ovf configuration file that is embedded inside the vagrant box. The template itself was extracted from a vagrant box that was build via packer and from a script provided by Neal Gompa.


Return the actual ovf template. The following values must be substituted: - vm_name: the name of this VM - disk_image_capacity: Size of the virtual disk image in GB - vm_description: a description of this VM

Module contents