Is it possible to write a vagrant config file in python?

I have a new Vagrantfile (generated by the command init

) with the following lines:

# -*- mode: ruby -*-
# vi: set ft=ruby :

      

So the question is in the title, is it possible to write / overwrite the vagrant default config file in python? and how should it look like?

+3


source to share


1 answer


No, it is not possible to write Vagrant config files in Python. The native language for Vagrant is Ruby, and the language in which the configuration files are written.

The Vagrant docs explain this and point out that this is usually not a problem unless you know Ruby:

The syntax for Vagrantfiles is Ruby, but knowledge of the Ruby programming language is not required to make changes to the Vagrantfile as it is basically a simple variable assignment. In fact, Ruby is not even the most popular Vagrant community, which should help you show that despite their lack of Ruby knowledge, people are very successful with Vagrant.



If you want to use Python for the initialization step, you can use a shell provisioner and write your scripts in Python.

There are also some projects that can help you use Vagrant in a Python-focused environment. For example: todddeluca / python-vagrant .

+4


source







All Articles