Commit ed1d9878 authored by Dmitry Duplyakin's avatar Dmitry Duplyakin

Improve Chef tutorial

- Major improvements in the Apache section, including more instructions and new screenshots
- First draft of the Final Remarks section
- All code snippets use new the @verbatim{} style (with highlighting for commands)
parent 08978f2b
This diff is collapsed.
Dear User,
Chef server and workstataion should now be
installed on head.chefdemo.utahstud.emulab.net.
To explore the web management console, copy
this hostname and paste it into your browser.
Installation log can be found at /var/log/init-chef.log
on the server node.
To authenticate, use the unique credentials
saved in /root/.chefauth on the server node.
Below are several Chef commands which detail the launched experiment:
# chef -v
Chef Development Kit Version: 0.7.0
chef-client version: 12.4.1
berks version: 3.2.4
kitchen version: 1.4.2
# knife cookbook list
apache2 3.1.0
apt 2.9.2
emulab-apachebench 1.0.0
emulab-nfs 0.1.0
...
nfs 2.2.6
# knife node list
head
node-0
# knife role list
apache2
apachebench
...
nfs
# knife status -r
1 minute ago, head, [], ubuntu 14.04.
0 minutes ago, node-0, [], ubuntu 14.04.
Happy automation with Chef!
#
# Cookbook Name:: emulab-nfs
# Recipe:: default
#
if node['hostname'] == node["nfs"]["server"]
include_recipe "emulab-nfs::export"
else
include_recipe "emulab-nfs::mount"
end
root@head:~# knife node run_list add head "role[apache2]"
head:
run_list:
role[nfs]
role[apache2]
root@head:~# knife ssh "name:*" chef-client
apt155.apt.emulab.net Starting Chef Client, version 12.7.2
apt154.apt.emulab.net Starting Chef Client, version 12.4.1
apt155.apt.emulab.net resolving cookbooks for run list:
["emulab-nfs", "apache2", "apache2::mod_autoindex", "emulab-apachebench"]
apt154.apt.emulab.net resolving cookbooks for run list:
["emulab-nfs", "apache2", "apache2::mod_autoindex"]
apt155.apt.emulab.net Synchronizing Cookbooks:
apt155.apt.emulab.net Compiling Cookbooks...
apt154.apt.emulab.net Synchronizing Cookbooks:
....
apt155.apt.emulab.net Running handlers:
apt155.apt.emulab.net Running handlers complete
apt155.apt.emulab.net Chef Client finished, 5/123 resources updated in 04 seconds
root@head:~# knife ssh "name:*" 'netstat -ntpl | grep 8080'
apt154.apt.emulab.net tcp6 0 0 :::8080 :::* LISTEN 2 7664/apache2
apt155.apt.emulab.net tcp6 0 0 :::8080 :::* LISTEN 9 808/apache2
# List files in the NFS directory /exp-share on head; should be empty
ls /exp-share/
# List the same directory remotely on node-0; also empty
ssh node-0 ls /exp-share/
# Create an empty file in this derectory locally
touch /exp-share/NFS-is-configured-by-Chef
# Find the same file on node-0
ssh node-0 ls /exp-share/
#
# This role depends on the emulab-nfs cookbook;
# emulab-nfs depends on the nfs cookbook
# available at: https://supermarket.chef.io/cookbooks/nfs
# Make sure it is installed; If it is not, try: knife cookbook site install nfs
#
name "nfs"
description "Role applied to all NFS nodes - server and client"
override_attributes(
"nfs" => {
"server" => "head",
"dir" => "/exp-share",
"export" => {
"network" => "10.0.0.0/8",
"writeable" => true
}
}
)
run_list [ "emulab-nfs" ]
root@head:~# knife node run_list add node-0 "role[apache2]"
node-0:
run_list:
role[nfs]
role[apache2]
root@head:~# knife node run_list add node-0 "role[apachebench]"
node-0:
run_list:
role[nfs]
role[apache2]
role[apachebench]
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment