-
Book Overview & Buying
-
Table Of Contents
-
Feedback & Rating

Infrastructure as Code Cookbook
By :

We want to access and use an Ubuntu Xenial system (16.04 LTS) as quickly as possible.
To do that, Vagrant uses a file named Vagrantfile
to describe the Vagrant infrastructure. This file is in fact pure Ruby that Vagrant reads to manage your environment. Everything related to Vagrant is done inside a block such as the following:
Vagrant.configure("2") do |config| # all your Vagrant configuration here end
To step through this recipe, you will need the following:
$ mkdir vagrant_ubuntu_xenial_1 && cd $_
xenial64
box:Vagrant.configure("2") do |config| config.vm.box = "ubuntu/xenial64" end
$ vagrant up --provider=virtualbox
vagrant
command and use the system normally:$ vagrant ssh Welcome to Ubuntu 16.04.1 LTS (GNU/Linux 4.4.0-34-generic x86_64) […] ubuntu@ubuntu-xenial:~$ hostname ubuntu-xenial ubuntu@ubuntu-xenial:~$ free -m ubuntu@ubuntu-xenial:~$ cat /proc/cpuinfo
$ vagrant destroy
==> default: Forcing shutdown of VM...
==> default: Destroying VM and associated drives...
Alternatively, we can just stop the Vagrant VM with the goal of restarting it later in its current state using vagrant halt:
$ vagrant halt
When you started Vagrant, it read the Vagrantfile, asking for a specific box to run (Ubuntu Xenial). If you previously added it, it will launch it right away through the default hypervisor (in this case, VirtualBox), or if it's a new box, download it for you automatically. It created the required virtual network interfaces, then the Ubuntu VM got a private IP address. Vagrant took care of configuring SSH by exposing an available port and inserting a default key, so you can log into it via SSH without problems.
Change the font size
Change margin width
Change background colour