Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to write vagrant config file in python?

i have new Vagrantfile (generated with init command) with next first lines:

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

so, the question is in title, it is possible to write/rewrite vagrant default config file in python? and how it must be look?

like image 424
Aliaksandr Klimovich Avatar asked Feb 15 '26 18:02

Aliaksandr Klimovich


1 Answers

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

The Vagrant docs explain this and point out that it's usually not a problem if you don't know Ruby:

The syntax of Vagrantfiles is Ruby, but knowledge of the Ruby programming language is not necessary to make modifications to the Vagrantfile, since it is mostly simple variable assignment. In fact, Ruby isn't even the most popular community Vagrant is used within, which should help show you that despite not having Ruby knowledge, people are very successful with Vagrant.

If you are looking to use Python for the provisioning step, you could use the Shell provisioner and write your scripts in Python.

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

like image 128
BrianC Avatar answered Feb 17 '26 15:02

BrianC