<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Chef &#8211; Blog of Kliment Andreev &#8211; A place so I won&#039;t forget things</title>
	<atom:link href="https://blog.andreev.it/tag/chef/feed/" rel="self" type="application/rss+xml" />
	<link>https://blog.andreev.it</link>
	<description></description>
	<lastBuildDate>Sat, 31 Oct 2020 14:09:35 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	
	<item>
		<title>CentOS: Deploy WordPress on CentOS 7 using Chef</title>
		<link>https://blog.andreev.it/2018/04/126-chef-deploy-wordpress-on-centos-7/</link>
					<comments>https://blog.andreev.it/2018/04/126-chef-deploy-wordpress-on-centos-7/#respond</comments>
		
		<dc:creator><![CDATA[Kliment Andreev]]></dc:creator>
		<pubDate>Wed, 04 Apr 2018 14:36:29 +0000</pubDate>
				<category><![CDATA[CentOS]]></category>
		<category><![CDATA[DevOps]]></category>
		<category><![CDATA[WordPress]]></category>
		<category><![CDATA[centos]]></category>
		<category><![CDATA[Chef]]></category>
		<guid isPermaLink="false">http://blog.iandreev.com/?p=3799</guid>

					<description><![CDATA[In this post, I&#8217;ll describe how to create a Chef cookbook for deploying WordPress.&#8230;]]></description>
										<content:encoded><![CDATA[<div id="bsf_rt_marker"></div><p>In this post, I&#8217;ll describe how to create a Chef cookbook for deploying WordPress. The blog engine will run on CentOS 7 using MariaDB and PHP. The website will be created as a virtual host and you can leave the firewall and SELinux as is. There are probably better WordPress cookbooks at the Chef Supermarket, but I decided to go with my own. Before you go further, make sure that you have a Chef server/workstation environment ready, otherwise you won&#8217;t be able to deploy the code. Check my other <a href="https://blog.andreev.it/?p=3522" rel="noopener noreferrer" target="_blank">post </a>on how to do that. Also, make sure you have a CentOS 7 client powered up and that you are able to log in with some username and that the DNS/hostnames is already in place. In my case, I&#8217;ll have a CentOS 7 server named centostest.andreev.local and a username klimenta that&#8217;s able to login.</p>
<h1>Chef</h1>
<p>OK, so log to your Chef workstation and go to your cookbooks directory. Create the wordpress cookbook.</p>
<pre class="brush: bash; title: ; notranslate">
chef generate cookbook wordpress
</pre>
<p>The directory structure looks like this.<br />
<a href="https://blog.andreev.it/wp-content/uploads/2018/04/P103-01.png"><img fetchpriority="high" decoding="async" src="https://blog.andreev.it/wp-content/uploads/2018/04/P103-01.png" alt="" width="301" height="474" class="aligncenter size-full wp-image-8211" /></a><br />
Edit the <strong>metadata.rb</strong> file in the root directory and change it so it suit your needs. This is completely optional. You don&#8217;t have to change anything here. </p>
<pre class="brush: ruby; collapse: true; light: false; title: ; toolbar: true; notranslate">
name 'wordpress'
maintainer 'Kliment Andreev'
maintainer_email 'klimenta@iandreev.com'
license 'Simplified BSD License'
description 'Installs/Configures wordpress'
long_description 'Installs/Configures wordpress'
version '0.1.0'
chef_version '&gt;= 12.1' if respond_to?(:chef_version)

# The `issues_url` points to the location where issues for this cookbook are
# tracked.  A `View Issues` link will be displayed on this cookbook's page when
# uploaded to a Supermarket.
#
# issues_url 'https://github.com/&lt;insert_org_here&gt;/wordpress/issues'

# The `source_url` points to the development repository for this cookbook.  A
# `View Source` link will be displayed on this cookbook's page when uploaded to
# a Supermarket.
#
# source_url 'https://github.com/&lt;insert_org_here&gt;/wordpress'
</pre>
<p>Our next step is to create the default attributes. These are the values that we can change and modify the behavior of the installed packages or change the usernames, passwords, directory locations etc.</p>
<pre class="brush: bash; title: ; notranslate">
cd wordpress
chef generate attribute default
</pre>
<p>The commands above will create a new directory called <strong>attributes </strong>and a file called <strong>default.rb</strong>. Copy and paste the following into that file. As you can see, my blog will be reachable as http://centostest.andreev.local, the WordPress files will be under /var/www/centostest.andreev.local folder, the default httpd file is /etc/httpd/conf/httpd.conf etc&#8230;</p>
<pre class="brush: bash; title: ; notranslate">
# The name of your site
default&#x5B;'wordpress']&#x5B;'server_name'] ='centostest.andreev.local'
# The root directory of your site, it will be /var/www/yoursitename.com
default&#x5B;'wordpress']&#x5B;'document_root'] = &quot;/var/www/#{node&#x5B;'wordpress']&#x5B;'server_name']}&quot;
# The default config file
default&#x5B;'wordpress']&#x5B;'default_conf'] = '/etc/httpd/conf/httpd.conf'
# e-mail for the server admin
default&#x5B;'wordpress']&#x5B;'server_admin'] ='klimenta@iandreev.com'
# log dir for the site
default&#x5B;'wordpress']&#x5B;'log_dir'] = '/var/log/www'
# Error log for the site, it will be /var/log/wwwyoursitename-error.log
default&#x5B;'wordpress']&#x5B;'error_log'] = &quot;#{node&#x5B;'wordpress']&#x5B;'log_dir']}/&quot;&quot;#{node&#x5B;'wordpress']&#x5B;'server_name']}-error.log&quot;
# Access log for the site, it will be /var/log/wwwyoursitename-access.log
default&#x5B;'wordpress']&#x5B;'custom_log'] = &quot;#{node&#x5B;'wordpress']&#x5B;'log_dir']}/&quot;&quot;#{node&#x5B;'wordpress']&#x5B;'server_name']}-access.log&quot;
# The root password for MySQL
default&#x5B;'wordpress']&#x5B;'mysql_password'] = 'MySQLP4ssw0rd$'
# The name of the WordPress database
default&#x5B;'wordpress']&#x5B;'wordpress_database'] = 'wordpress'
# The default username for the WordPress database
default&#x5B;'wordpress']&#x5B;'wordpress_username'] = 'wp_user'
# The default password for the WordPress database
default&#x5B;'wordpress']&#x5B;'wordpress_password'] = 'W0rdPr3$$PWD'
</pre>
<p>Now, let&#8217;s move to the recipes. In order to install WordPress, we&#8217;ll have to install Apache web-server, install PHP and its modules so WordPress as a PHP program can run, then install MySQL database server and finally download WordPress and extract it under the Apache root directory that we specified in the default attributes. We&#8217;ll create a recipe for each of these steps.</p>
<h1>Apache recipe</h1>
<p>Create the recipe first. This will create a file <strong>apache.rb</strong> under the <strong>recipes </strong>directory. </p>
<pre class="brush: bash; title: ; notranslate">
chef generate recipe apache
</pre>
<p>This is how to recipe looks like. You can see from the comments what each block does. It&#8217;s very simple and straightforward. We install the Apache server, create the document root and the logs directory, we&#8217;ll copy the httpd.config file from a template, make sure that Apache starts on boot and we&#8217;ll poke a hole in the firewall so the HTTP port is allowed inbound. </p>
<pre class="brush: ruby; title: ; notranslate">
# Install Apache server
package 'httpd' do
  action :install
end

# Create the root directory and set the permissions and owners
directory node&#x5B;'wordpress']&#x5B;'document_root'] do
  owner 'apache'
  group 'apache'
  mode '0755'
  recursive true
end

# Create the Apache log directory
directory node&#x5B;'wordpress']&#x5B;'log_dir'] do
  recursive true
end

# Create the default httpd.conf file
template node&#x5B;'wordpress']&#x5B;'default_conf'] do
  source &quot;httpd.conf.erb&quot;
end

# Enable start on boot and start Apache
service 'httpd' do
  action &#x5B;:enable, :start]
end

# Allow HTTP to pass on the firewall
execute 'httpd_firewall' do
  command '/usr/bin/firewall-cmd  --permanent --zone public --add-service http'
  ignore_failure true
end

# Reload the firewall rules
execute 'reload_firewall' do
  command '/usr/bin/firewall-cmd --reload'
  ignore_failure true
end
</pre>
<p>One of the steps here says to create the default config file for the Apache web server and that the template for that is a file called <strong>httpd.conf.erb</strong>. So, let&#8217;s create that template. This command will create a directory called <strong>templates </strong>and a file <strong>httpd.conf.erb</strong>.</p>
<pre class="brush: bash; title: ; notranslate">
chef generate template httpd.conf
</pre>
<p>This is how our default config looks like. Copy and paste the following into the <strong>httpd.conf.erb</strong> file.</p>
<pre class="brush: bash; title: ; notranslate">
Listen 80
Include conf.modules.d/*.conf
User apache
Group apache
&lt;IfModule mime_module&gt;
    TypesConfig /etc/mime.types
    AddType application/x-compress .Z
    AddType application/x-gzip .gz .tgz
    AddType text/html .shtml
    AddOutputFilter INCLUDES .shtml
&lt;/IfModule&gt;

&lt;VirtualHost *:80&gt;
  ServerName &lt;%= node&#x5B;'wordpress']&#x5B;'server_name'] %&gt;
  ServerAdmin &lt;%= node&#x5B;'wordpress']&#x5B;'server_admin'] %&gt;
  DocumentRoot &lt;%= node&#x5B;'wordpress']&#x5B;'document_root'] %&gt;
  &lt;Directory &quot;/&quot;&gt;
          Options FollowSymLinks
          AllowOverride None
  &lt;/Directory&gt;
  &lt;Directory &lt;%= node&#x5B;'wordpress']&#x5B;'document_root'] %&gt; &gt;
          Options Indexes FollowSymLinks MultiViews
          AllowOverride None
          Require all granted
  &lt;/Directory&gt;
  ErrorLog &lt;%= node&#x5B;'wordpress']&#x5B;'error_log'] %&gt;
  CustomLog &lt;%= node&#x5B;'wordpress']&#x5B;'custom_log'] %&gt; combined
  AddType application/x-httpd-php .php
  AddType application/x-httpd-php-source .phps
  DirectoryIndex index.php index.html
&lt;/VirtualHost&gt;
</pre>
<h1>PHP</h1>
<p>Same as with the Apache recipe, we&#8217;ll have to generate a recipe for PHP and it&#8217;s modules.</p>
<pre class="brush: bash; title: ; notranslate">
chef generate recipe php
</pre>
<p>Edit the newly created file <strong>php.rb</strong> and copy and paste the following.</p>
<pre class="brush: ruby; title: ; notranslate">
# Install PHP and its modules
%w{php php-fpm php-mysql php-xmlrpc php-gd php-pear php-pspell}.each do |pkg|
  package pkg do
    action :install
    notifies :reload, 'service&#x5B;httpd]', :immediately
  end
end
</pre>
<h1>MySQL</h1>
<p>Same here, let&#8217;s generate a recipe for the installation of MySQL.</p>
<pre class="brush: bash; title: ; notranslate">
chef generate recipe mysql
</pre>
<p>This is the recipe to install MySQL. </p>
<pre class="brush: ruby; title: ; notranslate">
# Install MySQL client and server&lt;strong&gt;
%w{mariadb mariadb-server}.each do |pkg|
  package pkg do
    action :install
  end
end

# Enable start on boot and start the MySQL server
service 'mariadb' do
  action &#x5B;:enable, :start]
end

# Location of the initial MySQL script
template '/tmp/mysql.sql' do
  source &quot;mysql.conf.erb&quot;
end

# Execute the initial setup of MySQL
execute 'mysql_server' do
  command '/usr/bin/mysql -sfu root &lt; /tmp/mysql.sql &amp;&amp; ls /tmp/mysql.sql'
  ignore_failure true
end
</pre>
<p>As you can see from the recipe, we need a template with some SQL commands to run before we can use MySQL. This is equivalent of running mysql_secure_installation when you first install MySQL. In addition, I&#8217;ll use the SQL script to create the wordpress database as well.</p>
<pre class="brush: bash; title: ; notranslate">
chef generate template mysql.conf
</pre>
<p>This template contains what we need for an initial installation. Any subsequent runs will fail because we changed the MySQL password which is good. That means that we won&#8217;t mess up anything if we run this recipe more than once. So, edit the newly create file under <strong>templates </strong>called <strong>mysql.conf</strong> and copy and paste the following.</p>
<pre class="brush: sql; title: ; notranslate">
UPDATE mysql.user SET Password=PASSWORD('&lt;%= node&#x5B;'wordpress']&#x5B;'mysql_password'] %&gt;') WHERE User='root';
DELETE FROM mysql.user WHERE User='';
DELETE FROM mysql.user WHERE User='root' AND Host NOT IN ('localhost', '127.0.0.1', '::1');
DROP DATABASE IF EXISTS test;
DELETE FROM mysql.db WHERE Db='test' OR Db='test\\_%';
FLUSH PRIVILEGES;
CREATE DATABASE &lt;%= node&#x5B;'wordpress']&#x5B;'wordpress_database'] %&gt;;
GRANT ALL PRIVILEGES ON &lt;%= node&#x5B;'wordpress']&#x5B;'wordpress_database'] %&gt;.*
TO &quot;&lt;%= node&#x5B;'wordpress']&#x5B;'wordpress_username'] %&gt;&quot;@&quot;localhost&quot;
IDENTIFIED BY &quot;&lt;%= node&#x5B;'wordpress']&#x5B;'wordpress_password'] %&gt;&quot;;
FLUSH PRIVILEGES;
</pre>
<h1>Download WordPress</h1>
<p>We have to create a recipe to download and extract WordPress.</p>
<pre class="brush: bash; title: ; notranslate">
chef generate recipe download
</pre>
<p>Edit the file and copy and paste the following. Pretty much it executes a bunch of bash commands to download the tarball, unzip it under the root directory and change the ownership. The recipe will stop if wp-settings.php exists, this means that WordPress is already installed. </p>
<pre class="brush: ruby; title: ; notranslate">
ruby_block &quot;download_wordpress&quot; do
  block do
    require 'fileutils'
    FileUtils.cd node&#x5B;'wordpress']&#x5B;'document_root']
    system 'curl -o latest.tar.gz https://wordpress.org/latest.tar.gz'
    system 'tar xzvf latest.tar.gz --strip-components=1 &amp;&amp; rm latest.tar.gz'
    system 'chown -R apache:apache *'
  end
  not_if { ::File.exist?(File.join(node&#x5B;'wordpress']&#x5B;'document_root'], 'wp-settings.php')) }
  action :create
end
</pre>
<h1>Wrap up</h1>
<p>Now that we have all recipes in place, we can tell Chef in what order to execute them. Edit the default recipe (<strong>default.rb</strong> file under <strong>recipes</strong>) and add these lines. </p>
<pre class="brush: ruby; title: ; notranslate">
include_recipe 'wordpress::apache'
include_recipe 'wordpress::php'
include_recipe 'wordpress::mysql'
include_recipe 'wordpress::download'
</pre>
<p>The best practice is to create a role for each cookbook, so let&#8217;s create one. </p>
<pre class="brush: plain; title: ; notranslate">
knife role create wordpress
</pre>
<p>Edit the json file so it looks like this.</p>
<pre class="brush: plain; title: ; notranslate">
{
  &quot;name&quot;: &quot;wordpress&quot;,
  &quot;description&quot;: &quot;Role to install WordPress (apache, php, mysql)&quot;,
  &quot;json_class&quot;: &quot;Chef::Role&quot;,
  &quot;default_attributes&quot;: {

  },
  &quot;override_attributes&quot;: {

  },
  &quot;chef_type&quot;: &quot;role&quot;,
  &quot;run_list&quot;: &#x5B;
    &quot;recipe&#x5B;wordpress::apache]&quot;,
    &quot;recipe&#x5B;wordpress::php]&quot;,
    &quot;recipe&#x5B;wordpress::mysql]&quot;,
    &quot;recipe&#x5B;wordpress::download]&quot;
  ],
  &quot;env_run_lists&quot;: {

  }
}
</pre>
<p>Upload the cookbook to the server and execute it against a node.</p>
<pre class="brush: bash; title: ; notranslate">
knife cookbook upload wordpress
knife bootstrap centostest --ssh-user klimenta --sudo -N centostest.andreev.local -r 'role&#x5B;wordpress]'
</pre>
<p>In my home lab it took about 1m to install everything on a 1 CPU, 1GB RAM virtual CentOS. Once completed go to your website (http://centostest.andreev.local in my case). If you have SELinux, you&#8217;ll have to manually create the config as per WordPress instructions, otherwise &#8211; you are all set.<br />
<a href="https://blog.andreev.it/wp-content/uploads/2018/04/P103-02.png"><img decoding="async" src="https://blog.andreev.it/wp-content/uploads/2018/04/P103-02.png" alt="" width="754" height="623" class="aligncenter size-full wp-image-8212" /></a> </p>
]]></content:encoded>
					
					<wfw:commentRss>https://blog.andreev.it/2018/04/126-chef-deploy-wordpress-on-centos-7/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>CentOS: Install Chef server on CentOS 7, workstation on Windows + managing a node</title>
		<link>https://blog.andreev.it/2018/01/119-centos-chef-install-chef-server-centos-7-workstation-windows-managing-node/</link>
					<comments>https://blog.andreev.it/2018/01/119-centos-chef-install-chef-server-centos-7-workstation-windows-managing-node/#comments</comments>
		
		<dc:creator><![CDATA[Kliment Andreev]]></dc:creator>
		<pubDate>Thu, 18 Jan 2018 21:02:46 +0000</pubDate>
				<category><![CDATA[CentOS]]></category>
		<category><![CDATA[DevOps]]></category>
		<category><![CDATA[Windows]]></category>
		<category><![CDATA[centos]]></category>
		<category><![CDATA[Chef]]></category>
		<guid isPermaLink="false">http://blog.iandreev.com/?p=3522</guid>

					<description><![CDATA[In this post I&#8217;ll explain how to install a Chef server on CentOS 7&#8230;]]></description>
										<content:encoded><![CDATA[<div id="bsf_rt_marker"></div><p>In this post I&#8217;ll explain how to install a Chef server on CentOS 7 server. A Chef server is usually managed by a Chef workstation and the servers that we manage with the workstation via the server are called Chef nodes. For more detailed info, go to https://learn.chef.io. So, we&#8217;ll install Chef server on CentOS 7, a Chef workstation on Windows 10 and bootstrap a Chef node on CentOS 7 and a Chef node on Windows 2012R2. Then, we&#8217;ll create a cookbook that will do something and then explain a couple of commands that are commonly used. The hostnames in this post are <strong>chef-server.chef.local, chef-wks.chef.local</strong>, <strong>chef-node.chef.local</strong> for the CentOS node and <strong>chef-node-win</strong> for the Windows node.</p>
<h1>Chef server</h1>
<p>Go to https://downloads.chef.io/chef-server and download the RPM for Red Hat Linux. You can use the root user to install the server or some other user with sudo rights. Once the RPM file has been transferred, install the server.</p>
<pre class="brush: bash; title: ; notranslate">
cd
sudo rpm -Uvh chef-server-core-12.17.15-1.el7.x86_64.rpm
</pre>
<p>Most likely, you&#8217;ll file-name will differ because Chef releases updates quite often.<br />
Once installed, do an initial configuration.</p>
<pre class="brush: bash; title: ; notranslate">
sudo chef-server-ctl reconfigure
</pre>
<p>We need to create an admin user for Chef. This admin users is a Chef user, not an OS user.</p>
<pre class="brush: bash; title: ; notranslate">
sudo chef-server-ctl user-create chef-admin Chef Admin chefadmin@iandreev.com SomePassword --filename chef-admin.pem
</pre>
<p>This command will create an admin user called <strong>chef-admin</strong> with first name <strong>Chef </strong>and last name <strong>Admin</strong>. The e-mail of the <strong>chef-admin</strong> user is <strong>chefadmin@iandreev.com</strong> and the password is <strong>SomePassword</strong>. The command will also create a certificate that we will use to log to the server from the workstation. So, the PEM file is very important. If everything is OK, you&#8217;ll get your prompt back without any notifications.<br />
Now that we have the user created, we&#8217;ll create an organization. An organization is a top-level entity for the roles, groups and nodes. With the same command, we&#8217;ll add the user that we just created as a member of the organization.</p>
<pre class="brush: bash; title: ; notranslate">
sudo chef-server-ctl org-create chef-org &quot;Chef Organization, Inc.&quot; --association_user chef-admin --filename chef-org.pem
</pre>
<p>This command creates a Chef organization called <strong>chef-org</strong>, a detailed description for the organization is &#8220;<strong>Chef Organization, Inc.</strong>&#8221; and we associate the user <strong>chef-admin</strong> with the organization. The PEM file is used for validation as well, but we won&#8217;t need it. It was used in versions of Chef before v12 to authenticate users. Make sure that the organization&#8217;s name is all lower case, otherwise you&#8217;ll get an error.<br />
At this point, we have the user and the organization created. This should be enough to do everything we need, but we&#8217;ll install a GUI called Chef Manage that can ease some of the admin tasks. </p>
<pre class="brush: bash; title: ; notranslate">
sudo chef-server-ctl install chef-manage 
</pre>
<p>Once installed, we have to accept the license. Type <strong>yes </strong>and hit Enter when prompted.</p>
<pre class="brush: bash; title: ; notranslate">
sudo chef-manage-ctl reconfigure
</pre>
<p>Once completed, you can access the server over https (e.g. https://chef_server_name_or_ip). Use the same username and password from the above. It looks like this.<br />
<a href="https://blog.andreev.it/wp-content/uploads/2018/01/P096-01.png"><img decoding="async" src="https://blog.andreev.it/wp-content/uploads/2018/01/P096-01.png" alt="" width="935" height="687" class="aligncenter size-full wp-image-7806" srcset="https://blog.andreev.it/wp-content/uploads/2018/01/P096-01.png 935w, https://blog.andreev.it/wp-content/uploads/2018/01/P096-01-300x220.png 300w, https://blog.andreev.it/wp-content/uploads/2018/01/P096-01-768x564.png 768w, https://blog.andreev.it/wp-content/uploads/2018/01/P096-01-585x430.png 585w" sizes="(max-width: 935px) 100vw, 935px" /></a><br />
We are done with the server. </p>
<h1>Chef workstation</h1>
<p>Chef servers are managed from workstations. We&#8217;ll use Windows 10. The installation is very simple. Go to this <a href="https://downloads.chef.io/chefdk#windows" rel="noopener noreferrer" target="_blank">link </a>and download the client (Chef DK &#8211; Development Kit) for Windows 10. Use the defaults to install. Once installed, you&#8217;ll see a shortcut on your desktop. </p>
<p><a href="https://blog.andreev.it/wp-content/uploads/2018/01/P096-02.png"><img loading="lazy" decoding="async" src="https://blog.andreev.it/wp-content/uploads/2018/01/P096-02.png" alt="" width="114" height="131" class="aligncenter size-full wp-image-7807" /></a><br />
This will start PowerShell in admin mode. If your workstation was never configured for PowerShell, you&#8217;ll see something like this. </p>
<p><a href="https://blog.andreev.it/wp-content/uploads/2018/01/P096-03.png"><img loading="lazy" decoding="async" src="https://blog.andreev.it/wp-content/uploads/2018/01/P096-03.png" alt="" width="1200" height="221" class="aligncenter size-full wp-image-7808" srcset="https://blog.andreev.it/wp-content/uploads/2018/01/P096-03.png 1200w, https://blog.andreev.it/wp-content/uploads/2018/01/P096-03-300x55.png 300w, https://blog.andreev.it/wp-content/uploads/2018/01/P096-03-1024x189.png 1024w, https://blog.andreev.it/wp-content/uploads/2018/01/P096-03-768x141.png 768w, https://blog.andreev.it/wp-content/uploads/2018/01/P096-03-1170x215.png 1170w, https://blog.andreev.it/wp-content/uploads/2018/01/P096-03-585x108.png 585w" sizes="(max-width: 1200px) 100vw, 1200px" /></a><br />
Type:</p>
<pre class="brush: powershell; title: ; notranslate">
Set-ExecutionPolicy RemoteSigned
</pre>
<p>and say <strong>Y</strong> and enter.<br />
Close the window and open it again. This time you&#8217;ll be greeted with Ohai, welcome to ChefDK.<br />
OK, so now we have the client installed, but how do we talk to the server? We need some sort of a home folder where all of our cookbooks, recipes and config files will be stored. I&#8217;ll use a folder called <strong>chef </strong>that&#8217;s under the <strong>Documents </strong>folder for this.</p>
<pre class="brush: powershell; title: ; notranslate">
cd ~\Documents
mkdir -p chef\.chef
</pre>
<p>We created another subfolder <strong>.chef</strong>, where we&#8217;ll keep our certificate. That&#8217;s the certificate that we generated when we created the <strong>chef-admin</strong> user. Let&#8217;s copy that file from the server to the workstation. Mind that the user <strong>username </strong>in the command below is the user that I&#8217;ve used to run the Chef install. If you used <strong>root </strong>to install the Chef server, replace the <strong>username </strong>with <strong>root</strong>.</p>
<pre class="brush: powershell; title: ; notranslate">
scp username@chef-server:~username/chef-admin.pem chef/.chef/chef-admin.pem
</pre>
<p>This command will add the Chef server (<strong>hostname: chef-server</strong>) to the list of known hosts under <strong>C:\users\<your_username>\.ssh</strong> folder and copy the certificate PEM file under <strong>C:\users\<your_username>\Documents\chef\.chef</strong> folder. Let&#8217;s create a folder where we&#8217;ll store our cookbooks.</p>
<pre class="brush: powershell; title: ; notranslate">
cd ~\Documents\chef
mkdir cookbooks
</pre>
<p>Now, create a file called <strong>knife.rb</strong> with the following content and save it under <strong>chef\.chef</strong> folder. Or, if you have the <strong>Chef Manage GUI</strong>, you can download the same file if you go to <strong>Administration </strong>from the menu, then select your <strong>Organization </strong>and then <strong>Generate Knife Config</strong> from the left side-bar.</p>
<pre class="brush: ruby; title: ; notranslate">
current_dir = File.dirname(__FILE__)
log_level                 :info
log_location              STDOUT
node_name                 &quot;chef-admin&quot;
client_key                &quot;#{current_dir}/chef-admin.pem&quot;
chef_server_url           &quot;https://chef-server.chef.local/organizations/chef-org&quot;
cookbook_path             &#x5B;&quot;#{current_dir}/../cookbooks&quot;]
</pre>
<p>Under the <strong>chef\.chef</strong> folder, you should have two files now: <strong>chef-admin.pem</strong> certificate and <strong>knife.rb</strong> config file. Let&#8217;s verify if we are all set now.</p>
<pre class="brush: bash; title: ; notranslate">
cd ~\Documents\chef
knife ssl fetch
</pre>
<p>You should see something like this. This will import the nginx server certificate to your local cert store. </p>
<pre class="brush: plain; gutter: false; title: ; notranslate">
WARNING: Certificates from chef-server.chef.local will be fetched and placed in your trusted_cert
directory (c:\users\kliment.andreev\documents\chef\.chef\trusted_certs).

Knife has no means to verify these are the correct certificates. You should
verify the authenticity of these certificates after downloading.

Adding certificate for chef-server_chef_local in c:\users\kliment.andreev\documents\chef\.chef\trusted_certs/chef-server_chef_local.crt
</pre>
<p>OK. Then, check.</p>
<pre class="brush: powershell; title: ; notranslate">
cd ~\Documents\chef
knife ssl check
</pre>
<p>It should say something like this.</p>
<pre class="brush: plain; title: ; notranslate">
Connecting to host chef-server.chef.local:443
Successfully verified certificates from `chef-server.chef.local'
</pre>
<p>This is also a good sign that everything works fine. Sometimes <strong>ssl fetch</strong> and <strong>ssl check pass</strong>, but this one fails. In that case, make sure that the <strong>node_name</strong> directive in <strong>knife.rb</strong> is your actual <strong>chef-admin</strong> name. </p>
<pre class="brush: powershell; title: ; notranslate">
cd ~\Documents\chef
knife client list
</pre>
<p>The output should be something like <strong>chef-org-validator</strong>. If you noticed, I used <strong>cd ~\Documents\chef</strong> a lot. Chef is kind of picky, so it is important to know where are you in the folder tree when running the commands. Always make sure you are in your home directory, <strong>cd ~\Documents\chef</strong> before running the <strong>knife </strong>and <strong>chef </strong>commands. </p>
<h1>Configure git</h1>
<p>Before we generate our first cookbook, we&#8217;ll have to configure git. Do that with the following commands.</p>
<pre class="brush: powershell; title: ; notranslate">
git config --global user.email &quot;you@example.com&quot;
git config --global user.name &quot;Your Name&quot;
</pre>
<h1>Test cookbook</h1>
<p>Without going into any explanations, we&#8217;ll create a test cookbook, upload it to the server and then list the server for available cookbooks.</p>
<pre class="brush: powershell; title: ; notranslate">
cd ~\Documents\chef
chef generate cookbook cookbooks/test
knife cookbook upload test
knife cookbook list
</pre>
<p>If the output looks like this, you are OK. </p>
<pre class="brush: plain; gutter: false; title: ; notranslate">
PS C:\Users\Kliment.ANDREEV\documents\chef&gt; chef generate cookbook cookbooks/test
Generating cookbook test
- Ensuring correct cookbook file content
- Committing cookbook files to git
- Ensuring delivery configuration
- Ensuring correct delivery build cookbook content
- Adding delivery configuration to feature branch
- Adding build cookbook to feature branch
- Merging delivery content feature branch to master

Your cookbook is ready. Type `cd cookbooks/test` to enter it.

There are several commands you can run to get started locally developing and testing your cookbook.
Type `delivery local --help` to see a full list.

Why not start by writing a test? Tests for the default recipe are stored at:

test/smoke/default/default_test.rb

If you'd prefer to dive right in, the default recipe can be found at:

recipes/default.rb

PS C:\Users\Kliment.ANDREEV\documents\chef&gt; knife cookbook upload test
Uploading test         &#x5B;0.1.0]
Uploaded 1 cookbook.

PS C:\Users\Kliment.ANDREEV\documents\chef&gt; knife cookbook list
test   0.1.0

PS C:\Users\Kliment.ANDREEV\documents\chef&gt;
</pre>
<h1>Chef node</h1>
<p>From the workstation execute this line to install the node.</p>
<pre class="brush: bash; title: ; notranslate">
knife bootstrap chef-node --ssh-user username --sudo -N chef-node.chef.local
</pre>
<p>Use a username that can <strong>su </strong>as root, otherwise the command will fail. You have to enter the password twice. Once for the username prompt and the second time for the sudo. The output should look like this. Click to expand.</p>
<pre class="brush: plain; collapse: true; light: false; title: ; toolbar: true; notranslate">
Creating new client for chef-node.chef.local
Creating new node for chef-node.chef.local
Connecting to chef-node
username@chef-node's password:
chef-node 
chef-node We trust you have received the usual lecture from the local System
chef-node Administrator. It usually boils down to these three things:
chef-node 
chef-node     #1) Respect the privacy of others.
chef-node     #2) Think before you type.
chef-node     #3) With great power comes great responsibility.
chef-node 
chef-node knife sudo password: 
Enter your password: 
chef-node 
chef-node -----&gt; Installing Chef Omnibus (-v 13)
chef-node downloading https://omnitruck-direct.chef.io/chef/install.sh
chef-node   to file /tmp/install.sh.2931/install.sh
chef-node trying wget...
chef-node el 7 x86_64
chef-node Getting information for chef stable 13 for el...
chef-node downloading https://omnitruck-direct.chef.io/stable/chef/metadata?v=13&amp;p=el&amp;pv=7&amp;m=x86_64
chef-node   to file /tmp/install.sh.2944/metadata.txt
chef-node trying wget...
chef-node sha1   037a61a5d9c89d9b71d4c4f6256f45ed422a73ee
chef-node sha256 18826690ac2c7e5f16a21d898ed77be7d78fd2d84bc2a71b4506ee480876bc4b
chef-node url    https://packages.chef.io/files/stable/chef/13.6.4/el/7/chef-13.6.4-1.el7.x86_64.rpm
chef-node version        13.6.4
chef-node downloaded metadata file looks valid...
chef-node downloading https://packages.chef.io/files/stable/chef/13.6.4/el/7/chef-13.6.4-1.el7.x86_64.rpm
chef-node   to file /tmp/install.sh.2944/chef-13.6.4-1.el7.x86_64.rpm
chef-node trying wget...
chef-node Comparing checksum with sha256sum...
chef-node Installing chef 13
chef-node installing with rpm...
chef-node warning: /tmp/install.sh.2944/chef-13.6.4-1.el7.x86_64.rpm: Header V4 DSA/SHA1 Signature, key ID 83ef826a: NOKEY
chef-node Preparing...                                                            (1################################# &#x5B;100%]
chef-node Updating / installing...
chef-node    1:chef-13.6.4-1.el7                                                  ( ################################# &#x5B;100%]
chef-node Thank you for installing Chef!
chef-node Starting the first Chef Client run...
chef-node Starting Chef Client, version 13.6.4
chef-node resolving cookbooks for run list: &#x5B;]
chef-node Synchronizing Cookbooks:
chef-node Installing Cookbook Gems:
chef-node Compiling Cookbooks...
chef-node &#x5B;2018-01-20T08:33:15-08:00] WARN: Node chef-node.chef.local has an empty run list.
chef-node Converging 0 resources
chef-node 
chef-node Running handlers:
chef-node Running handlers complete
chef-node Chef Client finished, 0/0 resources updated in 08 seconds
</pre>
<p>Windows requires port 5985 (WinRM) to be opened, so make sure you allow this port, especially if the Chef server and the Chef Windows node are not in the same domain. To test the connection, do:</p>
<pre class="brush: bash; title: ; notranslate">
knife wsman test chef-node-win --manual-list
</pre>
<p>The output should be like this. </p>
<pre class="brush: plain; title: ; notranslate">
Connected successfully to chef-node-win at http://node-win:5985/wsman.
</pre>
<p>For some reason, I wasn&#8217;t able to install Chef node on Windows using an admin account that I&#8217;ve created. I was getting authentication errors. Once I used the built-in Administrator account, everything went fine. This is how to install Chef on Windows.</p>
<pre class="brush: bash; title: ; notranslate">
knife bootstrap windows winrm chef-node-win.chef.local --winrm-user Administrator --winrm-password MyPassword -N node-win.chef.local
</pre>
<p>And if everything is OK, you&#8217;ll see the output. Click to expand.</p>
<pre class="brush: plain; collapse: true; light: false; title: ; toolbar: true; notranslate">
Creating new client for chef-node-win.chef.local
Creating new node for chef-node-win.chef.local

Waiting for remote response before bootstrap.chef-node-win.chef.local . 
chef-node-win.chef.local Response received.
Remote node responded after 0.0 minutes.
Bootstrapping Chef on chef-node-win.chef.local
chef-node-win.chef.local Rendering &quot;C:\Users\ADMINI~1\AppData\Local\Temp\bootstrap-35815-1516539477.bat&quot; chunk 1 
chef-node-win.chef.local Rendering &quot;C:\Users\ADMINI~1\AppData\Local\Temp\bootstrap-35815-1516539477.bat&quot; chunk 2 
chef-node-win.chef.local Rendering &quot;C:\Users\ADMINI~1\AppData\Local\Temp\bootstrap-35815-1516539477.bat&quot; chunk 3 
chef-node-win.chef.local Rendering &quot;C:\Users\ADMINI~1\AppData\Local\Temp\bootstrap-35815-1516539477.bat&quot; chunk 4 
chef-node-win.chef.local Rendering &quot;C:\Users\ADMINI~1\AppData\Local\Temp\bootstrap-35815-1516539477.bat&quot; chunk 5 
chef-node-win.chef.local Rendering &quot;C:\Users\ADMINI~1\AppData\Local\Temp\bootstrap-35815-1516539477.bat&quot; chunk 6 
chef-node-win.chef.local Rendering &quot;C:\Users\ADMINI~1\AppData\Local\Temp\bootstrap-35815-1516539477.bat&quot; chunk 7 
chef-node-win.chef.local Rendering &quot;C:\Users\ADMINI~1\AppData\Local\Temp\bootstrap-35815-1516539477.bat&quot; chunk 8 
chef-node-win.chef.local Checking for existing directory &quot;C:\chef&quot;...
chef-node-win.chef.local Existing directory not found, creating.
chef-node-win.chef.local 
chef-node-win.chef.local C:\Users\Administrator&gt;(
chef-node-win.chef.local echo.url = WScript.Arguments.Named(&quot;url&quot;)  
chef-node-win.chef.local  echo.path = WScript.Arguments.Named(&quot;path&quot;)  
chef-node-win.chef.local  echo.proxy = null  
chef-node-win.chef.local  echo.'* Vaguely attempt to handle file:// scheme urls by url unescaping and switching all  
chef-node-win.chef.local  echo.'* / into .  Also assume that file:/// is a local absolute path and that file://&lt;foo&gt;  
chef-node-win.chef.local  echo.'* is possibly a network file path.  
chef-node-win.chef.local  echo.If InStr(url, &quot;file://&quot;) = 1 Then  
chef-node-win.chef.local  echo.url = Unescape(url)  
chef-node-win.chef.local  echo.If InStr(url, &quot;file:///&quot;) = 1 Then  
chef-node-win.chef.local  echo.sourcePath = Mid(url, Len(&quot;file:///&quot;) + 1)  
chef-node-win.chef.local  echo.Else 
chef-node-win.chef.local  echo.sourcePath = Mid(url, Len(&quot;file:&quot;) + 1)  
chef-node-win.chef.local  echo.End If  
chef-node-win.chef.local  echo.sourcePath = Replace(sourcePath, &quot;/&quot;, &quot;\&quot;)  
chef-node-win.chef.local  echo. 
chef-node-win.chef.local  echo.Set objFSO = CreateObject(&quot;Scripting.FileSystemObject&quot;)  
chef-node-win.chef.local  echo.If objFSO.Fileexists(path) Then objFSO.DeleteFile path  
chef-node-win.chef.local  echo.objFSO.CopyFile sourcePath, path, true  
chef-node-win.chef.local  echo.Set objFSO = Nothing  
chef-node-win.chef.local  echo. 
chef-node-win.chef.local  echo.Else 
chef-node-win.chef.local  echo.Set objXMLHTTP = CreateObject(&quot;MSXML2.ServerXMLHTTP&quot;)  
chef-node-win.chef.local  echo.Set wshShell = CreateObject( &quot;WScript.Shell&quot; )  
chef-node-win.chef.local  echo.Set objUserVariables = wshShell.Environment(&quot;USER&quot;)  
chef-node-win.chef.local  echo. 
chef-node-win.chef.local  echo.rem http proxy is optional  
chef-node-win.chef.local  echo.rem attempt to read from HTTP_PROXY env var first  
chef-node-win.chef.local  echo.On Error Resume Next  
chef-node-win.chef.local  echo. 
chef-node-win.chef.local  echo.If NOT (objUserVariables(&quot;HTTP_PROXY&quot;) = &quot;&quot;) Then  
chef-node-win.chef.local  echo.proxy = objUserVariables(&quot;HTTP_PROXY&quot;)  
chef-node-win.chef.local  echo. 
chef-node-win.chef.local  echo.rem fall back to named arg  
chef-node-win.chef.local  echo.ElseIf NOT (WScript.Arguments.Named(&quot;proxy&quot;) = &quot;&quot;) Then  
chef-node-win.chef.local  echo.proxy = WScript.Arguments.Named(&quot;proxy&quot;)  
chef-node-win.chef.local  echo.End If  
chef-node-win.chef.local  echo. 
chef-node-win.chef.local  echo.If NOT isNull(proxy) Then  
chef-node-win.chef.local  echo.rem setProxy method is only available on ServerXMLHTTP 6.0+  
chef-node-win.chef.local  echo.Set objXMLHTTP = CreateObject(&quot;MSXML2.ServerXMLHTTP.6.0&quot;)  
chef-node-win.chef.local  echo.objXMLHTTP.setProxy 2, proxy  
chef-node-win.chef.local  echo.End If  
chef-node-win.chef.local  echo. 
chef-node-win.chef.local  echo.On Error Goto 0  
chef-node-win.chef.local  echo. 
chef-node-win.chef.local  echo.objXMLHTTP.open &quot;GET&quot;, url, false  
chef-node-win.chef.local  echo.objXMLHTTP.send() 
chef-node-win.chef.local  echo.If objXMLHTTP.Status = 200 Then  
chef-node-win.chef.local  echo.Set objADOStream = CreateObject(&quot;ADODB.Stream&quot;)  
chef-node-win.chef.local  echo.objADOStream.Open 
chef-node-win.chef.local  echo.objADOStream.Type = 1  
chef-node-win.chef.local  echo.objADOStream.Write objXMLHTTP.ResponseBody  
chef-node-win.chef.local  echo.objADOStream.Position = 0  
chef-node-win.chef.local  echo.Set objFSO = Createobject(&quot;Scripting.FileSystemObject&quot;)  
chef-node-win.chef.local  echo.If objFSO.Fileexists(path) Then objFSO.DeleteFile path  
chef-node-win.chef.local  echo.Set objFSO = Nothing  
chef-node-win.chef.local  echo.objADOStream.SaveToFile path  
chef-node-win.chef.local  echo.objADOStream.Close 
chef-node-win.chef.local  echo.Set objADOStream = Nothing  
chef-node-win.chef.local  echo.End If  
chef-node-win.chef.local  echo.Set objXMLHTTP = Nothing  
chef-node-win.chef.local  echo.End If 
chef-node-win.chef.local ) 1&gt;C:\chef\wget.vbs 
chef-node-win.chef.local 
chef-node-win.chef.local C:\Users\Administrator&gt;(
chef-node-win.chef.local echo.param( 
chef-node-win.chef.local  echo.   &#x5B;String] $remoteUrl,  
chef-node-win.chef.local  echo.   &#x5B;String] $localPath  
chef-node-win.chef.local  echo.) 
chef-node-win.chef.local  echo. 
chef-node-win.chef.local  echo.$ProxyUrl = $env:http_proxy;  
chef-node-win.chef.local  echo.$webClient = new-object System.Net.WebClient;  
chef-node-win.chef.local  echo. 
chef-node-win.chef.local  echo.if ($ProxyUrl -ne '') {  
chef-node-win.chef.local  echo.  $WebProxy = New-Object System.Net.WebProxy($ProxyUrl,$true)  
chef-node-win.chef.local  echo.  $WebClient.Proxy = $WebProxy  
chef-node-win.chef.local  echo.} 
chef-node-win.chef.local  echo. 
chef-node-win.chef.local  echo.$webClient.DownloadFile($remoteUrl, $localPath); 
chef-node-win.chef.local ) 1&gt;C:\chef\wget.ps1 
chef-node-win.chef.local 
chef-node-win.chef.local C:\Users\Administrator&gt;(
chef-node-win.chef.local  
chef-node-win.chef.local   
chef-node-win.chef.local  
chef-node-win.chef.local ) 
chef-node-win.chef.local Detected Windows Version 6.3 Build 9600
chef-node-win.chef.local 
chef-node-win.chef.local C:\Users\Administrator&gt;goto Version6.3 
chef-node-win.chef.local 
chef-node-win.chef.local C:\Users\Administrator&gt;goto Version6.2 
chef-node-win.chef.local 
chef-node-win.chef.local C:\Users\Administrator&gt;goto architecture_select 
chef-node-win.chef.local 
chef-node-win.chef.local C:\Users\Administrator&gt;IF &quot;AMD64&quot; == &quot;x86&quot; IF not defined PROCESSOR_ARCHITEW6432 
chef-node-win.chef.local 
chef-node-win.chef.local C:\Users\Administrator&gt;goto install 
chef-node-win.chef.local Checking for existing downloaded package at &quot;C:\Users\ADMINI~1\AppData\Local\Temp\chef-client-latest.msi&quot;
chef-node-win.chef.local No existing downloaded packages to delete.
chef-node-win.chef.local Attempting to download client package using PowerShell if available...
chef-node-win.chef.local powershell.exe -ExecutionPolicy Unrestricted -InputFormat None -NoProfile -NonInteractive -File  C:\chef\wget.ps1 &quot;https://www.chef.io/chef/download?p=windows&amp;pv=2012&amp;m=x86_64&amp;DownloadContext=PowerShell&amp;v=13&quot; &quot;C:\Users\ADMINI~1\AppData\Local\Temp\chef-client-latest.msi&quot;
chef-node-win.chef.local Download via PowerShell succeeded.
chef-node-win.chef.local Installing downloaded client package...
chef-node-win.chef.local 
chef-node-win.chef.local C:\Users\Administrator&gt;msiexec /qn /log &quot;C:\Users\ADMINI~1\AppData\Local\Temp\chef-client-msi20931.log&quot; /i &quot;C:\Users\ADMINI~1\AppData\Local\Temp\chef-client-latest.msi&quot; 
chef-node-win.chef.local Successfully installed Chef Client package.
chef-node-win.chef.local Installation completed successfully
chef-node-win.chef.local Writing validation key...
chef-node-win.chef.local Validation key written.
chef-node-win.chef.local 
chef-node-win.chef.local C:\Users\Administrator&gt;mkdir C:\chef\trusted_certs 
chef-node-win.chef.local 
chef-node-win.chef.local C:\Users\Administrator&gt;(
chef-node-win.chef.local echo.-----BEGIN CERTIFICATE-----  
chef-node-win.chef.local  echo.MIID6zCCAtOgAwIBAgIBADANBgkqhkiG9w0BAQsFADBRMQswCQYDVQQGEwJVUzEQ 
chef-node-win.chef.local  echo.MA4GA1UECgwHWW91Q29ycDETMBEGA1UECwwKT3BlcmF0aW9uczEbMBkGA1UEAwwS 
chef-node-win.chef.local  echo.Y2hlZi5hbmRyZWV2LmxvY2FsMB4XDTE4MDExNDIyMjkwMloXDTI4MDExMjIyMjkw 
chef-node-win.chef.local  echo.MlowUTELMAkGA1UEBhMCVVMxEDAOBgNVBAoMB1lvdUNvcnAxEzARBgNVBAsMCk9w 
chef-node-win.chef.local  echo.ZXJhdGlvbnMxGzAZBgNVBAMMEmNoZWYuYW5kcmVldi5sb2NhbDCCASIwDQYJKoZI 
chef-node-win.chef.local  echo.hvcNAQEBBQADggEPADCCAQoCggEBAKiyl7i+TpCdwvWtAnpcktKL5BKm/zonS87f 
chef-node-win.chef.local  echo.mm61beXd7CDJifcpllinq/b/96r6872odbmVYHZ3uwGhX3+95AlFOOZiM+Ze08Ds 
chef-node-win.chef.local  echo.574Rj53Xz+ASSCcZsbwdAPc//dBs67GndNjgH3iy2bAFxjOkPJJX9bBZoKhYEXRp 
chef-node-win.chef.local  echo.9xEdUEQwj3W0g92b3sDx2gDSOXgP43g+vqRLjUiCAmRmCmgFkMkb9Xitxn3CXXiM 
chef-node-win.chef.local  echo.KDSUDiR1CA8FbrzIZ/O4ahB9UMeGvUEUkD2nN3BcWphXYWz5sVxxVBlqmyK51EIa 
chef-node-win.chef.local  echo.lUd/lKw0xw2iYPUAkjxPdr7djJGgEQqXiYC3/r4v4w3RAdVY5jUCAwEAAaOBzTCB 
chef-node-win.chef.local  echo.yjAPBgNVHRMBAf8EBTADAQH/MB0GA1UdDgQWBBT+SJ3clvJyuQqFPpcaCWX7QB8i 
chef-node-win.chef.local  echo.HzAdBgNVHREEFjAUghJjaGVmLmFuZHJlZXYubG9jYWwweQYDVR0jBHIwcIAU/kid 
chef-node-win.chef.local  echo.3JbycrkKhT6XGgll+0AfIh+hVaRTMFExCzAJBgNVBAYTAlVTMRAwDgYDVQQKDAdZ 
chef-node-win.chef.local  echo.b3VDb3JwMRMwEQYDVQQLDApPcGVyYXRpb25zMRswGQYDVQQDDBJjaGVmLmFuZHJl 
chef-node-win.chef.local  echo.ZXYubG9jYWyCAQAwDQYJKoZIhvcNAQELBQADggEBAImSEMXEX+rqbRd3ireoFbkY 
chef-node-win.chef.local  echo.b97RmbsXjcwmA6MuAIZIyoFw/DwRUBrahrlLhXEAgeDWPlgS2xGniLJxdGx5a0ca 
chef-node-win.chef.local  echo.pz/8hC4RQuIq4kOWhkvcFTms/hPXIVSyBcYEt4FFkrhOeIDxwoBrEfIFncXC8DiL 
chef-node-win.chef.local  echo.IdPUH1DZeJLx8T7zCrUjFpPG3IL65HXIsteXaGNsJtKoRdDprPIIGlUlw72n5M9Y 
chef-node-win.chef.local  echo.Y8VoH6s5roky3OemhOIqPzgK/fVhY3cQWivRdDNe7M2hT03TmwpvbFs0Emydaa+Q 
chef-node-win.chef.local  echo.E+QroZpUvQZK6I6gtN1kG5K8M+HBNnx2NavKj8YjuQokeJYEF6Fb7dhGz5BMgPU=  
chef-node-win.chef.local  echo.-----END CERTIFICATE----- 
chef-node-win.chef.local ) 1&gt;C:\chef/trusted_certs/chef_andreev_local.crt 
chef-node-win.chef.local 
chef-node-win.chef.local C:\Users\Administrator&gt;(
chef-node-win.chef.local echo.chef_server_url  &quot;https://chef.andreev.local/organizations/iandreev&quot;  
chef-node-win.chef.local  echo.validation_client_name &quot;chef-validator&quot;  
chef-node-win.chef.local  echo.file_cache_path   &quot;c:/chef/cache&quot;  
chef-node-win.chef.local  echo.file_backup_path  &quot;c:/chef/backup&quot;  
chef-node-win.chef.local  echo.cache_options     ({:path =&gt; &quot;c:/chef/cache/checksums&quot;, :skip_expires =&gt; true})  
chef-node-win.chef.local  echo.node_name &quot;chef-node-win.chef.local&quot;  
chef-node-win.chef.local  echo.log_level        :info  
chef-node-win.chef.local  echo.log_location       STDOUT  
chef-node-win.chef.local  echo.trusted_certs_dir &quot;c:/chef/trusted_certs&quot; 
chef-node-win.chef.local ) 1&gt;C:\chef\client.rb 
chef-node-win.chef.local 
chef-node-win.chef.local C:\Users\Administrator&gt;(echo.{&quot;run_list&quot;:&#x5B;]}) 1&gt;C:\chef\first-boot.json 
chef-node-win.chef.local Starting chef to bootstrap the node...
chef-node-win.chef.local 
chef-node-win.chef.local C:\Users\Administrator&gt;SET &quot;PATH=C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\ruby\bin;C:\opscode\chef\bin;C:\opscode\chef\embedded\bin&quot; 
chef-node-win.chef.local 
chef-node-win.chef.local C:\Users\Administrator&gt;chef-client -c c:/chef/client.rb -j c:/chef/first-boot.json 
chef-node-win.chef.local Starting Chef Client, version 13.6.4
chef-node-win.chef.local 
chef-node-win.chef.local &#x5B;2018-01-21T07:58:38-05:00] INFO: *** Chef 13.6.4 ***
chef-node-win.chef.local &#x5B;2018-01-21T07:58:38-05:00] INFO: Platform: x64-mingw32
chef-node-win.chef.local &#x5B;2018-01-21T07:58:38-05:00] INFO: Chef-client pid: 2936
chef-node-win.chef.local &#x5B;2018-01-21T07:58:38-05:00] INFO: The plugin path C:\chef\ohai\plugins does not exist. Skipping...
chef-node-win.chef.local &#x5B;2018-01-21T07:58:49-05:00] INFO: Setting the run_list to &#x5B;] from CLI options
chef-node-win.chef.local &#x5B;2018-01-21T07:58:49-05:00] INFO: Run List is &#x5B;]
chef-node-win.chef.local &#x5B;2018-01-21T07:58:49-05:00] INFO: Run List expands to &#x5B;]
chef-node-win.chef.local &#x5B;2018-01-21T07:58:49-05:00] INFO: Starting Chef Run for chef-node-win.chef.local
chef-node-win.chef.local &#x5B;2018-01-21T07:58:49-05:00] INFO: Running start handlers
chef-node-win.chef.local &#x5B;2018-01-21T07:58:49-05:00] INFO: Start handlers complete.
chef-node-win.chef.local &#x5B;2018-01-21T07:58:49-05:00] INFO: Error while reporting run start to Data Collector. URL: https://chef.andreev.local/organizations/iandreev/data-collector Exception: 404 -- 404 &quot;Not Found&quot;  (This is normal if you do not have Chef Automate)
chef-node-win.chef.local resolving cookbooks for run list: &#x5B;]
chef-node-win.chef.local &#x5B;2018-01-21T07:58:49-05:00] INFO: Loading cookbooks &#x5B;]
chef-node-win.chef.local Synchronizing Cookbooks:
chef-node-win.chef.local Installing Cookbook Gems:
chef-node-win.chef.local Compiling Cookbooks...
chef-node-win.chef.local &#x5B;2018-01-21T07:58:49-05:00] WARN: Node chef-node-win.chef.local has an empty run list.
chef-node-win.chef.local Converging 0 resources
chef-node-win.chef.local 
chef-node-win.chef.local &#x5B;2018-01-21T07:58:50-05:00] INFO: Chef Run complete in 0.437135 seconds
chef-node-win.chef.local 
chef-node-win.chef.local Running handlers:
chef-node-win.chef.local &#x5B;2018-01-21T07:58:50-05:00] INFO: Running report handlers
chef-node-win.chef.local Running handlers complete
chef-node-win.chef.local &#x5B;2018-01-21T07:58:50-05:00] INFO: Report handlers complete
chef-node-win.chef.local Chef Client finished, 0/0 resources updated in 11 seconds
</pre>
<p>Check the details for each node.</p>
<pre class="brush: bash; title: ; notranslate">
knife node show chef-node.chef.local
Node Name:   chef-node.chef.local
Environment: _default
FQDN:        chef-node.chef.local
IP:          192.168.1.16
Run List:    
Roles:       
Recipes:     
Platform:    centos 7.2.1511
Tags:    
</pre>
<pre class="brush: bash; title: ; notranslate">    
knife node show chef-node-win.chef.local
Node Name:   chef-node-win.chef.local
Environment: _default
FQDN:        chef-node-win
IP:          192.168.1.20
Run List:    
Roles:       
Recipes:     
Platform:    windows 6.3.9600
Tags:        
</pre>
]]></content:encoded>
					
					<wfw:commentRss>https://blog.andreev.it/2018/01/119-centos-chef-install-chef-server-centos-7-workstation-windows-managing-node/feed/</wfw:commentRss>
			<slash:comments>2</slash:comments>
		
		
			</item>
	</channel>
</rss>
