From 82ba818ff456bcd6d56a06226e3f27e98fbb55c3 Mon Sep 17 00:00:00 2001 From: Craig Jennings Date: Thu, 14 Aug 2025 22:58:58 -0500 Subject: removing all downloaded devdocs files --- devdocs/vagrant/vagrantfile%2Ftips.html | 27 --------------------------- 1 file changed, 27 deletions(-) delete mode 100644 devdocs/vagrant/vagrantfile%2Ftips.html (limited to 'devdocs/vagrant/vagrantfile%2Ftips.html') diff --git a/devdocs/vagrant/vagrantfile%2Ftips.html b/devdocs/vagrant/vagrantfile%2Ftips.html deleted file mode 100644 index c16e3e16..00000000 --- a/devdocs/vagrant/vagrantfile%2Ftips.html +++ /dev/null @@ -1,27 +0,0 @@ -

Tips & Tricks

The Vagrantfile is a very flexible configuration format. Since it is just Ruby, there is a lot you can do with it. However, in that same vein, since it is Ruby, there are a lot of ways you can shoot yourself in the foot. When using some of the tips and tricks on this page, please take care to use them correctly.

Loop Over VM Definitions

If you want to apply a slightly different configuration to many multi-machine machines, you can use a loop to do this. For example, if you wanted to create three machines:

(1..3).each do |i|
-  config.vm.define "node-#{i}" do |node|
-    node.vm.provision "shell",
-      inline: "echo hello from node #{i}"
-  end
-end
-
-
# THIS DOES NOT WORK!
-for i in 1..3 do
-  config.vm.define "node-#{i}" do |node|
-    node.vm.provision "shell",
-      inline: "echo hello from node #{i}"
-  end
-end
-
-

The for i in ... construct in Ruby actually modifies the value of i for each iteration, rather than making a copy. Therefore, when you run this, every node will actually provision with the same text.

This is an easy mistake to make, and Vagrant cannot really protect against it, so the best we can do is mention it here.

Overwrite host locale in ssh session

Usually, host locale environment variables are passed to guest. It may cause failures if the guest software do not support host locale. One possible solution is override locale in the Vagrantfile:

ENV["LC_ALL"] = "en_US.UTF-8"
-
-Vagrant.configure("2") do |config|
-  # ...
-end
-
-

The change is only visible within the Vagrantfile.

-

- © 2010–2018 Mitchell Hashimoto
Licensed under the MPL 2.0 License.
- https://www.vagrantup.com/docs/vagrantfile/tips.html -

-
-- cgit v1.2.3