├── .gitignore ├── README.md ├── data └── synchedfile.txt ├── lab1-firstvm ├── .vagrant │ ├── machines │ │ └── default │ │ │ └── virtualbox │ │ │ ├── action_provision │ │ │ ├── action_set_name │ │ │ ├── box_meta │ │ │ ├── creator_uid │ │ │ ├── id │ │ │ ├── index_uuid │ │ │ ├── private_key │ │ │ ├── synced_folders │ │ │ └── vagrant_cwd │ └── rgloader │ │ └── loader.rb ├── README.md ├── Vagrantfile └── mynewfile.txt ├── lab2-moreoptions ├── README.md ├── Vagrantfile └── copiedfile.txt ├── lab3-vagrant-workflows ├── README.md └── Vagrantfile └── lab4-multiple_hosts ├── Vagrantfile └── copiedfile.txt /.gitignore: -------------------------------------------------------------------------------- 1 | #Ignore hidden vagrant directories 2 | */.vagrant 3 | #Leave workspace folder empty 4 | workspace/* 5 | 6 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # DevOps Journey - Vagrant Labs 2 | 3 | Youtube URL: https://www.youtube.com/channel/UC4Snw5yrSDMXys31I18U3gg/ 4 | 5 | 6 | ## How to use these Labs 7 | 1. Install Vagrant: https://www.vagrantup.com/downloads.html 8 | 9 | 2. Install Oracle Virtual Box: https://www.virtualbox.org/ 10 | 11 | 3. In a new Directory clone this respository: 12 | ``` shell 13 | git clone https://github.com/bradmorg/vagrant-labs.git 14 | ``` 15 | 4. go into the lab folder corrasponding to the video you are watching. Example: 16 | ``` shell 17 | cd lab1-firstvm 18 | ``` 19 | 5. Initialize the VM using vagrant init 20 | ``` shell 21 | vagrant init bento/ubuntu-18.04 22 | ``` 23 | 6. SSH into the VM 24 | 25 | ``` shell 26 | vagrant ssh 27 | ``` -------------------------------------------------------------------------------- /data/synchedfile.txt: -------------------------------------------------------------------------------- 1 | This file will be shared to virtual machines 2 | 3 | these changes will be synched -------------------------------------------------------------------------------- /lab1-firstvm/.vagrant/machines/default/virtualbox/action_provision: -------------------------------------------------------------------------------- 1 | 1.5:09b992d2-a155-446c-bc5b-9f78f6f0c17b -------------------------------------------------------------------------------- /lab1-firstvm/.vagrant/machines/default/virtualbox/action_set_name: -------------------------------------------------------------------------------- 1 | 1584750613 -------------------------------------------------------------------------------- /lab1-firstvm/.vagrant/machines/default/virtualbox/box_meta: -------------------------------------------------------------------------------- 1 | {"name":"bento/ubuntu-18.04","version":"201912.14.0","provider":"virtualbox","directory":"boxes/bento-VAGRANTSLASH-ubuntu-18.04/201912.14.0/virtualbox"} -------------------------------------------------------------------------------- /lab1-firstvm/.vagrant/machines/default/virtualbox/creator_uid: -------------------------------------------------------------------------------- 1 | 0 -------------------------------------------------------------------------------- /lab1-firstvm/.vagrant/machines/default/virtualbox/id: -------------------------------------------------------------------------------- 1 | 09b992d2-a155-446c-bc5b-9f78f6f0c17b -------------------------------------------------------------------------------- /lab1-firstvm/.vagrant/machines/default/virtualbox/index_uuid: -------------------------------------------------------------------------------- 1 | 38e6268e42c6406799e9adaf9c885778 -------------------------------------------------------------------------------- /lab1-firstvm/.vagrant/machines/default/virtualbox/private_key: -------------------------------------------------------------------------------- 1 | -----BEGIN RSA PRIVATE KEY----- 2 | MIIEpAIBAAKCAQEAtvVDFTlXGOXC90lnLosmv9ZZ/QfKqigmiHX1yTbbSWqc+Wr+ 3 | 8TJYA0KzbsvEgCPlhKcgNeYzB6hlFaxvV3pAyV1QXqVSWHKnUinsG+mN1IWjlRt3 4 | IzjEsVNApOp1eaQujeM9GsSppWEzPNrHkI6Zo+o3cJrhC3ufXxyYpGflMXQgW8xr 5 | EGEUuP3o757JST5skmBb7ZPCpM83NCsoWU73zrxBX2GXIUBa4bTw1AsMbs4LfsSx 6 | Cui3HL5pAqPeSZXJJJW/yOYlFr779bWqmnas0MssxFfrAwYq0gVImUSBqU2IzFXs 7 | pgZ+3ZUKiMXPy0FwLujIYq1jeebQHVkxqEaAFQIDAQABAoIBACnyncjV9sQ8mbD8 8 | 4W1odh/x03wSN0NAJWWQNiRGMYzppsgA4icG9er5dg5nJcyDbnI1p0r0Vqrgzxxj 9 | Brw1yXjhr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k8rrZJ 25 | dN/famGMWViO7fqIWNP4PWEvSvwkS018tYtlAGeTgbAl/tBg9Y3q/Zsjq45W7jQh 26 | +RLg1V+kNk/rBgBA+ruPcw7+ARyQfM/t8vzJRjOHkpu7XqnzzxgTCQ== 27 | -----END RSA PRIVATE KEY----- 28 | -------------------------------------------------------------------------------- /lab1-firstvm/.vagrant/machines/default/virtualbox/synced_folders: -------------------------------------------------------------------------------- 1 | {"virtualbox":{"/vagrant":{"guestpath":"/vagrant","hostpath":"C:/code/vagrant/vagrant-course/lab1-firstvm","disabled":false,"__vagrantfile":true}}} -------------------------------------------------------------------------------- /lab1-firstvm/.vagrant/machines/default/virtualbox/vagrant_cwd: -------------------------------------------------------------------------------- 1 | C:/code/vagrant/vagrant-course/lab1-firstvm -------------------------------------------------------------------------------- /lab1-firstvm/.vagrant/rgloader/loader.rb: -------------------------------------------------------------------------------- 1 | # This file loads the proper rgloader/loader.rb file that comes packaged 2 | # with Vagrant so that encoded files can properly run with Vagrant. 3 | 4 | if ENV["VAGRANT_INSTALLER_EMBEDDED_DIR"] 5 | require File.expand_path( 6 | "rgloader/loader", ENV["VAGRANT_INSTALLER_EMBEDDED_DIR"]) 7 | else 8 | raise "Encoded files can't be read outside of the Vagrant installer." 9 | end 10 | -------------------------------------------------------------------------------- /lab1-firstvm/README.md: -------------------------------------------------------------------------------- 1 | # Vagrant Lab - Getting Started with Vagrant 2 | 3 | Youtube URL: 4 | 5 | ## How to use these Labs 6 | 1. Install Vagrant: https://www.vagrantup.com/downloads.html 7 | 8 | 2. Install Oracle Virtual Box: https://www.virtualbox.org/ 9 | 10 | 3. In a new Directory clone this respository: 11 | ``` shell 12 | git clone https://github.com/bradmorg/vagrant-labs.git 13 | ``` 14 | 4. go into the lab folder corrasponding to the video you are watching 15 | ``` shell 16 | cd lab1-firstvm 17 | ``` 18 | 5. Initialize the VM using vagrant init 19 | ``` shell 20 | vagrant init bento/ubuntu-18.04 21 | ``` 22 | 6. SSH into the VM 23 | 24 | ``` shell 25 | vagrant ssh 26 | ``` -------------------------------------------------------------------------------- /lab1-firstvm/Vagrantfile: -------------------------------------------------------------------------------- 1 | Vagrant.configure("2") do |config| 2 | config.vm.box = "bento/ubuntu-18.04" 3 | config.vm.hostname = "vm1" 4 | config.vm.network "private_network", ip: "172.16.1.10" 5 | end 6 | -------------------------------------------------------------------------------- /lab1-firstvm/mynewfile.txt: -------------------------------------------------------------------------------- 1 | asdf 2 | asdf 3 | asdf -------------------------------------------------------------------------------- /lab2-moreoptions/README.md: -------------------------------------------------------------------------------- 1 | # Vagrant Labs - Advanced VagrantFile Configuration 2 | 3 | Youtube URL: 4 | 5 | 6 | 7 | ## Commands used 8 | 1. Bring up the vagrant instance 9 | ``` shell 10 | vagrant up 11 | ``` 12 | 2. Log into Virtual Machine 13 | ``` shell 14 | vagrant ssh 15 | ``` -------------------------------------------------------------------------------- /lab2-moreoptions/Vagrantfile: -------------------------------------------------------------------------------- 1 | Vagrant.configure("2") do |config| 2 | config.vm.box = "bento/ubuntu-18.04" 3 | config.vm.hostname = "vm1" 4 | config.vm.network "private_network", ip: "172.16.1.10" 5 | config.vm.synced_folder "../data", "/home/vagrant/data" 6 | config.vm.provision "file", source: "./copiedfile.txt", destination: "/home/vagrant/copiedfile.txt" 7 | 8 | config.vm.provider :virtualbox do |vb| 9 | vb.customize ["modifyvm", :id, "--memory", 1024] 10 | vb.customize ["modifyvm", :id, "--cpus", 2] 11 | end 12 | end 13 | -------------------------------------------------------------------------------- /lab2-moreoptions/copiedfile.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/devopsjourney1/vagrant-labs/7e20adbeca440368d78cd15f3f85fa8a1efcfbe5/lab2-moreoptions/copiedfile.txt -------------------------------------------------------------------------------- /lab3-vagrant-workflows/README.md: -------------------------------------------------------------------------------- 1 | # Vagrant Labs - Vagrant Workflows 2 | 3 | Youtube URL: 4 | 5 | 6 | 7 | ## Commands used 8 | 1. Bring up the vagrant instance 9 | ``` shell 10 | vagrant up 11 | ``` 12 | 2. Get Status of Local Vagrant Machine 13 | ``` shell 14 | vagrant status 15 | ``` 16 | 17 | 3. Get Status of Vagrant Machines on host 18 | ``` shell 19 | vagrant global-status 20 | ``` 21 | 22 | 4. Get SSH Settings 23 | ``` shell 24 | vagrant ssh-config 25 | ``` 26 | 27 | 5. Stop Virtual Machine 28 | ``` shell 29 | vagrant reload 30 | ``` 31 | 32 | 6. Stop Virtual Machine 33 | ``` shell 34 | vagrant halt 35 | ``` 36 | 37 | 7. Remove the Virtual Machine 38 | ``` shell 39 | vagrant ssh 40 | ``` 41 | -------------------------------------------------------------------------------- /lab3-vagrant-workflows/Vagrantfile: -------------------------------------------------------------------------------- 1 | Vagrant.configure("2") do |config| 2 | config.vm.box = "bento/ubuntu-18.04" 3 | config.vm.hostname = "vm1" 4 | config.vm.network "private_network", ip: "172.16.1.10" 5 | config.vm.synced_folder "../data", "/home/vagrant/data" 6 | config.vm.provision "file", source: "./copiedfile.txt", destination: "/home/vagrant/copiedfile.txt" 7 | 8 | config.vm.provider :virtualbox do |vb| 9 | vb.customize ["modifyvm", :id, "--memory", 1024] 10 | vb.customize ["modifyvm", :id, "--cpus", 2] 11 | end 12 | end 13 | -------------------------------------------------------------------------------- /lab4-multiple_hosts/Vagrantfile: -------------------------------------------------------------------------------- 1 | Vagrant.configure("2") do |config| 2 | servers=[ 3 | { 4 | :hostname => "Server1", 5 | :box => "bento/ubuntu-18.04", 6 | :ip => "172.16.1.50", 7 | :ssh_port => '2200' 8 | }, 9 | { 10 | :hostname => "Server2", 11 | :box => "bento/ubuntu-18.04", 12 | :ip => "172.16.1.51", 13 | :ssh_port => '2201' 14 | }, 15 | { 16 | :hostname => "Server3", 17 | :box => "bento/ubuntu-18.04", 18 | :ip => "192.168.56.102", 19 | :ssh_port => '2202' 20 | } 21 | ] 22 | 23 | servers.each do |machine| 24 | config.vm.define machine[:hostname] do |node| 25 | node.vm.box = machine[:box] 26 | node.vm.hostname = machine[:hostname] 27 | node.vm.network :private_network, ip: machine[:ip] 28 | node.vm.network "forwarded_port", guest: 22, host: machine[:ssh_port], id: "ssh" 29 | node.vm.synced_folder "../data", "/home/vagrant/data" 30 | node.vm.provision "file", source: "./copiedfile.txt", destination: "/home/vagrant/copiedfile.txt" 31 | 32 | node.vm.provider :virtualbox do |vb| 33 | vb.customize ["modifyvm", :id, "--memory", 512] 34 | vb.customize ["modifyvm", :id, "--cpus", 1] 35 | end 36 | end 37 | end 38 | end 39 | -------------------------------------------------------------------------------- /lab4-multiple_hosts/copiedfile.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/devopsjourney1/vagrant-labs/7e20adbeca440368d78cd15f3f85fa8a1efcfbe5/lab4-multiple_hosts/copiedfile.txt --------------------------------------------------------------------------------