Contributors20 minutesRecall that any computer that's managed by a Chef server is called a node, and that chef-client is the command that applies the policy defined by your cookbooks to a node. We call the process that installs chef-client on a node and the initial check-in to the Chef server bootstrapping the node.
In this part you'll bootstrap your node and execute the learn_chef_apache2 cookbook on it.
1. Run the bootstrap command
knife bootstrap is the command you use to bootstrap a node. As part of the knife bootstrap command, you specify arguments depending on how you would normally connect to your node over SSH.
Key-based authentication is typically recommended over password authentication because it is more secure, but you can bootstrap your node using either method. If you're bootstrapping a local virtual machine, you may also have to specify the SSH forwarded port.
In each of the methods shown below, the --node-name argument uniquely identifies the node with the Chef server. Its value can be whatever you want. If you previously used the name node1-ubuntu to bootstrap a different node, you can respond with 'Y' to overwrite that node's entry on your Chef server. Alternatively, you can choose a different name or remove the previous node from your Chef server.
- If you're bootstrapping a Microsoft Azure instance
Later in this module, you'll use Chef's ability to search node metadata to run chef-client a second time on your node. That step will require your node to have an attribute that contains its public hostname or IP address.
Because Azure does not provide metadata about an instance's public hostname or IP address, you need to set it manually during the bootstrap process.
If you're using an Azure instance as your node, append the --json-attributes argument to the end of your knife bootstrap command in this format:
Terminal: ~/learn-chef
| --json-attributes '{"cloud": {"public_ip": "NODE_PUBLIC_IP_ADDRESS"}}'
|
For example:
Terminal: ~/learn-chef
| --json-attributes '{"cloud": {"public_ip": "13.82.139.157"}}'
|
If your workstation is running Windows, you need to run the bootstrap command differently.
Although we recommend that you run Chef commands from Chef Workstation command prompt, for this part we recommend that you use a standard PowerShell window. GitHub issue
From PowerShell, create a variable to hold the string as a JSON object.
Windows PowerShell: ~\learn-chef
PS > | $public_ip = '{"cloud": {"public_ip": "13.82.139.157"}}' | ConvertTo-Json
|
When you run the bootstrap command, pass the --json-attributes argument like this.
Windows PowerShell: ~\learn-chef
| --json-attributes $public_ip
|
Choose the option that matches how you normally connect to your node over SSH.
Bootstrap using key-based authentication
Replace ADDRESS with your remote node's external address, USER with your username, and IDENTITY_FILE with your SSH identify file, for example ~/.ssh/my.pem.
Terminal: ~/learn-chef
$ | knife bootstrap ADDRESS --ssh-user USER --sudo --identity-file IDENTITY_FILE --node-name node1-ubuntu --run-list 'recipe[learn_chef_apache2]'
|
Here's an example:
Terminal: ~/learn-chef
$ | knife bootstrap 54.85.155.106 --ssh-user ubuntu --sudo --identity-file ~/.ssh/private_key --node-name node1-ubuntu --run-list 'recipe[learn_chef_apache2]'Creating new client for node1-ubuntuCreating new node for node1-ubuntuConnecting to 54.85.155.10654.85.155.106 -----> Installing Chef Omnibus (-v 13)54.85.155.106 downloading https://omnitruck-direct.chef.io/chef/install.sh54.85.155.106 to file /tmp/install.sh.1380/install.sh54.85.155.106 trying wget...54.85.155.106 ubuntu 14.04 x86_6454.85.155.106 Getting information for chef stable 13 for ubuntu...54.85.155.106 downloading https://omnitruck-direct.chef.io/stable/chef/metadata?v=13&p=ubuntu&pv=14.04&m=x86_6454.85.155.106 to file /tmp/install.sh.1384/metadata.txt54.85.155.106 trying wget...54.85.155.106 sha1 1ecb70effcf557dbac0d0de528bbef6937f9c58154.85.155.106 sha256 ce0ff3baf39c8c13ed474104928e7e4568a4997a1d5797cae2b2ba3ee001e3a854.85.155.106 url https://packages.chef.io/files/stable/chef/13.8.5/ubuntu/14.04/chef_13.8.5-1_amd64.deb54.85.155.106 version 13.8.554.85.155.106 downloaded metadata file looks valid...54.85.155.106 downloading https://packages.chef.io/files/stable/chef/13.8.5/ubuntu/14.04/chef_13.8.5-1_amd64.deb54.85.155.106 to file /tmp/install.sh.1384/chef_13.8.5-1_amd64.deb54.85.155.106 trying wget...54.85.155.106 Comparing checksum with sha256sum...54.85.155.106 Installing chef 1354.85.155.106 installing with dpkg...54.85.155.106 Selecting previously unselected package chef.54.85.155.106 Preparing to unpack .../chef_13.8.5-1_amd64.deb ...54.85.155.106 Unpacking chef (13.8.5-1) ...54.85.155.106 Setting up chef (13.8.5-1) ...54.85.155.106 Thank you for installing Chef!54.85.155.106 Starting the first Chef Client run...54.85.155.106 Starting Chef Client, version 13.8.554.85.155.106 resolving cookbooks for run list: ["learn_chef_apache2"]54.85.155.106 Synchronizing Cookbooks:54.85.155.106 - learn_chef_apache2 (0.1.0)54.85.155.106 Installing Cookbook Gems:54.85.155.106 Compiling Cookbooks...54.85.155.106 Converging 4 resources54.85.155.106 Recipe: learn_chef_apache2::default54.85.155.106 * apt_update[Update the apt cache daily] action periodic54.85.155.106 - update new lists of packages54.85.155.106 * directory[/var/lib/apt/periodic] action create (up to date)54.85.155.106 * directory[/etc/apt/apt.conf.d] action create (up to date)54.85.155.106 * file[/etc/apt/apt.conf.d/15update-stamp] action create_if_missing (up to date)54.85.155.106 * execute[apt-get -q update] action run54.85.155.106 - execute apt-get -q update54.85.155.106 54.85.155.106 * apt_package[apache2] action install54.85.155.106 - install version 2.4.7-1ubuntu4.20 of package apache254.85.155.106 * service[apache2] action enable (up to date)54.85.155.106 * service[apache2] action start (up to date)54.85.155.106 * template[/var/www/html/index.html] action create54.85.155.106 - update content in file /var/www/html/index.html from 538f31 to ef4ffd54.85.155.106 --- /var/www/html/index.html 2018-05-03 15:23:30.775233999 +000054.85.155.106 +++ /var/www/html/.chef-index20180503-1468-wwlbxk.html 2018-05-03 15:23:34.103233999 +000054.85.155.106 @@ -1,379 +1,6 @@54.85.155.106 -54.85.155.106 -<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">54.85.155.106 -<html xmlns="http://www.w3.org/1999/xhtml">54.85.155.106 - <!--54.85.155.106 - Modified from the Debian original for Ubuntu54.85.155.106 - Last updated: 2014-03-1954.85.155.106 - See: https://launchpad.net/bugs/128869054.85.155.106 - -->54.85.155.106 - <head>54.85.155.106 - <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />54.85.155.106 - <title>Apache2 Ubuntu Default Page: It works</title>54.85.155.106 - <style type="text/css" media="screen">54.85.155.106 - * {54.85.155.106 - margin: 0px 0px 0px 0px;54.85.155.106 - padding: 0px 0px 0px 0px;54.85.155.106 - }54.85.155.106 -54.85.155.106 - body, html {54.85.155.106 - padding: 3px 3px 3px 3px;54.85.155.106 -54.85.155.106 - background-color: #D8DBE2;54.85.155.106 -54.85.155.106 - font-family: Verdana, sans-serif;54.85.155.106 - font-size: 11pt;54.85.155.106 - text-align: center;54.85.155.106 - }54.85.155.106 -54.85.155.106 - div.main_page {54.85.155.106 - position: relative;54.85.155.106 - display: table;54.85.155.106 -54.85.155.106 - width: 800px;54.85.155.106 -54.85.155.106 - margin-bottom: 3px;54.85.155.106 - margin-left: auto;54.85.155.106 - margin-right: auto;54.85.155.106 - padding: 0px 0px 0px 0px;54.85.155.106 -54.85.155.106 - border-width: 2px;54.85.155.106 - border-color: #212738;54.85.155.106 - border-style: solid;54.85.155.106 -54.85.155.106 - background-color: #FFFFFF;54.85.155.106 -54.85.155.106 - text-align: center;54.85.155.106 - }54.85.155.106 -54.85.155.106 - div.page_header {54.85.155.106 - height: 99px;54.85.155.106 - width: 100%;54.85.155.106 -54.85.155.106 - background-color: #F5F6F7;54.85.155.106 - }54.85.155.106 -54.85.155.106 - div.page_header span {54.85.155.106 - margin: 15px 0px 0px 50px;54.85.155.106 -54.85.155.106 - font-size: 180%;54.85.155.106 - font-weight: bold;54.85.155.106 - }54.85.155.106 -54.85.155.106 - div.page_header img {54.85.155.106 - margin: 3px 0px 0px 40px;54.85.155.106 -54.85.155.106 - border: 0px 0px 0px;54.85.155.106 - }54.85.155.106 -54.85.155.106 - div.table_of_contents {54.85.155.106 - clear: left;54.85.155.106 -54.85.155.106 - min-width: 200px;54.85.155.106 -54.85.155.106 - margin: 3px 3px 3px 3px;54.85.155.106 -54.85.155.106 - background-color: #FFFFFF;54.85.155.106 -54.85.155.106 - text-align: left;54.85.155.106 - }54.85.155.106 -54.85.155.106 - div.table_of_contents_item {54.85.155.106 - clear: left;54.85.155.106 -54.85.155.106 - width: 100%;54.85.155.106 -54.85.155.106 - margin: 4px 0px 0px 0px;54.85.155.106 -54.85.155.106 - background-color: #FFFFFF;54.85.155.106 -54.85.155.106 - color: #000000;54.85.155.106 - text-align: left;54.85.155.106 - }54.85.155.106 -54.85.155.106 - div.table_of_contents_item a {54.85.155.106 - margin: 6px 0px 0px 6px;54.85.155.106 - }54.85.155.106 -54.85.155.106 - div.content_section {54.85.155.106 - margin: 3px 3px 3px 3px;54.85.155.106 -54.85.155.106 - background-color: #FFFFFF;54.85.155.106 -54.85.155.106 - text-align: left;54.85.155.106 - }54.85.155.106 -54.85.155.106 - div.content_section_text {54.85.155.106 - padding: 4px 8px 4px 8px;54.85.155.106 -54.85.155.106 - color: #000000;54.85.155.106 - font-size: 100%;54.85.155.106 - }54.85.155.106 -54.85.155.106 - div.content_section_text pre {54.85.155.106 - margin: 8px 0px 8px 0px;54.85.155.106 - padding: 8px 8px 8px 8px;54.85.155.106 -54.85.155.106 - border-width: 1px;54.85.155.106 - border-style: dotted;54.85.155.106 - border-color: #000000;54.85.155.106 -54.85.155.106 - background-color: #F5F6F7;54.85.155.106 -54.85.155.106 - font-style: italic;54.85.155.106 - }54.85.155.106 -54.85.155.106 - div.content_section_text p {54.85.155.106 - margin-bottom: 6px;54.85.155.106 - }54.85.155.106 -54.85.155.106 - div.content_section_text ul, div.content_section_text li {54.85.155.106 - padding: 4px 8px 4px 16px;54.85.155.106 - }54.85.155.106 -54.85.155.106 - div.section_header {54.85.155.106 - padding: 3px 6px 3px 6px;54.85.155.106 -54.85.155.106 - background-color: #8E9CB2;54.85.155.106 -54.85.155.106 - color: #FFFFFF;54.85.155.106 - font-weight: bold;54.85.155.106 - font-size: 112%;54.85.155.106 - text-align: center;54.85.155.106 - }54.85.155.106 -54.85.155.106 - div.section_header_red {54.85.155.106 - background-color: #CD214F;54.85.155.106 - }54.85.155.106 -54.85.155.106 - div.section_header_grey {54.85.155.106 - background-color: #9F9386;54.85.155.106 - }54.85.155.106 -54.85.155.106 - .floating_element {54.85.155.106 - position: relative;54.85.155.106 - float: left;54.85.155.106 - }54.85.155.106 -54.85.155.106 - div.table_of_contents_item a,54.85.155.106 - div.content_section_text a {54.85.155.106 - text-decoration: none;54.85.155.106 - font-weight: bold;54.85.155.106 - }54.85.155.106 -54.85.155.106 - div.table_of_contents_item a:link,54.85.155.106 - div.table_of_contents_item a:visited,54.85.155.106 - div.table_of_contents_item a:active {54.85.155.106 - color: #000000;54.85.155.106 - }54.85.155.106 -54.85.155.106 - div.table_of_contents_item a:hover {54.85.155.106 - background-color: #000000;54.85.155.106 -54.85.155.106 - color: #FFFFFF;54.85.155.106 - }54.85.155.106 -54.85.155.106 - div.content_section_text a:link,54.85.155.106 - div.content_section_text a:visited,54.85.155.106 - div.content_section_text a:active {54.85.155.106 - background-color: #DCDFE6;54.85.155.106 -54.85.155.106 - color: #000000;54.85.155.106 - }54.85.155.106 -54.85.155.106 - div.content_section_text a:hover {54.85.155.106 - background-color: #000000;54.85.155.106 -54.85.155.106 - color: #DCDFE6;54.85.155.106 - }54.85.155.106 -54.85.155.106 - div.validator {54.85.155.106 - }54.85.155.106 - </style>54.85.155.106 - </head>54.85.155.106 +<html>54.85.155.106 <body>54.85.155.106 - <div class="main_page">54.85.155.106 - <div class="page_header floating_element">54.85.155.106 - <img src="/icons/ubuntu-logo.png" alt="Ubuntu Logo" class="floating_element"/>54.85.155.106 - <span class="floating_element">54.85.155.106 - Apache2 Ubuntu Default Page54.85.155.106 - </span>54.85.155.106 - </div>54.85.155.106 -<!-- <div class="table_of_contents floating_element">54.85.155.106 - <div class="section_header section_header_grey">54.85.155.106 - TABLE OF CONTENTS54.85.155.106 - </div>54.85.155.106 - <div class="table_of_contents_item floating_element">54.85.155.106 - <a href="#about">About</a>54.85.155.106 - </div>54.85.155.106 - <div class="table_of_contents_item floating_element">54.85.155.106 - <a href="#changes">Changes</a>54.85.155.106 - </div>54.85.155.106 - <div class="table_of_contents_item floating_element">54.85.155.106 - <a href="#scope">Scope</a>54.85.155.106 - </div>54.85.155.106 - <div class="table_of_contents_item floating_element">54.85.155.106 - <a href="#files">Config files</a>54.85.155.106 - </div>54.85.155.106 - </div>54.85.155.106 --->54.85.155.106 - <div class="content_section floating_element">54.85.155.106 -54.85.155.106 -54.85.155.106 - <div class="section_header section_header_red">54.85.155.106 - <div id="about"></div>54.85.155.106 - It works!54.85.155.106 - </div>54.85.155.106 - <div class="content_section_text">54.85.155.106 - <p>54.85.155.106 - This is the default welcome page used to test the correct 54.85.155.106 - operation of the Apache2 server after installation on Ubuntu systems.54.85.155.106 - It is based on the equivalent page on Debian, from which the Ubuntu Apache54.85.155.106 - packaging is derived.54.85.155.106 - If you can read this page, it means that the Apache HTTP server installed at54.85.155.106 - this site is working properly. You should <b>replace this file</b> (located at54.85.155.106 - <tt>/var/www/html/index.html</tt>) before continuing to operate your HTTP server.54.85.155.106 - </p>54.85.155.106 -54.85.155.106 -54.85.155.106 - <p>54.85.155.106 - If you are a normal user of this web site and don't know what this page is54.85.155.106 - about, this probably means that the site is currently unavailable due to54.85.155.106 - maintenance.54.85.155.106 - If the problem persists, please contact the site's administrator.54.85.155.106 - </p>54.85.155.106 -54.85.155.106 - </div>54.85.155.106 - <div class="section_header">54.85.155.106 - <div id="changes"></div>54.85.155.106 - Configuration Overview54.85.155.106 - </div>54.85.155.106 - <div class="content_section_text">54.85.155.106 - <p>54.85.155.106 - Ubuntu's Apache2 default configuration is different from the54.85.155.106 - upstream default configuration, and split into several files optimized for54.85.155.106 - interaction with Ubuntu tools. The configuration system is54.85.155.106 - <b>fully documented in54.85.155.106 - /usr/share/doc/apache2/README.Debian.gz</b>. Refer to this for the full54.85.155.106 - documentation. Documentation for the web server itself can be54.85.155.106 - found by accessing the <a href="/manual">manual</a> if the <tt>apache2-doc</tt>54.85.155.106 - package was installed on this server.54.85.155.106 -54.85.155.106 - </p>54.85.155.106 - <p>54.85.155.106 - The configuration layout for an Apache2 web server installation on Ubuntu systems is as follows:54.85.155.106 - </p>54.85.155.106 - <pre>54.85.155.106 -/etc/apache2/54.85.155.106 -|-- apache2.conf54.85.155.106 -| `-- ports.conf54.85.155.106 -|-- mods-enabled54.85.155.106 -| |-- *.load54.85.155.106 -| `-- *.conf54.85.155.106 -|-- conf-enabled54.85.155.106 -| `-- *.conf54.85.155.106 -|-- sites-enabled54.85.155.106 -| `-- *.conf54.85.155.106 - </pre>54.85.155.106 - <ul>54.85.155.106 - <li>54.85.155.106 - <tt>apache2.conf</tt> is the main configuration54.85.155.106 - file. It puts the pieces together by including all remaining configuration54.85.155.106 - files when starting up the web server.54.85.155.106 - </li>54.85.155.106 -54.85.155.106 - <li>54.85.155.106 - <tt>ports.conf</tt> is always included from the54.85.155.106 - main configuration file. It is used to determine the listening ports for54.85.155.106 - incoming connections, and this file can be customized anytime.54.85.155.106 - </li>54.85.155.106 -54.85.155.106 - <li>54.85.155.106 - Configuration files in the <tt>mods-enabled/</tt>,54.85.155.106 - <tt>conf-enabled/</tt> and <tt>sites-enabled/</tt> directories contain54.85.155.106 - particular configuration snippets which manage modules, global configuration54.85.155.106 - fragments, or virtual host configurations, respectively.54.85.155.106 - </li>54.85.155.106 -54.85.155.106 - <li>54.85.155.106 - They are activated by symlinking available54.85.155.106 - configuration files from their respective54.85.155.106 - *-available/ counterparts. These should be managed54.85.155.106 - by using our helpers54.85.155.106 - <tt>54.85.155.106 - <a href="http://manpages.debian.org/cgi-bin/man.cgi?query=a2enmod">a2enmod</a>,54.85.155.106 - <a href="http://manpages.debian.org/cgi-bin/man.cgi?query=a2dismod">a2dismod</a>,54.85.155.106 - </tt>54.85.155.106 - <tt>54.85.155.106 - <a href="http://manpages.debian.org/cgi-bin/man.cgi?query=a2ensite">a2ensite</a>,54.85.155.106 - <a href="http://manpages.debian.org/cgi-bin/man.cgi?query=a2dissite">a2dissite</a>,54.85.155.106 - </tt>54.85.155.106 - and54.85.155.106 - <tt>54.85.155.106 - <a href="http://manpages.debian.org/cgi-bin/man.cgi?query=a2enconf">a2enconf</a>,54.85.155.106 - <a href="http://manpages.debian.org/cgi-bin/man.cgi?query=a2disconf">a2disconf</a>54.85.155.106 - </tt>. See their respective man pages for detailed information.54.85.155.106 - </li>54.85.155.106 -54.85.155.106 - <li>54.85.155.106 - The binary is called apache2. Due to the use of54.85.155.106 - environment variables, in the default configuration, apache2 needs to be54.85.155.106 - started/stopped with <tt>/etc/init.d/apache2</tt> or <tt>apache2ctl</tt>.54.85.155.106 - <b>Calling <tt>/usr/bin/apache2</tt> directly will not work</b> with the54.85.155.106 - default configuration.54.85.155.106 - </li>54.85.155.106 - </ul>54.85.155.106 - </div>54.85.155.106 -54.85.155.106 - <div class="section_header">54.85.155.106 - <div id="docroot"></div>54.85.155.106 - Document Roots54.85.155.106 - </div>54.85.155.106 -54.85.155.106 - <div class="content_section_text">54.85.155.106 - <p>54.85.155.106 - By default, Ubuntu does not allow access through the web browser to54.85.155.106 - <em>any</em> file apart of those located in <tt>/var/www</tt>,54.85.155.106 - <a href="http://httpd.apache.org/docs/2.4/mod/mod_userdir.html">public_html</a>54.85.155.106 - directories (when enabled) and <tt>/usr/share</tt> (for web54.85.155.106 - applications). If your site is using a web document root54.85.155.106 - located elsewhere (such as in <tt>/srv</tt>) you may need to whitelist your54.85.155.106 - document root directory in <tt>/etc/apache2/apache2.conf</tt>.54.85.155.106 - </p>54.85.155.106 - <p>54.85.155.106 - The default Ubuntu document root is <tt>/var/www/html</tt>. You54.85.155.106 - can make your own virtual hosts under /var/www. This is different54.85.155.106 - to previous releases which provides better security out of the box.54.85.155.106 - </p>54.85.155.106 - </div>54.85.155.106 -54.85.155.106 - <div class="section_header">54.85.155.106 - <div id="bugs"></div>54.85.155.106 - Reporting Problems54.85.155.106 - </div>54.85.155.106 - <div class="content_section_text">54.85.155.106 - <p>54.85.155.106 - Please use the <tt>ubuntu-bug</tt> tool to report bugs in the54.85.155.106 - Apache2 package with Ubuntu. However, check <a54.85.155.106 - href="https://bugs.launchpad.net/ubuntu/+source/apache2">existing54.85.155.106 - bug reports</a> before reporting a new bug.54.85.155.106 - </p>54.85.155.106 - <p>54.85.155.106 - Please report bugs specific to modules (such as PHP and others)54.85.155.106 - to respective packages, not to the web server itself.54.85.155.106 - </p>54.85.155.106 - </div>54.85.155.106 -54.85.155.106 -54.85.155.106 -54.85.155.106 -54.85.155.106 - </div>54.85.155.106 - </div>54.85.155.106 - <div class="validator">54.85.155.106 - <p>54.85.155.106 - <a href="http://validator.w3.org/check?uri=referer"><img src="http://www.w3.org/Icons/valid-xhtml10" alt="Valid XHTML 1.0 Transitional" height="31" width="88" /></a>54.85.155.106 - </p>54.85.155.106 - </div>54.85.155.106 + <h1>hello world</h1>54.85.155.106 </body>54.85.155.106 </html>54.85.155.106 -54.85.155.106 54.85.155.106 Running handlers:54.85.155.106 Running handlers complete54.85.155.106 Chef Client finished, 4/9 resources updated in 19 seconds
|
Bootstrap using password authentication
Replace ADDRESS with your remote node's external address, USER with your username, and PASSWORD with your user's password.
Terminal: ~/learn-chef
$ | knife bootstrap ADDRESS --ssh-user USER --ssh-password 'PASSWORD' --sudo --use-sudo-password --node-name node1-ubuntu --run-list 'recipe[learn_chef_apache2]'
|
The output will resemble the output shown for key-based authentication above.
Bootstrap a local virtual machine using a forwarded port
Replace PORT with your SSH forwarded port, for example, 2222, and IDENTITY_FILE with your SSH identify file, for example /home/user/.vagrant/machines/default/virtualbox/private_key.
Terminal: ~/learn-chef
$ | knife bootstrap localhost --ssh-port PORT --ssh-user vagrant --sudo --identity-file IDENTITY_FILE --node-name node1-ubuntu --run-list 'recipe[learn_chef_apache2]'
|
The output will resemble the output shown for key-based authentication above.
- Troubleshooting
If the operation times out or fails, here are some things to try.
- Ensure that you run
knife commands from your learn-chef directory or one of its sub-directories. - Ensure you have a
learn-chef/.chef directory and that it contains a knife.rb file and your RSA private key file. - Ensure that your node's IP address is accessible from your network.
- Ensure the user name you provide has root or
sudo access on the node. - Ensure your node provides network access on these ports:
- 22 (SSH)
- 80 (HTTP)
- 443 (HTTPS)
- The bootstrap process in detail
You can review the documentation to better understand the role of each knife bootstrap option. Here are the options that you used:
General options
--ssh-user--sudo--node-name--run-list
Options specific to key-based authentication
Options specific to password authentication
--ssh-password--use-sudo-password
Options specific to SSH forwarded port
--ssh-port--identity-file
You can also watch What happens during knife bootstrap to further understand the process.
2. Confirm the result
Two things just happened.
First, your node was associated with your Chef server. To verify this, run the knife node list command.
Terminal: ~/learn-chef
$ | knife node listnode1-ubuntu
|
You can use the knife node show command to view data about your node.
Terminal: ~/learn-chef
$ | knife node show node1-ubuntuNode Name: node1-ubuntuEnvironment: _defaultFQDN: ip-172-31-56-238.ec2.internalIP: 54.85.155.106Run List: recipe[learn_chef_apache2]Roles: Recipes: learn_chef_apache2, learn_chef_apache2::defaultPlatform: ubuntu 14.04Tags:
|
The second thing that happened was that your node did an initial check-in with the Chef server and ran the learn_chef_apache2 cookbook. That's because you specifed learn_chef_apache2 as the --run-list argument.
To verify the configuration, run curl. Replace the IP address you see here with yours.
Terminal: ~/learn-chef
$ | curl 54.85.155.106<html> <body> <h1>hello world</h1> </body></html>
|
You can also open a web browser from your workstation and navigate to your web server.

If you bootstrapped a Vagrant instance, an easy way to verify the configuration is to create an SSH connection to the instance and run curl localhost.
Terminal: ~
$ | vagrant sshLast login: Thu Dec 3 17:17:26 2015 from 10.0.2.2[vagrant@localhost ~]$ curl localhost <html> <body> <h1>hello world</h1> </body></html>[vagrant@localhost ~]$ exit logoutConnection to 127.0.0.1 closed.
|