Search icon CANCEL
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Infrastructure as Code Cookbook

You're reading from   Infrastructure as Code Cookbook Automate complex infrastructures

Arrow left icon
Product type Paperback
Published in Feb 2017
Publisher Packt
ISBN-13 9781786464910
Length 440 pages
Edition 1st Edition
Arrow right icon
Authors (2):
Arrow left icon
Pierre Pomès Pierre Pomès
Author Profile Icon Pierre Pomès
Pierre Pomès
Stephane Jourdan Stephane Jourdan
Author Profile Icon Stephane Jourdan
Stephane Jourdan
Arrow right icon
View More author details
Toc

Table of Contents (12) Chapters Close

Preface 1. Vagrant Development Environments 2. Provisioning IaaS with Terraform FREE CHAPTER 3. Going Further with Terraform 4. Automating Complete Infrastructures with Terraform 5. Provisioning the Last Mile with Cloud-Init 6. Fundamentals of Managing Servers with Chef and Puppet 7. Testing and Writing Better Infrastructure Code with Chef and Puppet 8. Maintaining Systems Using Chef and Puppet 9. Working with Docker 10. Maintaining Docker Containers Index

Using a disposable CentOS 7.x with VMware in seconds

Vagrant supports both VMware Workstation and VMware Fusion through official plugins available on the Vagrant store (https://www.vagrantup.com/vmware). Follow the indications from the official website to install the plugins.

Vagrant boxes depend on the hypervisor—a VirtualBox image won't run on VMware. You need to use dedicated images for each supervisor you choose to use. For example, Ubuntu official releases only provide VirtualBox images. If you try to create a Vagrant box with a provider while using an image built for another provider, you'll get an error.

Getting ready

To step through this recipe, you will need the following:

  • A working Vagrant installation
  • A working VMware Workstation (PC) or Fusion (Mac) installation
  • A working Vagrant VMware plugin installation
  • An Internet connection

How to do it…

The Chef Bento project provides various multiprovider images we can use. For example, let's use a CentOS 7.2 with Vagrant (bento/centos-7.2) with this simplest Vagrantfile:

Vagrant.configure("2") do |config|
  config.vm.box = "bento/centos-7.2"
end

Start your CentOS 7.2 virtual environment and specify the hypervisor you want to run:

$ vagrant up --provider=vmware_fusion
$ vagrant ssh

You're now running a CentOS 7.2 Vagrant box using VMware!

How it works…

Vagrant is powered by plugins extending its usage and capabilities. In this case, the Vagrant plugin for VMware delegates all the virtualization features to the VMware installation, removing the need for VirtualBox.

There's more…

If VMware is your primary hypervisor, you'll soon be tired to always specify the provider in the command line. By setting the VAGRANT_DEFAULT_PROVIDER environment variable to the corresponding plugin, you will never have to specify the provider again, VMware will be the default:

$ export VAGRANT_DEFAULT_PROVIDER=vmware_fusion
$ vagrant up

See also

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at €18.99/month. Cancel anytime