Netdevops Developer Environments with Vagrant Do It Like They Do on the Developer Channel! Stuart Clark Netdevops Evangelist DEVNET-1365

Total Page:16

File Type:pdf, Size:1020Kb

Netdevops Developer Environments with Vagrant Do It Like They Do on the Developer Channel! Stuart Clark Netdevops Evangelist DEVNET-1365 #CLUS NetDevOps Developer Environments with Vagrant Do it like they do on the Developer Channel! Stuart Clark NetDevOps Evangelist DEVNET-1365 #CLUS Agenda • Vagrant 101 • Our first network vagrant up! • Vagrant + Ansible Provisioning • Multi-Node Topologies • The right tool for the right job… • How to do it yourself! DEVNET-1365 © 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 3 Cisco Webex Teams Questions? Use Cisco Webex Teams (formerly Cisco Spark) to chat with the speaker after the session How 1 Find this session in the Cisco Events App 2 Click “Join the Discussion” 3 Install Webex Teams or go directly to the team space 4 Enter messages/questions in the team space Webex Teams will be moderated cs.co/ciscolivebot#DEVNET-1365 by the speaker until June 18, 2018. #CLUS © 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 44 Preparation Steps to Follow Along (or after) Workstation Requirements • Python Windows Workstation Caveats • 2.7.10 or higher • Vagrant & VirtualBox work great • 3.6.2 or higher • Ansible not supported on Windows (control station) • pip & virtual environment • Python scripts to create Vagrant boxes • ”git” command line tools require Linux or OS X • Vagrant • VirtualBox • Homebrew (Apple OS X) #CLUS DEVNET-1365 © 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 6 Setup your Workstation • Clone the Repository • Setup Python Virtual Environment • Get Vagrant Box # From your “code” directory $ https://github.com/CiscoDevNet/learning_lab_vagrant_netprog_code $ cd learning_lab_vagrant_netprog_code $ ls –l README.md lab01 lab02 lab03 $ virtualenv venv --python=python3.6 $ source venv/bin/activate $ pip install –r lab03/requirements.txt #CLUS DEVNET-1365 © 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 7 Vagrant 101 Development Environments Made Easy • Open Source Develop Tooling by lab\ $ vagrant init nxos/7.0.3.I7.3 lab\ $ vagrant up HashiCorp Bringing machine 'default' up with 'virtualbox' www.vagrantup.com provider... ==> default: Importing box ‘nxos/7.0.3.I7.3'... ==> default: Forwarding ports... • Simple configuration file stored default: 830 (guest) => 2223 (host) with code default: 80 (guest) => 2224 (host) default: 443 (guest) => 2225 (host) • “easy to configure, reproducible, default: 22 (guest) => 2222 (host) and portable work environments” lab\ $ vagrant ssh Nexus9000v# • Multi-Platform for both guest and host #CLUS DEVNET-1365 © 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 9 Key Terms and Concepts • Vagrantfile (venv) lab\ $ ls lab02/ Vagrantfile • Configuration file for vagrant (venv) lab\ $ vagrant box list • centos/7 (virtualbox, 1611.01) Box iosxe/16.06.02 (virtualbox, 0) • Base images for different iosxr/6.1.2 (virtualbox, 0) nxos/7.0.3.I7.3 (virtualbox, 0) individual environments ubuntu/trusty64 (virtualbox, 20160323.0.0) • Provider (venv) lab\ $ vagrant box add nxos/7.0.3.I7.3 n9000v.box • Virtualization technology (venv) lab\ $ vagrant global-status used by vagrant id name provider state directory ------------------------------------------------------- • Default is VirtualBox, many 8d1eaec default virtualbox saved ~/coding/BRKDEV-1368 other supported #CLUS DEVNET-1365 © 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 10 Vagrant Commands • vagrant init box name • vagrant provision • Initialize a new Vagrantfile in a • Re-run configured provisioner (eg Ansible) directory • vagrant box list • vagrant up / halt / destroy • Display list of available boxes • Start, stop, and delete an environment • vagrant status / global-status • Display current status of environments • Vagrant suspend / resume lab\ $ vagrant suspend • Pause and restart an environment ==> default: Saving VM state and suspending • vagrant ssh [machine] lab\ $ vagrant resume ==> default: Resuming suspended VM... • Connect via SSH to a running environment lab\ $ vagrant port 830 (guest) => 2223 (host) • vagrant port 22 (guest) => 2222 (host) • View the nat’d ports for the lab\ $ vagrant ssh environment Nexus9000v# #CLUS DEVNET-1365 © 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 11 Explore Vagrant with Basic Linux VMs • Create new project directory lab\ $ mkdir vagrant_explore lab\ $ cd vagrant_explore • Initialize a new Vagrant environment vagrant_explore\ $ vagrant init hashicorp/precise64 • Bring it up vagrant_explore\ $ vagrant up #CLUS DEVNET-1365 © 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 12 Explore Vagrant with Basic Linux VMs • Connect to your environment vagrant_explore\ $ vagrant ssh with SSH # Now you’re inside the Vagrant VM • vagrant@precise64:~$ Explore lifecycle operations of vagrant@precise64:~$ pwd Vagrant vagrant@precise64:~$ exit # Back on your local workstation vagrant_explore\ $ vagrant status vagrant_explore\ $ vagrant suspend vagrant_explore\ $ vagrant resume vagrant_explore\ $ vagrant reload vagrant_explore\ $ vagrant destroy #CLUS DEVNET-1365 © 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 13 Vagrantfile Basics # -*- mode: ruby -*- # vi: set ft=ruby : Vagrant is a Ruby application # All Vagrant configuration is done below. The "2" in Vagrant.configure # configures the configuration version (we support older styles for Majority of default # backwards compatibility). Please don't change it unless you know what Vagrantfile is comments # you're doing. Vagrant.configure("2") do |config| Start Configuration Block # Every Vagrant development environment requires a box. # You can search for boxes at https://vagrantcloud.com/search. config.vm.box = "hashicorp/precise64" Identify the box to use end End Configuration Block Note: Vagrant Boxes can include default settings* Partial* fileSimplified output displayed and editedfor presentation sample #CLUS DEVNET-1365 © 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 14 Our first network vagrant up! Initialize your Vagrantfile lab\ $ cd lab01/ • View available boxes hands_on_1\ $ vagrant box list • Initialize new Vagrant File hands_on_1\ $ vagrant box add nxos/7.0.3.I7.3 ~/Downloads/nxosv-final.7.0.3.I7.3.box –force hands_on_1\ $ vagrant init nxos/7.0.3.I7.3 hands_on_1\ $ open Vagrantfile #CLUS DEVNET-1365 © 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 16 Vagrantfile Basics (for Network Devices) # -*- mode: ruby -*- # vi: set ft=ruby : Vagrant.configure("2") do |config| # Every Vagrant development environment requires a box. You can search for Box Name # boxes at https://atlas.hashicorp.com/search. config.vm.box = ”nxos/7.0.3.I7.3" config.ssh.insert_key = false Don’t insert Vagrant public key. Recommended # Create a forwarded port mapping which allows access to a specific port # within the machine from a port on the host machine. config.vm.network "forwarded_port", guest: 830, host: 2223, id: "netconf" Forward local ports for config.vm.network "forwarded_port", guest: 80, host: 2224, id: ”http" API/App access. config.vm.network "forwarded_port", guest: 443, host: 2225, id: "restconf-ssl" SSH is forwarded by default # Create a private network, which allows host-only access to the machine # using a specific IP. config.vm.network :private_network, virtualbox__intnet: "link1", auto_config: false Create environment config.vm.network :private_network, virtualbox__intnet: "link2", auto_config: false networks. end ”eth1” connected to host by default Note: Vagrant Boxes can include default settings * Simplified and edited sample #CLUS DEVNET-1365 © 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 17 Let’s add more interfaces and open up API Access • Open Vagrantfile • Add port forwarding • Add 2 Interfaces to Configuration • Specific positioning in file is irrelevant * Simplified and edited sample • * Must be within |config| block Vagrant.configure("2") do |config| config.vm.box = "nxos/7.0.3.I7.3" # Forward API Port config.vm.network :forwarded_port, guest: 80, host: 2224, id: 'http' # Create a private networks config.vm.network :private_network, virtualbox__intnet: "link1", auto_config: false config.vm.network :private_network, virtualbox__intnet: "link2", auto_config: false end or cp Vagrantfile.solution Vagrantfile #CLUS DEVNET-1365 © 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 18 Start a Vagrant Environment lab01\ $ vagrant up • Start environment # Known ssh bug • View NAT’d ports for APIs # vagrant up 2nd time lab01\ $ vagrant up • Connect to running switch lab01\ $ vagrant port lab01\ $ vagrant ssh Note: Due to the nature of the Nexus 9000v shell, vagrant will report an error after starting the VM. This is expected, and does not indicate a problem. Simply enter vagrant up again to complete the setup successfully. #CLUS DEVNET-1365 © 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 19 Explore the Vagrant Environment # Run from Vagrant Environment (ie vagrant ssh) • Baseline Configurations n9kv1# sh run | inc "username vagrant" • Logins – User / Cert Nexus9000v# sh run int mgmt0 • APIs Nexus9000v# sh run | inc feature • Interfaces Nexus900v# conf t • Open NX-API Developer Nexus9000v(config)# feature nxapi Sandbox # Exit from Vagrant Environment http://127.0.0.1:2224 • Make an API Call #CLUS DEVNET-1365 © 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 20 Destroy Hands on Demo 1 lab01\ $ vagrant destroy • Destroy this environment #CLUS DEVNET-1365 © 2018 Cisco and/or its affiliates. All rights reserved. Cisco Public 21 Vagrant + Ansible Provisioning Come on..
Recommended publications
  • Devops with Vagrant and KVM/Qemu Hiroshi Miura (@Miurahr) NTT DATA Corporation
    CloudOpen Japan 2014 DevOps with Vagrant and KVM/qemu Hiroshi Miura (@miurahr) NTT DATA Corporation. Copyright © 2013 NTT DATA Corporation Disclaimer Any product name, service name, software name and other marks are trade mark or registered mark of corresponding companies. This presentation is in a purpose of providing current information on emerging technologies and there is no grantee of correctness and/or persistence of features in any future. A presenter and NTT Data Corporation provide information in as-is basis and have no responsiveness for results that you got according to information in this presentation material. Copyright © 2014 NTT DATA Corporation 2 Who am I? • Production work • OpenStack SI team • Swift object storage • OSS devel: • Vagrant-KVM • Linux Kernel • etc… Github.com/nttdata-osscloud Github.com/miurahr Copyright © 2014 NTT DATA Corporation 3 Agenda 1. What is DevOps 2. Introduction to Vagrant 3. Vagrant-KVM 4. Infrastructure chages 5. Future Copyright © 2014 NTT DATA Corporation 4 What is DevOps? Mike Loukides, 2012, @Velocity conference “If you're going to do operations reliably, you need to make it reproducible and programmatic.” Copyright © 2014 NTT DATA Corporation 5 What is DevOps? • The nature of “operations” Cloud changes • Growing distributed systems • Software development practice • “cooperation and collaboration” between dev and ops Copyright © 2014 NTT DATA Corporation 6 DevOps for developer • Gap between Development and Operations • Goals • Process and approach • Tools • Infrastructure engineering becomes like a development. • Infrastructure as a code • Adoption of Vagrant Copyright © 2014 NTT DATA Corporation 7 Introduction To Vagrant Copyright © 2014 NTT DATA Corporation 8 What is Vagrant • development environment on VM, container or cloud • same • among team members.
    [Show full text]
  • Drifter Documentation Release 1.2.0
    Drifter Documentation Release 1.2.0 Gilles Crettenand, Sylvain Fankhauser, Christian Stocker and contributors Aug 27, 2019 Getting Started 1 Goals 3 2 The idea behind the framework5 3 What this framework is not ?7 4 Intended Public 9 4.1 Requirements...............................................9 4.2 Usage................................................... 10 4.3 Customization.............................................. 11 4.4 Contributing............................................... 11 4.5 System Roles............................................... 11 4.6 Webserver Roles............................................. 13 4.7 Database Roles.............................................. 15 4.8 PHP Roles................................................ 16 4.9 Python Roles............................................... 18 4.10 Ruby Roles................................................ 19 4.11 Java Roles................................................ 20 4.12 Webpack................................................. 21 4.13 Gulp Role................................................. 23 4.14 Browser Roles.............................................. 24 4.15 Other Roles................................................ 25 4.16 PHP.................................................... 26 4.17 CI..................................................... 27 4.18 Running and writing tests........................................ 29 4.19 The future ?................................................ 29 4.20 Create boxes..............................................
    [Show full text]
  • Test Kitchen, Inspec Docker - Fastest Way to Run Stuff (Virtual Virtual Machines) DOCKER
    TEST DRIVEN INFRASTRUCTURE COMPLIANCE AS CODE by Joaquín Menchaca À PROPOS DE MOI ABOUT ME ROCKET LAWYER SENIOR DEVOPS BUILD/RELEASE ENGINEER aka Linux Ninja Pants Automation Engineering Mutant actual photo https://slides.com/devopsstu dio/lisa18_tdi AGENDA 1. Setup 2. Context 3. Chef + InSpec 4. Ansible + InSpec 5. Bonus SETUP THE CODE https://github.com/darkn3rd/lisa18_t est_driven_infra CODE git clone \ https://github.com/darkn3rd/lisa18_test_driven_infra cd lisa18_test_driven_infra # Using Virtual Workstation vagrant up vagrant ssh cd lisa18_test_driven_infra # Using Host (MacOS X or Linux) #### Install Requirements # Using Host (Windows) #### Install Rrequiremnts #### Warning: Might not work, had success w/ Chef THE HOST SETUP must be able to run Docker or Vagrant MINIMUM REQUIRED ChefDK - bundles ruby, test kitchen, inspec Docker - fastest way to run stuff (virtual virtual machines) DOCKER Easiest Path is Docker Desktop DOCKER PACKAGE MANAGERS choco install docker-for-windows https://chocolatey.org/ brew cask install docker https://brew.sh/ DIRECT DOWNLOAD https://www.docker.com/products/docker-desktop DOCKER Debian Package on Ubuntu sudo apt-get update -qq sudo apt-get install -y apt-transport-https \ curl ca-certificates software-properties-common DOCKER_REPO="https://download.docker.com/linux/ubuntu" curl -fsSL ${DOCKER_REPO}/gpg | \ sudo apt-key add - sudo add-apt-repository \ "deb [arch=amd64] ${DOCKER_REPO} \ $(lsb_release -cs) \ stable" sudo apt-get update -qq sudo apt-get install -y docker-ce sudo usermod -aG docker $USER
    [Show full text]
  • Chapter 2 - Local Infrastructure Development: Ansible and Vagrant
    Chapter 2 - Local Infrastructure Development: Ansible and Vagrant Prototyping and testing with local virtual machines Ansible works well with any server to which you can connect—remote or local. For speedier testing and development of Ansible playbooks, and for testing in general, it’s a very good idea to work locally. Local development and testing of infrastructure is both safer and faster than doing it on remote/live machines—especially in production environments! In the past decade, test-driven development (TDD), in one form or another, has become the norm for much of the software industry. Infrastructure development hasn’t been as organized until recently, and best practices dictate that infrastructure (which is becoming more and more important to the software that runs on it) should be thoroughly tested as well. Changes to software are tested either manually or in some automated fash- ion; there are now systems that integrate both with Ansible and with other deployment and configuration management tools, to allow some amount of infrastructure testing as well. Even if it’s just testing a configuration change locally before applying it to production, that approach is a thousand times better than what, in the software development world, would be called ‘cowboy coding’—working directly in a production environment, not documenting or encapsulating changes in code, and not having a way to roll back to a previous version. The past decade has seen the growth of many virtualization tools that allow for flexible and very powerful infrastructure emulation, all from your local workstation! Chapter 2 - Local Infrastructure Development: Ansible and Vagrant 10 It’s empowering to be able to play around with a config file, or to tweak the order of a server update to perfection, over and over again, with no fear of breaking an important server.
    [Show full text]
  • (Php)Storming Wordpress a Remote Debugging Experience Introduction
    (Php)Storming WordPress A remote debugging experience Introduction / Andrea Fuggetta / Senior software engineer at Ndevr, Inc. - https://ndevr.io/ / Some of the projects I worked on: About Us / Since 2015 / Distributed / 50% Located in NY/NJ Metro / Average experience over 15 years Outline / Tools and software / Setting up Xdebug / Setting up PhpStorm / Setting up your terminal / Let’s code! – Debugging case scenarios: / WordPress theme / WP-CLI application / PHPUnit test / References / Q&A Tools and software / PhpStorm / Google Chrome w/ Xdebug helper / Terminal / Vagrant / Xdebug / PHPUnit / WP-CLI Setting up Xdebug / Info on https://xdebug.org/docs/install / Installation on Mac OSX via Homebrew: # brew install <php-version>-xdebug / Installation on Linux via apt-get: # sudo apt-get install <php-version>-xdebug / Php.ini: Add: zend_extension="/path-to/xdebug.so" [Xdebug] xdebug.remote_enable=1 xdebug.remote_port=“9000” Debugging / Breakpoint: line break where an application suspends execution allowing you to examine data / Step-over: runs code in current line and moves to next code statement / Step-into: moves into functions/methods if any are present in current line / Step-out: runs current function/method and returns to previous execution point Listens for connections Setting up PhpStorm / Enable external connections and set correct port / More info can be found at https://www.jetbrains.com/help/phpstorm/2016.2/configuring-xdebug.html Setting up PhpStorm / Zero-configuration debugging / Create a new remote debug configuration / Important
    [Show full text]
  • Phpstorm by Jetbrains
    PhpStorm by JetBrains PHP IDE with refactorings, code completion, on-the-fly code analysis and coding productivity orientation. PhpStorm provides a rich and intelligent code editor for PHP with syntax highlighting, extended code formatting configuration, on-the-fly error checking, and smart code completion. PhpStorm is an IDE for HTML, JavaScript and PHP. PhpStorm code completion (Ctrl + Space) finalizes classes, methods, variable names, and PHP keywords, plus commonly used names for fields and variables depending on their type. PhpStorm editor respects PHPDoc in your code and provides appropriate code completion suggestions based on @property, @method and @var annotations. When you edit the PHPDoc for your code with PhpStorm, the variables names and types are auto-completed from the corresponding code blocks. PHP code refactorings also consider PHPDocs to keep them up-to- date. PhpStorm IDE allows to use Smarty template engine and offers productivity features for working with .tpl files. Thorough source code analysis allows PhpStorm to provide a sophisticated code completion even to an unannotated code. PHP IDE with refactorings, code completion, on-the-fly code analysis and coding productivity orientation. PhpStorm provides a rich and intelligent code editor for PHP with syntax highlighting, extended code formatting configuration, on-the-fly error checking, and smart code completion. PhpStorm is an IDE for HTML, JavaScript and PHP. PhpStorm code completion (Ctrl + Space) finalizes classes, methods, variable names, and PHP keywords, plus commonly used names for fields and variables depending on their type. PhpStorm editor respects PHPDoc in your code and provides appropriate code completion suggestions based on @property, @method and @var annotations.
    [Show full text]
  • Moving Towards Devops with Vagrant
    MOVING TOWARDS DEVOPS WITH VAGRANT Malathy Ramani Consultant, IT Infrastructure Dell Technologies [email protected] [email protected] Knowledge Sharing Article © 2019 Dell Inc. or its subsidiaries. Table of Contents Preface .......................................................................................................................................................... 3 The need for DevOps and why it came into existence ................................................................................. 4 DevOps with Vagrant .................................................................................................................................... 5 Vagrant Terminology .................................................................................................................................... 6 An Infrastructure stack in miniature with Vagrant ....................................................................................... 7 Architecture .................................................................................................................................................. 7 Setting up Vagrant/Oracle Virtual box .......................................................................................................... 8 APP Server/ Ansible Setup .......................................................................................................................... 10 Setting up Web Server ...............................................................................................................................
    [Show full text]
  • Getting Started with Vagrant
    GETTING STARTED WITH VAGRANT Vagrant is a tool that manages virtual machines for you, using a simplified command line interface. It reads from a configuration file, named “Vagrantfile”, to build the virtual machine initially. It handles networking and port forwarding, setting up shared folders, and has commands to SSH into the box, suspend and resume your VM, etc. Vagrant’s big selling point is that it can create identical virtual machines every time, based off of a simple config file. These VMs are disposable, you can destroy and recreate them as needed. Since Vagrant’s inception in early 2010, it has grown to be used by thousands of companies worldwide, including Puppet Labs, BBC, Mozilla, Nokia, and many others. 1. Installing Vagrant The first step for getting started with Vagrant is to install Vagrant and it’s dependency, VirtualBox. Vagrant can work with other providers, such as VMWare Workstation, but it requires additional work and sometimes paid plugins. It’s easiest to get started with VirtualBox, which is free, and has versions for Windows, Mac and Linux. 1. Install Oracle VirtualBox for your platform 2. Download the extension pack (Oracle VM VirtualBox Extension Pack) for all supported platforms, and install it by double clicking on the downloaded file once VirtualBox has been installed. 3. Navigate to the Vagrant website, and click Download. Download the newest version for your operating system. 4. Install Vagrant using the installer you downloaded 5. You should now have access to the vagrant command from your command line 2. Create your first VM If you want to create a new Vagrantfile: 1.
    [Show full text]
  • Chassis Documentation Release 3.2.0
    Chassis Documentation Release 3.2.0 Ryan McCue & Bronson Quick Sep 09, 2021 Contents 1 User Guide 3 1.1 Introduction...............................................3 1.2 Quickstart................................................4 1.3 Configuration...............................................6 1.4 Guides.................................................. 14 1.5 Inside the Box.............................................. 21 1.6 Extending Chassis............................................ 22 1.7 Reference................................................. 25 Index 29 i ii Chassis Documentation, Release 3.2.0 Chassis is an open source virtual server for your WordPress site, built using Vagrant.(Quickstart) Many people are still using their main computer for local development. However, this can be a huge pain when bringing new developers up to speed on a project, or trying to get non-developers (designers, managers, clients) running a site. The concept of virtual machines for servers has become popular recently, but too many of these projects are focussed around specific uses, and include many things not everyone needs. They can end up massively increasing development time by introducing long waiting times, or huge context switches. Chassis takes care of setting up a local server in an optimal configuration for WordPress, and removes all the hard work. It’s fast (remember the Famous Five Minute Install?), and flexible to allow you to build how you want to. Getting started is as easy as downloading Chassis and running a single command. (We’re working on making it possible to run Chassis without ever touching the command line, but we’re not quite there.) You can contribute to Chassis on Github. Contents 1 Chassis Documentation, Release 3.2.0 2 Contents CHAPTER 1 User Guide 1.1 Introduction 1.1.1 A Story For a long time, you’ve had PHP running directly off your computer.
    [Show full text]
  • VAGRANT up and Running What Is This All About?
    VAGRANT Up and Running What is this all about? Vagrant, a person who wanders about idly and has no permanent home or employment. - dictionary.com - 2 What is this all about? Vagrant, an open-source software product for building and maintaining portable virtual development environments. - wikipedia.com - 3 What is this all about? Name: Vagrant Developer: HashiCorp Initial Release: 2010 Latest Version: 1.8.6 Written in: Ruby Operating System: Linux, FreeBSD, OS X, and Microsoft Interface: Command line Website: www.vagrantup.com 4 Why people are using it? 5 THE BASICS ▶ Introduction ▶ Basics ▶ Example THE BASICS ▶ Internals ▶ Security ▶ Future ▶ End 6 THE BASICS Terminology & Workflow 7 THE BASICS The Hashicorp Repository Contains More Than 10,000 Boxes ! 8 THE BASICS Terminology & Workflow 9 THE BASICS List of Commands $ vagrant init <box> [url] $ vagrant up $ vagrant halt $ vagrant destroy [--force] $ vagrant reload $ vagrant ssh $ vagrant status 10 THE BASICS Vagrant Init Command: $ vagrant init <box> [url] 11 THE BASICS Vagrant Init Command: $ vagrant init <box> [url] Configures which Box to use $ vagrant init ubuntu/trusty64 $ vagrant init precise64 https://iles.vagrantup.com/precise64.box $ vagrant box list hashicorp/precise64 (virtualbox, 1.1.0) ubuntu/trusty64 (virtualbox, 20160406.0.0) ubuntu_1604_x64 (virtualbox, 0) # broken! $ vagrant box remove ubuntu_1604_x64 12 THE BASICS Vagrant Init Command: $ vagrant init <box> [url] Creates a Vagrantfile within the local directory $ cat Vagrantile Vagrant.conigure(”2”) do |conig| conig.vm.box = ”ubuntu/trusty64” end $ # ”2” stands for the vagrant-version. Tip: Usually the Vagrantfile contains a lot of comments. Using vagrant init with the -m-flag will create a minimal version containing only the important entries.
    [Show full text]
  • Setting up a Vagrant Workflow
    Setting Up a Vagrant Workflow MATT SImmONS Matt Simmons is a 12+ ire. The wheel. The Internet. Microwave cheese. These are things that year system administrator we, as a species, have created and really matter to us in our daily lives, who works at the College of and that have appreciably made the world a better place. I want to cast Computer and Information F Science at Northeastern University in Boston. my vote to add Vagrant [1] to that list. He blogs at http://www.standalone-sysadmin. Remember the bad old days, when you would write configuration management code, com- com/ and can be reached via @standaloneSA mit it to a repo, check it out in the testing environment, reboot a machine, and then a few on Twitter. [email protected] minutes later figure out that you left out a semicolon, so you’d have to do it all over again? That whole workflow is so 2011. Not that long ago, I was listening to some trainers talking about offering a Vagrant Box to people attending their classes at conferences. Being the naturally inquisitive sort of person that I am, I rudely interrupted their conversation to ask what they were talking about. I learned that Vagrant was apparently a “thing” that made “VMs” from “images”. Now, I’m more than passingly familiar with the whole “virtualization” deal, so I felt like I had a decent grasp of things from that description. I mean, I didn’t think Vagrant was anything revolutionary, but I could kind of see where it was going.
    [Show full text]
  • Creating Development Environments with Vagrant Second Edition Table of Contents
    Creating Development Environments with Vagrant Second Edition Table of Contents Creating Development Environments with Vagrant Second Edition Credits About the Author About the Reviewers www.PacktPub.com Support files, eBooks, discount offers, and more Why subscribe? Free access for Packt account holders Preface What this book covers What you need for this book Who this book is for Conventions Reader feedback Customer support Downloading the example code Errata Piracy Questions 1. Getting Started with Vagrant Introducing Vagrant Requirements for Vagrant Getting started Installing VirtualBox Installing Vagrant Summary 2. Managing Vagrant Boxes and Projects Creating our first Vagrant project Managing Vagrant-controlled guest machines Powering up a Vagrant-controlled virtual machine Suspending a virtual machine Resuming a virtual machine Shutting down a virtual machine Starting from scratch Updating based on Vagrantfile changes Connecting to the virtual machine over SSH Managing integration between host and guest machines Port forwarding Synced folders Networking Autorunning commands Managing Vagrant boxes Adding Vagrant boxes Listing Vagrant boxes Checking for updates Removing Vagrant boxes Repackaging a Vagrant box Updating the current environment’s box Too many Vagrants! Summary 3. Provisioning with Puppet Provisioning Puppet Creating modules and manifests with Puppet Puppet classes Default Puppet manifests Resources Resource requirements Resource execution ordering The notify, subscribe, and refreshonly parameters Executing resources in stages Installing software Updating our package manager Installing the nginx package Running the nginx service File management Copying a file Creating a symlink Creating folders Creating multiple folders in one go Cron management Running commands Managing users and groups Creating groups Creating users Updating the sudoers file Creating configurable classes Puppet modules Using Puppet to provision servers Summary 4.
    [Show full text]