You are previewing Creating Development Environments with Vagrant - Second Edition.
O'Reilly logo
Creating Development Environments with Vagrant - Second Edition

Book Description

Leverage the power of Vagrant to create and manage virtual development environments with Puppet, Chef, and VirtualBox

In Detail

Vagrant is an open source software used to create and manage virtual development environments. It can be considered a wrapper around virtualization software such as VirtualBox and configuration management software such as Chef, Ansible, and Puppet.

This book looks at the potential that virtualization offers us, and breaks down the process of creating a distributable and powerful virtual development environment. You will learn how to create more advanced development environments consisting of multiple virtual machines, allowing you to mimic multi-server production environments.

Finally, you'll gain an insight into Vagrant Cloud, which is a suite of web services built into Vagrant that allows you to remotely view applications on a Vagrant instance.

What You Will Learn

  • Integrate your own machine with the virtual machine of your development environment

  • Install Vagrant on multiple platforms such as Windows, OS X, and Linux

  • Familiarize yourself with Vagrant operations such as port forwarding, disk mapping, and networking

  • Install and manage software packages using Puppet, Ansible, and Chef

  • Set up and control multiple virtual machines simultaneously within the same project

  • Build and manage your own base box for Vagrant

  • Discover how to set up a simple LEMP server for a Vagrant project

  • Downloading the example code for this book. You can download the example code files for all Packt books you have purchased from your account at http://www.PacktPub.com. If you purchased this book elsewhere, you can visit http://www.PacktPub.com/support and register to have the files e-mailed directly to you.

    Table of Contents

    1. Creating Development Environments with Vagrant Second Edition
      1. Table of Contents
      2. Creating Development Environments with Vagrant Second Edition
      3. Credits
      4. About the Author
      5. About the Reviewers
      6. www.PacktPub.com
        1. Support files, eBooks, discount offers, and more
          1. Why subscribe?
          2. Free access for Packt account holders
      7. Preface
        1. What this book covers
        2. What you need for this book
        3. Who this book is for
        4. Conventions
        5. Reader feedback
        6. Customer support
          1. Downloading the example code
          2. Errata
          3. Piracy
          4. Questions
      8. 1. Getting Started with Vagrant
        1. Introducing Vagrant
        2. Requirements for Vagrant
        3. Getting started
          1. Installing VirtualBox
          2. Installing Vagrant
        4. Summary
      9. 2. Managing Vagrant Boxes and Projects
        1. Creating our first Vagrant project
        2. Managing Vagrant-controlled guest machines
          1. Powering up a Vagrant-controlled virtual machine
          2. Suspending a virtual machine
          3. Resuming a virtual machine
          4. Shutting down a virtual machine
          5. Starting from scratch
          6. Updating based on Vagrantfile changes
          7. Connecting to the virtual machine over SSH
        3. Managing integration between host and guest machines
          1. Port forwarding
          2. Synced folders
          3. Networking
        4. Autorunning commands
        5. Managing Vagrant boxes
          1. Adding Vagrant boxes
          2. Listing Vagrant boxes
          3. Checking for updates
          4. Removing Vagrant boxes
          5. Repackaging a Vagrant box
          6. Updating the current environment's box
        6. Too many Vagrants!
        7. Summary
      10. 3. Provisioning with Puppet
        1. Provisioning
        2. Puppet
          1. Creating modules and manifests with Puppet
            1. Puppet classes
            2. Default Puppet manifests
            3. Resources
              1. Resource requirements
            4. Resource execution ordering
          2. The notify, subscribe, and refreshonly parameters
            1. Executing resources in stages
          3. Installing software
            1. Updating our package manager
            2. Installing the nginx package
            3. Running the nginx service
          4. File management
            1. Copying a file
            2. Creating a symlink
            3. Creating folders
            4. Creating multiple folders in one go
          5. Cron management
          6. Running commands
          7. Managing users and groups
            1. Creating groups
            2. Creating users
            3. Updating the sudoers file
          8. Creating configurable classes
          9. Puppet modules
          10. Using Puppet to provision servers
        3. Summary
      11. 4. Using Ansible
        1. Understanding Ansible
          1. Installing Ansible
          2. Creating an inventory
        2. Creating Ansible playbooks
          1. Modules – what Ansible can do
          2. Installing software
            1. Updating our package manager
            2. Installing the nginx package
            3. Running the nginx service
          3. Understanding file management
            1. Copying a file
            2. Creating a symlink
            3. Creating folders
          4. Managing cron
          5. Running commands
          6. Managing users and groups
            1. Creating groups
            2. Creating users
          7. Using Ansible roles
          8. Using Ansible to provision servers
        3. Summary
      12. 5. Using Chef
        1. Knowing about Chef
        2. Creating cookbooks and recipes with Chef
          1. Resources – what Chef can do
          2. Installing software
            1. Updating our package manager
            2. Installing the nginx package
            3. Running the nginx service
          3. Understanding file management
            1. Copying a file
            2. Creating a symlink
            3. Creating folders
            4. Creating multiple folders in a single process with looping
          4. Managing cron
          5. Running commands
          6. Managing users and groups
            1. Creating groups
            2. Creating users
            3. Updating the sudoers file
          7. Knowing common resource functionalities
          8. Using Chef cookbooks
          9. Using Chef to provision servers
        3. Summary
      13. 6. Provisioning Vagrant Machines with Puppet, Ansible, and Chef
        1. Provisioning within Vagrant
        2. Provisioning with Puppet on Vagrant
          1. Using Puppet in standalone mode
            1. Puppet provisioning in action
          2. Using Puppet in client/server mode
        3. Provisioning with Ansible on Vagrant
        4. Provisioning with Chef on Vagrant
          1. Using Chef-solo
          2. Using Chef in client/server mode
        5. Provisioning with SSH – a recap
        6. Using multiple provisioners on a single project
        7. Overriding provisioning via the command line
        8. Summary
      14. 7. Working with Multiple Machines
        1. Using multiple machines with Vagrant
          1. Defining multiple virtual machines
        2. Connecting to the multiple virtual machines over SSH
          1. Networking the multiple virtual machines
          2. Provisioning the machines separately
        3. Destroying a multimachine project
        4. Summary
      15. 8. Creating Your Own Box
        1. Getting started
        2. Preparing the VirtualBox machine
        3. VirtualBox Guest Additions
        4. Vagrant authentication
          1. Vagrant user and admin group
          2. The sudoers file
          3. Insecure public/private key pair
        5. Provisioners
          1. Installing Puppet
          2. Installing Chef
        6. Cleaning up the VM
        7. Export
        8. Summary
      16. 9. HashiCorp Atlas
        1. Discovering boxes
          1. Installing new boxes
          2. Updating existing boxes
          3. Checking for outdated boxes
        2. Distributing boxes
        3. Sharing and connecting with Atlas
          1. Logging Vagrant into Vagrant Cloud
          2. Sharing a Vagrant virtual machine over HTTP(S)
          3. Sharing and connecting to a Vagrant virtual machine
        4. Summary
      17. A. A Sample LEMP Stack
        1. Creating the Vagrant project
        2. Creating the Puppet manifests
          1. Installing Nginx
          2. Installing PHP
        3. Installing the MySQL module
        4. Default manifest
          1. Installing Nginx and PHP
          2. Hostname configuration
          3. E-mail sending services
          4. MySQL configuration
        5. Launching the virtual machine
        6. Summary
      18. Index