-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
4d7d313
commit bab4cce
Showing
132 changed files
with
1,981 additions
and
0 deletions.
There are no files selected for viewing
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
# 1-5 Configuring Your Development Environment - Vagrant and VirtualBox | ||
# this command list is provided to accompany the demos in the Chef Fundamentals Udemy course | ||
|
||
# run these commands to ensure you're setup properly. | ||
# Commands are demonstrated on a MacOS terminal. If on a Windows machine, commands | ||
# for navigation and file manipulation may vary. | ||
# If unable to locate any of the tools, please ensure that your system path is | ||
# properly configured as documented in the setup pdf. | ||
|
||
# all commands assume working out of the home directory, ~/ | ||
|
||
# Run these commands on your local machine | ||
cd ~ | ||
chef --version | ||
chef -v | ||
vboxmanage --version | ||
vagrant --version | ||
mkdir chef | ||
cd chef/ | ||
pwd | ||
vagrant box add bento/centos-7.2 --provider=virtualbox | ||
vagrant init bento/centos-7.2 | ||
ls | ||
cat Vagrantfile | ||
vagrant up | ||
vagrant status | ||
vagrant ssh-config | ||
vagrant ssh | ||
|
||
# Run these commands on the vagrant instance after running 'vagrant ssh' | ||
vagrant@localhost$ curl https://omnitruck.chef.io/install.sh | sudo bash -s -- -P chefdk -c stable -v 0.18.30 | ||
vagrant@localhost$ chef --version | ||
vagrant@localhost$ sudo yum install nano -y | ||
vagrant@localhost$ sudo yum install vim -y | ||
vagrant@localhost$ exit | ||
|
||
|
||
# when you're done with the exercises for the moment, suspend the machine state | ||
vagrant suspend | ||
|
||
# or destroy the virtual machine | ||
vagrant destroy --force |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
# -*- mode: ruby -*- | ||
# vi: set ft=ruby : | ||
|
||
# All Vagrant configuration is done below. The "2" in Vagrant.configure | ||
# configures the configuration version (we support older styles for | ||
# backwards compatibility). Please don't change it unless you know what | ||
# you're doing. | ||
Vagrant.configure("2") do |config| | ||
# The most common configuration options are documented and commented below. | ||
# For a complete reference, please see the online documentation at | ||
# https://docs.vagrantup.com. | ||
|
||
# Every Vagrant development environment requires a box. You can search for | ||
# boxes at https://atlas.hashicorp.com/search. | ||
config.vm.box = "bento/centos-7.2" | ||
|
||
# Disable automatic box update checking. If you disable this, then | ||
# boxes will only be checked for updates when the user runs | ||
# `vagrant box outdated`. This is not runsecommended. | ||
# config.vm.box_check_update = false | ||
|
||
# Create a forwarded port mapping which allows access to a specific port | ||
# within the machine from a port on the host machine. In the example below, | ||
# accessing "localhost:8080" will access port 80 on the guest machine. | ||
|
||
config.vm.network "forwarded_port", guest: 80, host: 8090 | ||
|
||
# Create a private network, which allows host-only access to the machine | ||
# using a specific IP. | ||
# config.vm.network "private_network", ip: "192.168.33.10" | ||
|
||
# Create a public network, which generally matched to bridged network. | ||
# Bridged networks make the machine appear as another physical device on | ||
# your network. | ||
# config.vm.network "public_network" | ||
|
||
# Share an additional folder to the guest VM. The first argument is | ||
# the path on the host to the actual folder. The second argument is | ||
# the path on the guest to mount the folder. And the optional third | ||
# argument is a set of non-required options. | ||
# config.vm.synced_folder "../data", "/vagrant_data" | ||
|
||
# Provider-specific configuration so you can fine-tune various | ||
# backing providers for Vagrant. These expose provider-specific options. | ||
# Example for VirtualBox: | ||
# | ||
# config.vm.provider "virtualbox" do |vb| | ||
# # Display the VirtualBox GUI when booting the machine | ||
# vb.gui = true | ||
# | ||
# # Customize the amount of memory on the VM: | ||
# vb.memory = "1024" | ||
# end | ||
# | ||
# View the documentation for the provider you are using for more | ||
# information on available options. | ||
|
||
# Define a Vagrant Push strategy for pushing to Atlas. Other push strategies | ||
# such as FTP and Heroku are also available. See the documentation at | ||
# https://docs.vagrantup.com/v2/push/atlas.html for more information. | ||
# config.push.define "atlas" do |push| | ||
# push.app = "YOUR_ATLAS_USERNAME/YOUR_APPLICATION_NAME" | ||
# end | ||
|
||
# Enable provisioning with a shell script. Additional provisioners such as | ||
# Puppet, Chef, Ansible, Salt, and Docker are also available. Please see the | ||
# documentation for more information about their specific syntax and use. | ||
# config.vm.provision "shell", inline: <<-SHELL | ||
# apt-get update | ||
# apt-get install -y apache2 | ||
# SHELL |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
# 1-6 Configuring Your Development Environment - Amazon EC2 | ||
# this command list is provided to accompany the demos in the Chef Fundamentals Udemy course | ||
|
||
# run these commands to ensure you're setup properly. | ||
# Commands are demonstrated on a MacOS terminal. If on a Windows machine, commands | ||
# for navigation and file manipulation may vary. | ||
# If unable to locate any of the tools, please ensure that your system path is | ||
# properly configured as documented in the setup pdf. | ||
|
||
# all commands assume working out of the home directory, ~/ | ||
|
||
# Run these commands on your local machine to connect to your cloud instance | ||
cd ~ | ||
ssh -i /PATH/TO/AWS_KEY centos@PUBLIC_HOSTNAME | ||
sudo chmod 400 /PATH/TO/AWS_KEY | ||
ssh -i /PATH/TO/AWS_KEY centos@PUBLIC_HOSTNAME | ||
|
||
|
||
# Run these commands on the cloud instance after connecting with ssh | ||
centos@ip$ curl https://omnitruck.chef.io/install.sh | sudo bash -s -- -P chefdk -c stable -v 0.18.30 | ||
centos@ip$ chef --version | ||
centos@ip$ sudo yum install nano -y | ||
centos@ip$ sudo yum install vim -y | ||
centos@ip$ exit | ||
|
||
|
||
# when you're done with the exercises for the moment, exit the machine | ||
centos@ip$ exit | ||
|
||
# or consider destroying the cloud instance. Remember, these cost money over time! |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
# 1-7 Configuring Your Development Environment - Google Compute Engine | ||
# this command list is provided to accompany the demos in the Chef Fundamentals Udemy course | ||
|
||
# run these commands to ensure you're setup properly. | ||
# Commands are demonstrated on a MacOS terminal. If on a Windows machine, commands | ||
# for navigation and file manipulation may vary. | ||
# If unable to locate any of the tools, please ensure that your system path is | ||
# properly configured as documented in the setup pdf. | ||
|
||
# all commands assume working out of the home directory, ~/ | ||
|
||
# Connect to the cloud instance using the Cloud Console, or follow the | ||
# commands below to connect with an ssh client | ||
cd ~ | ||
ssh-keygen -t rsa -b 2048 -f ~/.ssh/gce | ||
cat ~/.ssh/gce.pub | ||
|
||
# After locating username and public ipaddress in the cloud console | ||
ssh -i ~/.ssh/gce username@PUBLIC_IP | ||
|
||
|
||
# Run these commands on the cloud instance after connecting with ssh | ||
username@centos7$ curl https://omnitruck.chef.io/install.sh | sudo bash -s -- -P chefdk -c stable -v 0.18.30 | ||
username@centos7$ chef --version | ||
username@centos7$ sudo yum install nano -y | ||
username@centos7$ sudo yum install vim -y | ||
username@centos7$ exit | ||
|
||
|
||
# when you're done with the exercises for the moment, exit the machine | ||
username@centos7$ exit | ||
|
||
# or consider destroying the cloud instance. Remember, these cost money over time! |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
# 1-8 Configuring Your Development Environment - Microsoft Azure | ||
# this command list is provided to accompany the demos in the Chef Fundamentals Udemy course | ||
|
||
# run these commands to ensure you're setup properly. | ||
# Commands are demonstrated on a MacOS terminal. If on a Windows machine, commands | ||
# for navigation and file manipulation may vary. | ||
# If unable to locate any of the tools, please ensure that your system path is | ||
# properly configured as documented in the setup pdf. | ||
|
||
# all commands assume working out of the home directory, ~/ | ||
|
||
# follow the commands below to connect with the Azure instance with an ssh client | ||
cd ~ | ||
ssh-keygen -t rsa -b 2048 -f ~/.ssh/azure | ||
cat ~/.ssh/azure.pub | ||
|
||
# After locating username and public ipaddress in the cloud console | ||
ssh -i ~/.ssh/azure username@PUBLIC_IP | ||
|
||
|
||
# Run these commands on the cloud instance after connecting with ssh | ||
username@centos7$ curl https://omnitruck.chef.io/install.sh | sudo bash -s -- -P chefdk -c stable -v 0.18.30 | ||
username@centos7$ chef --version | ||
username@centos7$ sudo yum install nano -y | ||
username@centos7$ sudo yum install vim -y | ||
username@centos7$ exit | ||
|
||
|
||
# when you're done with the exercises for the moment, exit the machine | ||
username@centos7$ exit | ||
|
||
# or consider destroying the cloud instance. Remember, these cost money over time! |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# 10-4 Uploading Cookbooks | ||
# this command list is provided to accompany the demos in the Chef Fundamentals Udemy course | ||
# commands that involve editing files assume nano as the text editor | ||
|
||
# run these commands on your local machine after configuring the ~/chef-repo directory | ||
# and downloading the /cookbooks to your local machine | ||
|
||
cd ~/chef-repo | ||
ls | ||
ls cookbooks/ | ||
ls -a | ||
ls .chef/ | ||
cat .chef/knife.rb | ||
knife --help | ||
knife client list | ||
knife ssl check | ||
knife cookbook --help | ||
knife cookbook list | ||
knife cookbook upload workstation | ||
knife cookbook upload apache | ||
knife cookbook list |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# 10-4 Uploading Cookbooks | ||
# this command list is provided to accompany the demos in the Chef Fundamentals Udemy course | ||
# commands that involve editing files assume nano as the text editor | ||
|
||
# run these commands on your local machine after configuring the ~/chef-repo directory | ||
# and downloading the /cookbooks to your local machine | ||
|
||
cd ~/chef-repo | ||
ls | ||
ls cookbooks/ | ||
ls -a | ||
ls .chef/ | ||
cat .chef/knife.rb | ||
knife --help | ||
knife client list | ||
knife ssl check | ||
knife cookbook --help | ||
knife cookbook list | ||
knife cookbook upload workstation | ||
knife cookbook upload apache | ||
knife cookbook list |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
# 10-5 Reconfigure Vagrant | ||
# this command list is provided to accompany the demos in the Chef Fundamentals Udemy course | ||
# commands that involve editing files assume nano as the text editor | ||
|
||
# run these commands on your local machine after copying new Vagrantfile to ~/chef-repo | ||
|
||
cd ~/chef-repo | ||
cat Vagrantfile | ||
vagrant plugin install vagrant-ohai | ||
vagrant up |
20 changes: 20 additions & 0 deletions
20
10-6 Lab Bootstrap Webserver/10-6 Lab Bootstrap a Webserver.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# 10-6 Lab: Bootstrap a Webserver | ||
# this command list is provided to accompany the demos in the Chef Fundamentals Udemy course | ||
# commands that involve editing files assume nano as the text editor | ||
|
||
# run these commands on your local machine after copying new Vagrantfile to ~/chef-repo and running 'vagrant up' | ||
|
||
cd ~/chef-repo | ||
vagrant status | ||
vagrant ssh-config | ||
knife bootstrap localhost --ssh-port PORT --ssh-user vagrant --sudo --identity-file /PATH/TO/KEY -N web1 | ||
knife node list | ||
knife node show web1 | ||
knife node run_list add web1 "recipe[workstation],recipe[apache]" | ||
knife node show web1 | ||
vagrant ssh web1 | ||
|
||
# run these commands on the web1 vagrant instance | ||
|
||
vagrant@web1$ sudo chef-client | ||
vagrant@web1$ curl localhost |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# 11-3 Wrapper Cookbooks | ||
# this command list is provided to accompany the demos in the Chef Fundamentals Udemy course | ||
# commands that involve editing files assume nano as the text editor | ||
|
||
# run these commands on your local machine after copying new Vagrantfile to ~/chef-repo and running 'vagrant up' | ||
|
||
cd ~/chef-repo | ||
pwd | ||
ls cookbooks/ | ||
chef generate cookbook cookbooks/myhaproxy | ||
ls cookbooks/ | ||
tree cookbooks/myhaproxy | ||
nano cookbooks/myhaproxy/metadata.rb | ||
cat Vagrantfile | ||
nano cookbooks/myhaproxy/recipes/default.rb |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
# chef-repo/cookbooks/myhaproxy/recipes/default.rb | ||
# | ||
# Cookbook Name:: myhaproxy | ||
# Recipe:: default | ||
# | ||
# Copyright (c) 2016 The Authors, All Rights Reserved. | ||
|
||
node.default['haproxy']['members'] = [{ | ||
'hostname' => 'WEB1_HOSTNAME', # these values come from the Vagrantfile | ||
'ipaddress' => 'WEB1_IPADDRESS', # or the public IP and hostname is using a cloud provider | ||
'port' => 80, | ||
'ssl_port' => 80 | ||
} | ||
] | ||
|
||
include_recipe 'haproxy::manual' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# chef-repo/cookbooks/myhaproxy/metadata.rb | ||
|
||
name 'myhaproxy' | ||
maintainer 'The Authors' | ||
maintainer_email '[email protected]' | ||
license 'all_rights' | ||
description 'Installs/Configures myhaproxy' | ||
long_description 'Installs/Configures myhaproxy' | ||
version '0.1.0' | ||
|
||
depends 'haproxy', '= 2.0.0' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# 11-4 Berkshelf | ||
# this command list is provided to accompany the demos in the Chef Fundamentals Udemy course | ||
# commands that involve editing files assume nano as the text editor | ||
|
||
# run these commands on your local machine after copying new Vagrantfile to ~/chef-repo and running 'vagrant up' | ||
|
||
cd ~/chef-repo | ||
cd cookbooks/myhaproxy | ||
tree | ||
cat Berksfile | ||
berks install | ||
cd ~/.berkshelf/cookbooks | ||
ls | ||
cd ~/chef-repo/cookbooks/myhaproxy | ||
cat Berksfile.lock | ||
berks upload | ||
nano recipes/default.rb | ||
berks upload | ||
knife cookbook list | ||
berks upload --force |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# 11-5 Lab: Deploy the Load balancer | ||
# this command list is provided to accompany the demos in the Chef Fundamentals Udemy course | ||
# commands that involve editing files assume nano as the text editor | ||
|
||
# run these commands on your local machine after copying new Vagrantfile to ~/chef-repo and running 'vagrant up' | ||
|
||
cd ~/chef-repo | ||
vagrant ssh-config | ||
knife bootstrap localhost --ssh-port LOAD-BALANCER_PORT --ssh-user vagrant --sudo --identity-file /PATH/TO/LB_KEY -N load-balancer --run-list "recipe[myhaproxy]" | ||
vagrant ssh load-balancer | ||
|
||
# run these commands on the load-balancer vagrant instance | ||
|
||
vagrant@web1$ curl localhost | ||
vagrant@web1$ exit |
Oops, something went wrong.