Contributors20 minutesIn the previous part, you used knife to update your node's configuration. Many Chef users start out by using knife to update their servers' configuration on demand. You can then move to a continuous delivery system, such as Chef Automate, to release changes more often and with greater safety. A continuous delivery system might run chef-client on your nodes when an explicit change is made to your configuration policy, for example, when a change is committed to your version control system.
In addition to running chef-client when your configuration policy changes, you may also want to run chef-client periodically. One reason is to help ensure that your servers are free from configuration drift.
In this part, you'll use the chef-client cookbook to set up your node to run chef-client periodically. During the process, you'll learn how to:
- use community cookbooks from Chef Supermarket.
- use Berkshelf to resolve cookbook dependencies.
- use a role to define your node's attributes and its run-list.
This is the final part of this module, so you'll also learn how to optionally clean up your environment by removing your cookbook and node from the Chef server.
1. Get the chef-client cookbook
In this part, you'll get the chef-client cookbook from Chef Supermarket and upload the chef-client cookbook and its dependent cookbooks to your Chef server.
There are multiple ways to set up chef-client to run on a regular interval. On Linux nodes, you might use a daemon, cron job, or service. On Windows, you might use a scheduled task.
You can of course manually set chef-client to run on a regular interval. Another way is to use the chef-client cookbook from Chef Supermarket. Earlier in this module, you obtained starter code from GitHub. Chef Supermarket is also a place for the community to share cookbooks. You'll work more with community cookbooks in future modules.
On Linux, the chef-client cookbook sets up chef-client to run as a service. On Windows, this cookbook sets up chef-client to run as a scheduled task. One benefit to using the chef-client cookbook is that it works on multiple platforms.
There are several ways to obtain cookbooks from Chef Supermarket. One way is to use the knife supermarket command. However, the chef-client cookbook has dependencies on other cookbooks (you'll learn more about cookbook dependencies in a later module), and knife supermarket does not resolve these dependencies for you.
Berkshelf is a tool that helps you resolve cookbook dependencies. Berkshelf can retrieve the cookbooks that your cookbook depends on and can upload your cookbooks to your Chef server. Berkshelf comes with Chef Workstation.
To get started, first ensure you're in the ~/learn-chef directory.
Next, you need to create a configuration file that tells Berkshelf which cookbooks you want and where they're located. From your ~/learn-chef directory, create a file named Berksfile and add these contents.
Editor: ~/learn-chef/Berksfile
1
2
| source 'https://supermarket.chef.io'
cookbook 'chef-client' |
Chef provides a public Chef Supermarket site at https://supermarket.chef.io. You can also manage your own private Chef Supermarket server. Your Berksfile specifies that you want the chef-client cookbook and to pull cookbooks from the public Chef Supermarket server.
The next step is to run berks install to download the chef-client cookbook and its dependencies.
Terminal: ~/learn-chef
$ | berks installResolving cookbook dependencies...Fetching cookbook index from https://supermarket.chef.io...Installing chef-client (10.0.4)Installing cron (5.1.0)Installing logrotate (2.2.0)Installing windows (4.2.2)
|
Berkshelf downloads the chef-client cookbook and its dependent cookbooks to the ~/.berkshelf/cookbooks directory.
Terminal: ~/learn-chef
$ | ls ~/.berkshelf/cookbookschef-client-10.0.4cron-5.1.0logrotate-2.2.0windows-4.2.2
|
Next, you need to upload the chef-client cookbook and its dependencies to your Chef server.
Previously, you ran knife cookbook upload to upload your learn_chef_iis cookbook to the Chef server. Remember that the chef-client cookbook has dependencies on other cookbooks, so you need a way to upload everything.
You could run knife cookbook upload to manually upload each cookbook. An easier way is to run berks upload. Like berks install, berks upload handles dependencies for you.
Run berks upload to upload the chef-client cookbook and its dependencies to Chef server.
Terminal: ~/learn-chef
$ | berks upload --no-ssl-verifyUploaded chef-client (10.0.4) to: 'https://ec2-34-207-124-26.compute-1.amazonaws.com:443/organizations/4thcoffee'Uploaded cron (5.1.0) to: 'https://ec2-34-207-124-26.compute-1.amazonaws.com:443/organizations/4thcoffee'Uploaded logrotate (2.2.0) to: 'https://ec2-34-207-124-26.compute-1.amazonaws.com:443/organizations/4thcoffee'Uploaded windows (4.2.2) to: 'https://ec2-34-207-124-26.compute-1.amazonaws.com:443/organizations/4thcoffee'
|
Berkshelf requires a trusted SSL certificate in order to upload cookbooks. The --no-ssl-verify flag disables SSL verification, which is typically fine for testing purposes. Chef server comes with a self-signed SSL certificate. For production, you might use a trusted SSL certificate. The documentation describes how Chef server works with SSL certificates.
2. Create a role
Now that the chef-client cookbook is on your Chef server, you need to update your node's run-list to use it. You also need to specify how often to run chef-client. In this part, you'll use a role to define both.
How often chef-client is run is controlled by two node attributes (source code):
node['chef_client']['interval'] – interval specifies the number of seconds between chef-client runs. The default value is 1,800 (30 minutes).node['chef_client']['splay'] – splay specifies a maximum random number of seconds that is added to the interval. Splay helps balance the load on the Chef server by ensuring that many chef-client runs are not occurring at the same interval. The default value is 300 (5 minutes).
By default, chef-client will run every 30—35 minutes on your node. In practice, the values you choose depend on your requirements. For learning purposes, you'll specify an interval of 5 minutes (300 seconds) and a splay of 1 minute (60 seconds), causing your node to check in every 5—6 minutes.
To update your node's run-list, you could use the knife node run_list set command. However, that does not set the appropriate node attributes.
To accomplish both tasks, you'll use a role. Roles enable you to focus on the function your node performs collectively rather than each of its individual components (its run-list, node attributes, and so on). For example, you might have a web server role, a database role, or a load balancer role. Here, you'll create a role named web to define your node's function as a web server.
Roles are stored as objects on the Chef server. To create a role, you can use the knife role create command. Another common way is to create a file (in JSON format) that describes your role and then run the knife role from file command to upload that file to the Chef server. The advantage of creating a file is that you can store that file in a version control system such as Git.
First, ensure you have a directory named ~/learn-chef/roles.
Terminal: ~/learn-chef
$ | mkdir ~/learn-chef/roles
|
Now add the following to a file named ~/learn-chef/roles/web.json.
Editor: ~/learn-chef/roles/web.json
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
| {
"name": "web",
"description": "Web server role.",
"json_class": "Chef::Role",
"default_attributes": {
"chef_client": {
"interval": 300,
"splay": 60
}
},
"override_attributes": {
},
"chef_type": "role",
"run_list": ["recipe[chef-client::default]",
"recipe[chef-client::delete_validation]",
"recipe[learn_chef_iis::default]"
],
"env_run_lists": {
}
} |
This file defines the web role. It sets the required interval and splay attributes and sets the run-list to contain the chef-client cookbook as well as the learn_chef_iis cookbook.
As a recommended practice, the run-list also contains the chef-client::delete_validation recipe (source code). This recipe deletes the validation certificate (for example, C:\chef\validation.pem) from your node. This certificate is used during the bootstrap process to authorize the node to connect to the Chef server, and is no longer needed.
Next, run the following knife role from file command to upload your role to the Chef server.
Terminal: ~/learn-chef
$ | knife role from file roles/web.jsonUpdated Role web
|
As a verification step, you can run knife role list to view the roles on your Chef server.
You can also run knife role show web to view the role's details.
Terminal: ~/learn-chef
$ | knife role show webchef_type: roledefault_attributes: chef_client: interval: 300 splay: 60description: Web server role.env_run_lists:json_class: Chef::Rolename: weboverride_attributes:run_list: recipe[chef-client::default] recipe[chef-client::delete_validation] recipe[learn_chef_iis::default]
|
The final step is to set your node's run-list. Run the following knife node run_list set command to do that.
Terminal: ~/learn-chef
$ | knife node run_list set node1-windows "role[web]"node1-windows: run_list: role[web]
|
As a verification step, you can run the knife node show command to view your node's run-list.
Terminal: ~/learn-chef
$ | knife node show node1-windows --run-listnode1-windows: run_list: role[web]
|
You're now ready to run chef-client on your node.
3. Run chef-client
As before, run knife winrm to trigger chef-client to run on your node. This time, replace the search query 'name:node1-windows' with 'role:web'. If you had multiple nodes with the web role, chef-client would run on each of them.
This example shows key-based authentication. Choose the method you used earlier.
Terminal: ~/learn-chef
$ | knife winrm 'role:web' chef-client --winrm-user Administrator --winrm-password '7pXySo%!Cz' --attribute ipaddress172.31.62.107 Starting Chef Client, version 13.8.5172.31.62.107 172.31.62.107 [2018-05-03T15:35:16+00:00] INFO: *** Chef 13.8.5 ***172.31.62.107 [2018-05-03T15:35:16+00:00] INFO: *** Chef 13.8.5 ***172.31.62.107 [2018-05-03T15:35:16+00:00] INFO: Platform: x64-mingw32172.31.62.107 [2018-05-03T15:35:16+00:00] INFO: Platform: x64-mingw32172.31.62.107 [2018-05-03T15:35:16+00:00] INFO: Chef-client pid: 1584172.31.62.107 [2018-05-03T15:35:16+00:00] INFO: Chef-client pid: 1584172.31.62.107 [2018-05-03T15:35:16+00:00] INFO: The plugin path C:\chef\ohai\plugins does not exist. Skipping...172.31.62.107 [2018-05-03T15:35:16+00:00] INFO: The plugin path C:\chef\ohai\plugins does not exist. Skipping...172.31.62.107 [2018-05-03T15:35:20+00:00] INFO: Run List is [role[web]]172.31.62.107 [2018-05-03T15:35:20+00:00] INFO: Run List is [role[web]]172.31.62.107 [2018-05-03T15:35:20+00:00] INFO: Run List expands to [chef-client::default, chef-client::delete_validation, learn_chef_iis::default]172.31.62.107 [2018-05-03T15:35:20+00:00] INFO: Run List expands to [chef-client::default, chef-client::delete_validation, learn_chef_iis::default]172.31.62.107 [2018-05-03T15:35:20+00:00] INFO: Starting Chef Run for node1-windows172.31.62.107 [2018-05-03T15:35:20+00:00] INFO: Starting Chef Run for node1-windows172.31.62.107 [2018-05-03T15:35:20+00:00] INFO: Running start handlers172.31.62.107 [2018-05-03T15:35:20+00:00] INFO: Running start handlers172.31.62.107 [2018-05-03T15:35:20+00:00] INFO: Start handlers complete.172.31.62.107 [2018-05-03T15:35:20+00:00] INFO: Start handlers complete.172.31.62.107 [2018-05-03T15:35:20+00:00] INFO: Error while reporting run start to Data Collector. URL: https://ec2-34-207-124-26.compute-1.amazonaws.com/organizations/4thcoffee/data-collector Exception: 404 -- 404 "Not Found" (This is normal if you do not have Chef Automate)172.31.62.107 [2018-05-03T15:35:20+00:00] INFO: Error while reporting run start to Data Collector. URL: https://ec2-34-207-124-26.compute-1.amazonaws.com/organizations/4thcoffee/data-collector Exception: 404 -- 404 "Not Found" (This is normal if you do not have Chef Automate)172.31.62.107 resolving cookbooks for run list: ["chef-client::default", "chef-client::delete_validation", "learn_chef_iis::default"]172.31.62.107 [2018-05-03T15:35:20+00:00] INFO: Loading cookbooks [chef-client@10.0.4, cron@5.1.0, logrotate@2.2.0, windows@4.2.2, learn_chef_iis@0.3.1]172.31.62.107 [2018-05-03T15:35:20+00:00] INFO: Loading cookbooks [chef-client@10.0.4, cron@5.1.0, logrotate@2.2.0, windows@4.2.2, learn_chef_iis@0.3.1]172.31.62.107 Synchronizing Cookbooks:172.31.62.107 [2018-05-03T15:35:20+00:00] INFO: Storing updated cookbooks/chef-client/resources/scheduled_task.rb in the cache.172.31.62.107 [2018-05-03T15:35:20+00:00] INFO: Storing updated cookbooks/chef-client/resources/scheduled_task.rb in the cache.172.31.62.107 [2018-05-03T15:35:20+00:00] INFO: Storing updated cookbooks/chef-client/recipes/systemd_service.rb in the cache.172.31.62.107 [2018-05-03T15:35:20+00:00] INFO: Storing updated cookbooks/chef-client/recipes/init_service.rb in the cache.172.31.62.107 [2018-05-03T15:35:20+00:00] INFO: Storing updated cookbooks/chef-client/recipes/service.rb in the cache.172.31.62.107 [2018-05-03T15:35:20+00:00] INFO: Storing updated cookbooks/chef-client/recipes/task.rb in the cache.172.31.62.107 [2018-05-03T15:35:20+00:00] INFO: Storing updated cookbooks/chef-client/recipes/systemd_service.rb in the cache.172.31.62.107 [2018-05-03T15:35:20+00:00] INFO: Storing updated cookbooks/chef-client/recipes/init_service.rb in the cache.172.31.62.107 [2018-05-03T15:35:20+00:00] INFO: Storing updated cookbooks/chef-client/recipes/service.rb in the cache.172.31.62.107 [2018-05-03T15:35:20+00:00] INFO: Storing updated cookbooks/chef-client/recipes/task.rb in the cache.172.31.62.107 [2018-05-03T15:35:20+00:00] INFO: Storing updated cookbooks/chef-client/recipes/upstart_service.rb in the cache.172.31.62.107 [2018-05-03T15:35:20+00:00] INFO: Storing updated cookbooks/chef-client/recipes/cron.rb in the cache.172.31.62.107 [2018-05-03T15:35:20+00:00] INFO: Storing updated cookbooks/chef-client/recipes/src_service.rb in the cache.172.31.62.107 [2018-05-03T15:35:20+00:00] INFO: Storing updated cookbooks/chef-client/recipes/launchd_service.rb in the cache.172.31.62.107 [2018-05-03T15:35:20+00:00] INFO: Storing updated cookbooks/chef-client/recipes/bsd_service.rb in the cache.172.31.62.107 [2018-05-03T15:35:20+00:00] INFO: Storing updated cookbooks/chef-client/recipes/default.rb in the cache.172.31.62.107 [2018-05-03T15:35:20+00:00] INFO: Storing updated cookbooks/chef-client/recipes/upstart_service.rb in the cache.172.31.62.107 [2018-05-03T15:35:20+00:00] INFO: Storing updated cookbooks/chef-client/recipes/cron.rb in the cache.172.31.62.107 [2018-05-03T15:35:20+00:00] INFO: Storing updated cookbooks/chef-client/recipes/src_service.rb in the cache.172.31.62.107 [2018-05-03T15:35:20+00:00] INFO: Storing updated cookbooks/chef-client/recipes/launchd_service.rb in the cache.172.31.62.107 [2018-05-03T15:35:20+00:00] INFO: Storing updated cookbooks/chef-client/recipes/bsd_service.rb in the cache.172.31.62.107 [2018-05-03T15:35:20+00:00] INFO: Storing updated cookbooks/chef-client/recipes/default.rb in the cache.172.31.62.107 [2018-05-03T15:35:20+00:00] INFO: Storing updated cookbooks/chef-client/recipes/runit_service.rb in the cache.172.31.62.107 [2018-05-03T15:35:20+00:00] INFO: Storing updated cookbooks/chef-client/recipes/config.rb in the cache.172.31.62.107 [2018-05-03T15:35:20+00:00] INFO: Storing updated cookbooks/chef-client/recipes/smf_service.rb in the cache.172.31.62.107 [2018-05-03T15:35:20+00:00] INFO: Storing updated cookbooks/chef-client/recipes/runit_service.rb in the cache.172.31.62.107 [2018-05-03T15:35:20+00:00] INFO: Storing updated cookbooks/chef-client/recipes/config.rb in the cache.172.31.62.107 [2018-05-03T15:35:20+00:00] INFO: Storing updated cookbooks/chef-client/recipes/smf_service.rb in the cache.172.31.62.107 [2018-05-03T15:35:21+00:00] INFO: Storing updated cookbooks/chef-client/templates/default/redhat/init.d/chef-client.erb in the cache.172.31.62.107 [2018-05-03T15:35:21+00:00] INFO: Storing updated cookbooks/chef-client/templates/default/client.rb.erb in the cache.172.31.62.107 [2018-05-03T15:35:21+00:00] INFO: Storing updated cookbooks/chef-client/libraries/helpers.rb in the cache.172.31.62.107 [2018-05-03T15:35:21+00:00] INFO: Storing updated cookbooks/chef-client/recipes/delete_validation.rb in the cache.172.31.62.107 [2018-05-03T15:35:21+00:00] INFO: Storing updated cookbooks/chef-client/templates/default/clearlinux/chef/chef-client.erb in the cache.172.31.62.107 [2018-05-03T15:35:21+00:00] INFO: Storing updated cookbooks/chef-client/templates/default/redhat/sysconfig/chef-client.erb in the cache.172.31.62.107 [2018-05-03T15:35:21+00:00] INFO: Storing updated cookbooks/chef-client/attributes/default.rb in the cache.172.31.62.107 [2018-05-03T15:35:21+00:00] INFO: Storing updated cookbooks/chef-client/templates/default/redhat/init.d/chef-client.erb in the cache.172.31.62.107 [2018-05-03T15:35:21+00:00] INFO: Storing updated cookbooks/chef-client/templates/default/client.rb.erb in the cache.172.31.62.107 [2018-05-03T15:35:21+00:00] INFO: Storing updated cookbooks/chef-client/libraries/helpers.rb in the cache.172.31.62.107 [2018-05-03T15:35:21+00:00] INFO: Storing updated cookbooks/chef-client/recipes/delete_validation.rb in the cache.172.31.62.107 [2018-05-03T15:35:21+00:00] INFO: Storing updated cookbooks/chef-client/templates/default/clearlinux/chef/chef-client.erb in the cache.172.31.62.107 [2018-05-03T15:35:21+00:00] INFO: Storing updated cookbooks/chef-client/templates/default/redhat/sysconfig/chef-client.erb in the cache.172.31.62.107 [2018-05-03T15:35:21+00:00] INFO: Storing updated cookbooks/chef-client/attributes/default.rb in the cache.172.31.62.107 [2018-05-03T15:35:21+00:00] INFO: Storing updated cookbooks/chef-client/templates/default/solaris/manifest.xml.erb in the cache.172.31.62.107 [2018-05-03T15:35:21+00:00] INFO: Storing updated cookbooks/chef-client/templates/default/solaris/manifest-5.11.xml.erb in the cache.172.31.62.107 [2018-05-03T15:35:21+00:00] INFO: Storing updated cookbooks/chef-client/templates/default/solaris/manifest.xml.erb in the cache.172.31.62.107 [2018-05-03T15:35:21+00:00] INFO: Storing updated cookbooks/chef-client/recipes/windows_service.rb in the cache.172.31.62.107 [2018-05-03T15:35:21+00:00] INFO: Storing updated cookbooks/chef-client/templates/default/solaris/manifest-5.11.xml.erb in the cache.172.31.62.107 [2018-05-03T15:35:21+00:00] INFO: Storing updated cookbooks/chef-client/recipes/windows_service.rb in the cache.172.31.62.107 [2018-05-03T15:35:21+00:00] INFO: Storing updated cookbooks/chef-client/templates/default/debian/init.d/chef-client.erb in the cache.172.31.62.107 [2018-05-03T15:35:21+00:00] INFO: Storing updated cookbooks/chef-client/templates/default/fedora/sysconfig/chef-client.erb in the cache.172.31.62.107 [2018-05-03T15:35:21+00:00] INFO: Storing updated cookbooks/chef-client/templates/default/solaris/chef-client.erb in the cache.172.31.62.107 [2018-05-03T15:35:21+00:00] INFO: Storing updated cookbooks/chef-client/templates/default/debian/default/chef-client.erb in the cache.172.31.62.107 [2018-05-03T15:35:21+00:00] INFO: Storing updated cookbooks/chef-client/templates/default/com.chef.chef-client.plist.erb in the cache.172.31.62.107 [2018-05-03T15:35:21+00:00] INFO: Storing updated cookbooks/chef-client/templates/default/debian/init.d/chef-client.erb in the cache.172.31.62.107 [2018-05-03T15:35:21+00:00] INFO: Storing updated cookbooks/chef-client/templates/default/fedora/sysconfig/chef-client.erb in the cache.172.31.62.107 [2018-05-03T15:35:21+00:00] INFO: Storing updated cookbooks/chef-client/templates/default/solaris/chef-client.erb in the cache.172.31.62.107 [2018-05-03T15:35:21+00:00] INFO: Storing updated cookbooks/chef-client/templates/default/debian/default/chef-client.erb in the cache.172.31.62.107 [2018-05-03T15:35:21+00:00] INFO: Storing updated cookbooks/chef-client/templates/default/com.chef.chef-client.plist.erb in the cache.172.31.62.107 [2018-05-03T15:35:21+00:00] INFO: Storing updated cookbooks/chef-client/templates/freebsd/chef.erb in the cache.172.31.62.107 [2018-05-03T15:35:21+00:00] INFO: Storing updated cookbooks/chef-client/templates/windows/client.service.rb.erb in the cache.172.31.62.107 [2018-05-03T15:35:21+00:00] INFO: Storing updated cookbooks/chef-client/templates/default/suse/sysconfig/chef-client.erb in the cache.172.31.62.107 [2018-05-03T15:35:21+00:00] INFO: Storing updated cookbooks/chef-client/templates/default/debian/init/chef-client.conf.erb in the cache.172.31.62.107 [2018-05-03T15:35:21+00:00] INFO: Storing updated cookbooks/chef-client/templates/default/suse/init.d/chef-client.erb in the cache.172.31.62.107 [2018-05-03T15:35:21+00:00] INFO: Storing updated cookbooks/chef-client/templates/freebsd/chef.erb in the cache.172.31.62.107 [2018-05-03T15:35:21+00:00] INFO: Storing updated cookbooks/chef-client/templates/windows/client.service.rb.erb in the cache.172.31.62.107 [2018-05-03T15:35:21+00:00] INFO: Storing updated cookbooks/chef-client/templates/default/suse/sysconfig/chef-client.erb in the cache.172.31.62.107 [2018-05-03T15:35:21+00:00] INFO: Storing updated cookbooks/chef-client/templates/default/debian/init/chef-client.conf.erb in the cache.172.31.62.107 [2018-05-03T15:35:21+00:00] INFO: Storing updated cookbooks/chef-client/templates/default/suse/init.d/chef-client.erb in the cache.172.31.62.107 [2018-05-03T15:35:21+00:00] INFO: Storing updated cookbooks/chef-client/templates/freebsd/chef-client.erb in the cache.172.31.62.107 [2018-05-03T15:35:21+00:00] INFO: Storing updated cookbooks/chef-client/templates/freebsd/chef-client.erb in the cache.172.31.62.107 [2018-05-03T15:35:21+00:00] INFO: Storing updated cookbooks/chef-client/CONTRIBUTING.md in the cache.172.31.62.107 [2018-05-03T15:35:21+00:00] INFO: Storing updated cookbooks/chef-client/metadata.json in the cache.172.31.62.107 [2018-05-03T15:35:21+00:00] INFO: Storing updated cookbooks/chef-client/README.md in the cache.172.31.62.107 [2018-05-03T15:35:21+00:00] INFO: Storing updated cookbooks/chef-client/CONTRIBUTING.md in the cache.172.31.62.107 [2018-05-03T15:35:21+00:00] INFO: Storing updated cookbooks/chef-client/CHANGELOG.md in the cache.172.31.62.107 [2018-05-03T15:35:21+00:00] INFO: Storing updated cookbooks/chef-client/metadata.json in the cache.172.31.62.107 [2018-05-03T15:35:21+00:00] INFO: Storing updated cookbooks/chef-client/README.md in the cache.172.31.62.107 [2018-05-03T15:35:21+00:00] INFO: Storing updated cookbooks/chef-client/CHANGELOG.md in the cache.172.31.62.107 - chef-client (10.0.4)172.31.62.107 172.31.62.107 [2018-05-03T15:35:21+00:00] INFO: Storing updated cookbooks/cron/templates/cron_manage.erb in the cache.172.31.62.107 [2018-05-03T15:35:21+00:00] INFO: Storing updated cookbooks/cron/recipes/default.rb in the cache.172.31.62.107 [2018-05-03T15:35:21+00:00] INFO: Storing updated cookbooks/cron/definitions/manage.rb in the cache.172.31.62.107 [2018-05-03T15:35:21+00:00] INFO: Storing updated cookbooks/cron/resources/d.rb in the cache.172.31.62.107 [2018-05-03T15:35:21+00:00] INFO: Storing updated cookbooks/cron/attributes/default.rb in the cache.172.31.62.107 [2018-05-03T15:35:21+00:00] INFO: Storing updated cookbooks/cron/libraries/helpers.rb in the cache.172.31.62.107 [2018-05-03T15:35:21+00:00] INFO: Storing updated cookbooks/cron/templates/cron_manage.erb in the cache.172.31.62.107 [2018-05-03T15:35:21+00:00] INFO: Storing updated cookbooks/cron/recipes/default.rb in the cache.172.31.62.107 [2018-05-03T15:35:21+00:00] INFO: Storing updated cookbooks/cron/definitions/manage.rb in the cache.172.31.62.107 [2018-05-03T15:35:21+00:00] INFO: Storing updated cookbooks/cron/resources/d.rb in the cache.172.31.62.107 [2018-05-03T15:35:21+00:00] INFO: Storing updated cookbooks/cron/attributes/default.rb in the cache.172.31.62.107 [2018-05-03T15:35:21+00:00] INFO: Storing updated cookbooks/cron/libraries/helpers.rb in the cache.172.31.62.107 [2018-05-03T15:35:21+00:00] INFO: Storing updated cookbooks/cron/templates/cron.d.erb in the cache.172.31.62.107 [2018-05-03T15:35:21+00:00] INFO: Storing updated cookbooks/cron/CHANGELOG.md in the cache.172.31.62.107 [2018-05-03T15:35:21+00:00] INFO: Storing updated cookbooks/cron/CHANGELOG.md in the cache.172.31.62.107 [2018-05-03T15:35:21+00:00] INFO: Storing updated cookbooks/cron/templates/cron.d.erb in the cache.172.31.62.107 [2018-05-03T15:35:21+00:00] INFO: Storing updated cookbooks/cron/metadata.json in the cache.172.31.62.107 [2018-05-03T15:35:21+00:00] INFO: Storing updated cookbooks/cron/templates/crontab.erb in the cache.172.31.62.107 [2018-05-03T15:35:21+00:00] INFO: Storing updated cookbooks/cron/metadata.json in the cache.172.31.62.107 [2018-05-03T15:35:21+00:00] INFO: Storing updated cookbooks/cron/templates/crontab.erb in the cache.172.31.62.107 [2018-05-03T15:35:21+00:00] INFO: Storing updated cookbooks/logrotate/recipes/global.rb in the cache.172.31.62.107 [2018-05-03T15:35:21+00:00] INFO: Storing updated cookbooks/cron/CONTRIBUTING.md in the cache.172.31.62.107 [2018-05-03T15:35:21+00:00] INFO: Storing updated cookbooks/cron/README.md in the cache.172.31.62.107 [2018-05-03T15:35:21+00:00] INFO: Storing updated cookbooks/cron/.foodcritic in the cache.172.31.62.107 [2018-05-03T15:35:21+00:00] INFO: Storing updated cookbooks/logrotate/resources/app.rb in the cache.172.31.62.107 [2018-05-03T15:35:21+00:00] INFO: Storing updated cookbooks/logrotate/recipes/default.rb in the cache.172.31.62.107 [2018-05-03T15:35:21+00:00] INFO: Storing updated cookbooks/logrotate/attributes/default.rb in the cache.172.31.62.107 [2018-05-03T15:35:21+00:00] INFO: Storing updated cookbooks/logrotate/recipes/global.rb in the cache.172.31.62.107 [2018-05-03T15:35:21+00:00] INFO: Storing updated cookbooks/cron/CONTRIBUTING.md in the cache.172.31.62.107 [2018-05-03T15:35:21+00:00] INFO: Storing updated cookbooks/cron/README.md in the cache.172.31.62.107 [2018-05-03T15:35:21+00:00] INFO: Storing updated cookbooks/cron/.foodcritic in the cache.172.31.62.107 [2018-05-03T15:35:21+00:00] INFO: Storing updated cookbooks/logrotate/resources/app.rb in the cache.172.31.62.107 [2018-05-03T15:35:21+00:00] INFO: Storing updated cookbooks/logrotate/recipes/default.rb in the cache.172.31.62.107 [2018-05-03T15:35:21+00:00] INFO: Storing updated cookbooks/logrotate/attributes/default.rb in the cache.172.31.62.107 - cron (5.1.0)172.31.62.107 [2018-05-03T15:35:21+00:00] INFO: Storing updated cookbooks/logrotate/libraries/logrotate_config.rb in the cache.172.31.62.107 [2018-05-03T15:35:21+00:00] INFO: Storing updated cookbooks/logrotate/libraries/matchers.rb in the cache.172.31.62.107 [2018-05-03T15:35:21+00:00] INFO: Storing updated cookbooks/logrotate/templates/default/logrotate.erb in the cache.172.31.62.107 [2018-05-03T15:35:21+00:00] INFO: Storing updated cookbooks/logrotate/libraries/logrotate_config.rb in the cache.172.31.62.107 [2018-05-03T15:35:21+00:00] INFO: Storing updated cookbooks/logrotate/libraries/matchers.rb in the cache.172.31.62.107 [2018-05-03T15:35:21+00:00] INFO: Storing updated cookbooks/logrotate/templates/default/logrotate.erb in the cache.172.31.62.107 [2018-05-03T15:35:21+00:00] INFO: Storing updated cookbooks/logrotate/Makefile in the cache.172.31.62.107 [2018-05-03T15:35:21+00:00] INFO: Storing updated cookbooks/logrotate/metadata.json in the cache.172.31.62.107 [2018-05-03T15:35:21+00:00] INFO: Storing updated cookbooks/logrotate/README.md in the cache.172.31.62.107 [2018-05-03T15:35:21+00:00] INFO: Storing updated cookbooks/logrotate/templates/default/logrotate-global.erb in the cache.172.31.62.107 [2018-05-03T15:35:21+00:00] INFO: Storing updated cookbooks/logrotate/LICENSE in the cache.172.31.62.107 [2018-05-03T15:35:21+00:00] INFO: Storing updated cookbooks/logrotate/Makefile in the cache.172.31.62.107 [2018-05-03T15:35:21+00:00] INFO: Storing updated cookbooks/logrotate/metadata.json in the cache.172.31.62.107 [2018-05-03T15:35:21+00:00] INFO: Storing updated cookbooks/logrotate/README.md in the cache.172.31.62.107 [2018-05-03T15:35:21+00:00] INFO: Storing updated cookbooks/logrotate/templates/default/logrotate-global.erb in the cache.172.31.62.107 [2018-05-03T15:35:21+00:00] INFO: Storing updated cookbooks/logrotate/LICENSE in the cache.172.31.62.107 [2018-05-03T15:35:21+00:00] INFO: Storing updated cookbooks/windows/resources/printer.rb in the cache.172.31.62.107 [2018-05-03T15:35:21+00:00] INFO: Storing updated cookbooks/logrotate/chefignore in the cache.172.31.62.107 [2018-05-03T15:35:21+00:00] INFO: Storing updated cookbooks/windows/resources/shortcut.rb in the cache.172.31.62.107 [2018-05-03T15:35:21+00:00] INFO: Storing updated cookbooks/windows/resources/share.rb in the cache.172.31.62.107 [2018-05-03T15:35:21+00:00] INFO: Storing updated cookbooks/windows/resources/task.rb in the cache.172.31.62.107 [2018-05-03T15:35:21+00:00] INFO: Storing updated cookbooks/windows/resources/printer.rb in the cache.172.31.62.107 [2018-05-03T15:35:21+00:00] INFO: Storing updated cookbooks/windows/resources/shortcut.rb in the cache.172.31.62.107 [2018-05-03T15:35:21+00:00] INFO: Storing updated cookbooks/windows/resources/share.rb in the cache.172.31.62.107 [2018-05-03T15:35:21+00:00] INFO: Storing updated cookbooks/windows/resources/task.rb in the cache.172.31.62.107 [2018-05-03T15:35:21+00:00] INFO: Storing updated cookbooks/logrotate/chefignore in the cache.172.31.62.107 - logrotate (2.2.0)172.31.62.107 [2018-05-03T15:35:21+00:00] INFO: Storing updated cookbooks/windows/resources/dns.rb in the cache.172.31.62.107 [2018-05-03T15:35:21+00:00] INFO: Storing updated cookbooks/windows/resources/pagefile.rb in the cache.172.31.62.107 [2018-05-03T15:35:21+00:00] INFO: Storing updated cookbooks/windows/resources/http_acl.rb in the cache.172.31.62.107 172.31.62.107 [2018-05-03T15:35:21+00:00] INFO: Storing updated cookbooks/windows/resources/dns.rb in the cache.172.31.62.107 [2018-05-03T15:35:21+00:00] INFO: Storing updated cookbooks/windows/resources/pagefile.rb in the cache.172.31.62.107 [2018-05-03T15:35:21+00:00] INFO: Storing updated cookbooks/windows/resources/http_acl.rb in the cache.172.31.62.107 [2018-05-03T15:35:21+00:00] INFO: Storing updated cookbooks/windows/resources/font.rb in the cache.172.31.62.107 [2018-05-03T15:35:21+00:00] INFO: Storing updated cookbooks/windows/resources/feature_powershell.rb in the cache.172.31.62.107 [2018-05-03T15:35:21+00:00] INFO: Storing updated cookbooks/windows/resources/font.rb in the cache.172.31.62.107 [2018-05-03T15:35:21+00:00] INFO: Storing updated cookbooks/windows/resources/feature_powershell.rb in the cache.172.31.62.107 [2018-05-03T15:35:21+00:00] INFO: Storing updated cookbooks/windows/resources/auto_run.rb in the cache.172.31.62.107 [2018-05-03T15:35:21+00:00] INFO: Storing updated cookbooks/windows/resources/zipfile.rb in the cache.172.31.62.107 [2018-05-03T15:35:21+00:00] INFO: Storing updated cookbooks/windows/resources/certificate.rb in the cache.172.31.62.107 [2018-05-03T15:35:21+00:00] INFO: Storing updated cookbooks/windows/resources/certificate_binding.rb in the cache.172.31.62.107 [2018-05-03T15:35:21+00:00] INFO: Storing updated cookbooks/windows/resources/auto_run.rb in the cache.172.31.62.107 [2018-05-03T15:35:21+00:00] INFO: Storing updated cookbooks/windows/resources/zipfile.rb in the cache.172.31.62.107 [2018-05-03T15:35:21+00:00] INFO: Storing updated cookbooks/windows/resources/certificate.rb in the cache.172.31.62.107 [2018-05-03T15:35:21+00:00] INFO: Storing updated cookbooks/windows/resources/certificate_binding.rb in the cache.172.31.62.107 [2018-05-03T15:35:21+00:00] INFO: Storing updated cookbooks/windows/resources/path.rb in the cache.172.31.62.107 [2018-05-03T15:35:21+00:00] INFO: Storing updated cookbooks/windows/resources/printer_port.rb in the cache.172.31.62.107 [2018-05-03T15:35:21+00:00] INFO: Storing updated cookbooks/windows/resources/feature.rb in the cache.172.31.62.107 [2018-05-03T15:35:21+00:00] INFO: Storing updated cookbooks/windows/resources/feature_dism.rb in the cache.172.31.62.107 [2018-05-03T15:35:21+00:00] INFO: Storing updated cookbooks/windows/resources/path.rb in the cache.172.31.62.107 [2018-05-03T15:35:21+00:00] INFO: Storing updated cookbooks/windows/resources/printer_port.rb in the cache.172.31.62.107 [2018-05-03T15:35:21+00:00] INFO: Storing updated cookbooks/windows/resources/feature.rb in the cache.172.31.62.107 [2018-05-03T15:35:21+00:00] INFO: Storing updated cookbooks/windows/resources/feature_dism.rb in the cache.172.31.62.107 [2018-05-03T15:35:21+00:00] INFO: Storing updated cookbooks/windows/providers/dns.rb in the cache.172.31.62.107 [2018-05-03T15:35:21+00:00] INFO: Storing updated cookbooks/windows/providers/dns.rb in the cache.172.31.62.107 [2018-05-03T15:35:21+00:00] INFO: Storing updated cookbooks/windows/recipes/default.rb in the cache.172.31.62.107 [2018-05-03T15:35:21+00:00] INFO: Storing updated cookbooks/windows/libraries/powershell_helper.rb in the cache.172.31.62.107 [2018-05-03T15:35:21+00:00] INFO: Storing updated cookbooks/windows/libraries/version_helper.rb in the cache.172.31.62.107 [2018-05-03T15:35:21+00:00] INFO: Storing updated cookbooks/windows/libraries/wmi_helper.rb in the cache.172.31.62.107 [2018-05-03T15:35:21+00:00] INFO: Storing updated cookbooks/windows/libraries/windows_privileged.rb in the cache.172.31.62.107 [2018-05-03T15:35:21+00:00] INFO: Storing updated cookbooks/windows/recipes/default.rb in the cache.172.31.62.107 [2018-05-03T15:35:21+00:00] INFO: Storing updated cookbooks/windows/libraries/powershell_helper.rb in the cache.172.31.62.107 [2018-05-03T15:35:21+00:00] INFO: Storing updated cookbooks/windows/libraries/version_helper.rb in the cache.172.31.62.107 [2018-05-03T15:35:21+00:00] INFO: Storing updated cookbooks/windows/libraries/wmi_helper.rb in the cache.172.31.62.107 [2018-05-03T15:35:21+00:00] INFO: Storing updated cookbooks/windows/libraries/windows_privileged.rb in the cache.172.31.62.107 [2018-05-03T15:35:21+00:00] INFO: Storing updated cookbooks/windows/libraries/version.rb in the cache.172.31.62.107 [2018-05-03T15:35:21+00:00] INFO: Storing updated cookbooks/windows/libraries/version.rb in the cache.172.31.62.107 [2018-05-03T15:35:21+00:00] INFO: Storing updated cookbooks/windows/libraries/windows_helper.rb in the cache.172.31.62.107 [2018-05-03T15:35:21+00:00] INFO: Storing updated cookbooks/windows/libraries/registry_helper.rb in the cache.172.31.62.107 [2018-05-03T15:35:21+00:00] INFO: Storing updated cookbooks/windows/metadata.json in the cache.172.31.62.107 [2018-05-03T15:35:21+00:00] INFO: Storing updated cookbooks/windows/CHANGELOG.md in the cache.172.31.62.107 [2018-05-03T15:35:21+00:00] INFO: Storing updated cookbooks/windows/libraries/windows_helper.rb in the cache.172.31.62.107 - learn_chef_iis (0.3.1)[2018-05-03T15:35:21+00:00] INFO: Storing updated cookbooks/windows/libraries/registry_helper.rb in the cache.172.31.62.107 [2018-05-03T15:35:21+00:00] INFO: Storing updated cookbooks/windows/metadata.json in the cache.172.31.62.107 [2018-05-03T15:35:21+00:00] INFO: Storing updated cookbooks/windows/CHANGELOG.md in the cache.172.31.62.107 172.31.62.107 [2018-05-03T15:35:21+00:00] INFO: Storing updated cookbooks/windows/CONTRIBUTING.md in the cache.172.31.62.107 [2018-05-03T15:35:21+00:00] INFO: Storing updated cookbooks/windows/CONTRIBUTING.md in the cache.172.31.62.107 [2018-05-03T15:35:21+00:00] INFO: Storing updated cookbooks/windows/README.md in the cache.172.31.62.107 [2018-05-03T15:35:21+00:00] INFO: Storing updated cookbooks/windows/README.md in the cache.172.31.62.107 - windows (4.2.2)172.31.62.107 Installing Cookbook Gems:172.31.62.107 Compiling Cookbooks...172.31.62.107 172.31.62.107 [2018-05-03T15:35:21+00:00] INFO: Using chef-client binary at C:/opscode/chef/bin/chef-client172.31.62.107 [2018-05-03T15:35:21+00:00] INFO: Using chef-client binary at C:/opscode/chef/bin/chef-client172.31.62.107 Converging 7 resources172.31.62.107 172.31.62.107 Recipe: chef-client::task172.31.62.107 * windows_service[chef-client] action configure_startup[2018-05-03T15:35:21+00:00] INFO: Processing windows_service[chef-client] action configure_startup (chef-client::task line 31)172.31.62.107 [2018-05-03T15:35:21+00:00] INFO: Processing windows_service[chef-client] action configure_startup (chef-client::task line 31)172.31.62.107 (skipped due to only_if)172.31.62.107 * chef_client_scheduled_task[Chef Client] action add[2018-05-03T15:35:21+00:00] INFO: Processing chef_client_scheduled_task[Chef Client] action add (chef-client::task line 37)172.31.62.107 [2018-05-03T15:35:21+00:00] INFO: Processing chef_client_scheduled_task[Chef Client] action add (chef-client::task line 37)172.31.62.107 172.31.62.107 * directory[C:/chef/run] action create[2018-05-03T15:35:21+00:00] INFO: Processing directory[C:/chef/run] action create (C:/opscode/chef/embedded/lib/ruby/gems/2.4.0/gems/chef-13.8.5-universal-mingw32/lib/chef/dsl/declare_resource.rb line 218)172.31.62.107 [2018-05-03T15:35:21+00:00] INFO: Processing directory[C:/chef/run] action create (C:/opscode/chef/embedded/lib/ruby/gems/2.4.0/gems/chef-13.8.5-universal-mingw32/lib/chef/dsl/declare_resource.rb line 218)172.31.62.107 [2018-05-03T15:35:21+00:00] INFO: directory[C:/chef/run] created directory C:/chef/run172.31.62.107 [2018-05-03T15:35:21+00:00] INFO: directory[C:/chef/run] created directory C:/chef/run172.31.62.107 172.31.62.107 - create new directory C:/chef/run[2018-05-03T15:35:21+00:00] INFO: directory[C:/chef/run] owner changed to S-1-5-21-3773432575-1437942927-567417121-500172.31.62.107 [2018-05-03T15:35:21+00:00] INFO: directory[C:/chef/run] owner changed to S-1-5-21-3773432575-1437942927-567417121-500172.31.62.107 [2018-05-03T15:35:21+00:00] INFO: directory[C:/chef/run] group changed to S-1-5-32-544172.31.62.107 [2018-05-03T15:35:21+00:00] INFO: directory[C:/chef/run] group changed to S-1-5-32-544172.31.62.107 172.31.62.107 - change owner172.31.62.107 - change group172.31.62.107 * directory[C:/chef/cache] action create[2018-05-03T15:35:21+00:00] INFO: Processing directory[C:/chef/cache] action create (C:/opscode/chef/embedded/lib/ruby/gems/2.4.0/gems/chef-13.8.5-universal-mingw32/lib/chef/dsl/declare_resource.rb line 218)172.31.62.107 [2018-05-03T15:35:21+00:00] INFO: Processing directory[C:/chef/cache] action create (C:/opscode/chef/embedded/lib/ruby/gems/2.4.0/gems/chef-13.8.5-universal-mingw32/lib/chef/dsl/declare_resource.rb line 218)172.31.62.107 [2018-05-03T15:35:21+00:00] INFO: directory[C:/chef/cache] owner changed to S-1-5-21-3773432575-1437942927-567417121-500172.31.62.107 [2018-05-03T15:35:21+00:00] INFO: directory[C:/chef/cache] owner changed to S-1-5-21-3773432575-1437942927-567417121-500172.31.62.107 [2018-05-03T15:35:21+00:00] INFO: directory[C:/chef/cache] group changed to S-1-5-32-544172.31.62.107 [2018-05-03T15:35:21+00:00] INFO: directory[C:/chef/cache] group changed to S-1-5-32-544172.31.62.107 172.31.62.107 - change owner172.31.62.107 - change group172.31.62.107 * directory[C:/chef/backup] action create[2018-05-03T15:35:21+00:00] INFO: Processing directory[C:/chef/backup] action create (C:/opscode/chef/embedded/lib/ruby/gems/2.4.0/gems/chef-13.8.5-universal-mingw32/lib/chef/dsl/declare_resource.rb line 218)172.31.62.107 [2018-05-03T15:35:21+00:00] INFO: Processing directory[C:/chef/backup] action create (C:/opscode/chef/embedded/lib/ruby/gems/2.4.0/gems/chef-13.8.5-universal-mingw32/lib/chef/dsl/declare_resource.rb line 218)172.31.62.107 [2018-05-03T15:35:21+00:00] INFO: directory[C:/chef/backup] owner changed to S-1-5-21-3773432575-1437942927-567417121-500172.31.62.107 [2018-05-03T15:35:21+00:00] INFO: directory[C:/chef/backup] owner changed to S-1-5-21-3773432575-1437942927-567417121-500172.31.62.107 [2018-05-03T15:35:21+00:00] INFO: directory[C:/chef/backup] group changed to S-1-5-32-544172.31.62.107 [2018-05-03T15:35:21+00:00] INFO: directory[C:/chef/backup] group changed to S-1-5-32-544172.31.62.107 172.31.62.107 - change owner172.31.62.107 - change group172.31.62.107 * directory[C:/chef/log] action create[2018-05-03T15:35:21+00:00] INFO: Processing directory[C:/chef/log] action create (C:/opscode/chef/embedded/lib/ruby/gems/2.4.0/gems/chef-13.8.5-universal-mingw32/lib/chef/dsl/declare_resource.rb line 218)172.31.62.107 [2018-05-03T15:35:21+00:00] INFO: Processing directory[C:/chef/log] action create (C:/opscode/chef/embedded/lib/ruby/gems/2.4.0/gems/chef-13.8.5-universal-mingw32/lib/chef/dsl/declare_resource.rb line 218)172.31.62.107 [2018-05-03T15:35:21+00:00] INFO: directory[C:/chef/log] created directory C:/chef/log172.31.62.107 [2018-05-03T15:35:21+00:00] INFO: directory[C:/chef/log] created directory C:/chef/log172.31.62.107 172.31.62.107 - create new directory C:/chef/log172.31.62.107 [2018-05-03T15:35:21+00:00] INFO: directory[C:/chef/log] owner changed to S-1-5-21-3773432575-1437942927-567417121-500172.31.62.107 [2018-05-03T15:35:21+00:00] INFO: directory[C:/chef/log] owner changed to S-1-5-21-3773432575-1437942927-567417121-500172.31.62.107 [2018-05-03T15:35:21+00:00] INFO: directory[C:/chef/log] group changed to S-1-5-32-544172.31.62.107 [2018-05-03T15:35:21+00:00] INFO: directory[C:/chef/log] group changed to S-1-5-32-544172.31.62.107 [2018-05-03T15:35:21+00:00] INFO: directory[C:/chef/log] permissions changed to [WIN-OPJ5HH81G1B\Administrator/flags:0/mask:e0010000, BUILTIN\Administrators/flags:0/mask:a0000000, Everyone/flags:0/mask:a0000000]172.31.62.107 [2018-05-03T15:35:21+00:00] INFO: directory[C:/chef/log] permissions changed to [WIN-OPJ5HH81G1B\Administrator/flags:0/mask:e0010000, BUILTIN\Administrators/flags:0/mask:a0000000, Everyone/flags:0/mask:a0000000]172.31.62.107 172.31.62.107 - change dacl172.31.62.107 - change owner172.31.62.107 - change group172.31.62.107 * directory[C:/chef] action create[2018-05-03T15:35:21+00:00] INFO: Processing directory[C:/chef] action create (C:/opscode/chef/embedded/lib/ruby/gems/2.4.0/gems/chef-13.8.5-universal-mingw32/lib/chef/dsl/declare_resource.rb line 218)172.31.62.107 [2018-05-03T15:35:21+00:00] INFO: Processing directory[C:/chef] action create (C:/opscode/chef/embedded/lib/ruby/gems/2.4.0/gems/chef-13.8.5-universal-mingw32/lib/chef/dsl/declare_resource.rb line 218)172.31.62.107 [2018-05-03T15:35:21+00:00] INFO: directory[C:/chef] owner changed to S-1-5-21-3773432575-1437942927-567417121-500172.31.62.107 [2018-05-03T15:35:21+00:00] INFO: directory[C:/chef] owner changed to S-1-5-21-3773432575-1437942927-567417121-500172.31.62.107 [2018-05-03T15:35:21+00:00] INFO: directory[C:/chef] group changed to S-1-5-32-544172.31.62.107 [2018-05-03T15:35:21+00:00] INFO: directory[C:/chef] group changed to S-1-5-32-544172.31.62.107 172.31.62.107 - change owner172.31.62.107 - change group172.31.62.107 * windows_task[chef-client] action create[2018-05-03T15:35:21+00:00] INFO: Processing windows_task[chef-client] action create (c:/chef/cache/cookbooks/chef-client/resources/scheduled_task.rb line 55)172.31.62.107 [2018-05-03T15:35:21+00:00] INFO: Processing windows_task[chef-client] action create (c:/chef/cache/cookbooks/chef-client/resources/scheduled_task.rb line 55)172.31.62.107 172.31.62.107 - windows_task[chef-client] task created172.31.62.107 172.31.62.107 Recipe: chef-client::delete_validation172.31.62.107 * file[C:\chef\validation.pem] action delete[2018-05-03T15:35:22+00:00] INFO: Processing file[C:\chef\validation.pem] action delete (chef-client::delete_validation line 35)172.31.62.107 [2018-05-03T15:35:22+00:00] INFO: Processing file[C:\chef\validation.pem] action delete (chef-client::delete_validation line 35)172.31.62.107 (up to date)172.31.62.107 Recipe: learn_chef_iis::default172.31.62.107 * powershell_script[Install IIS] action run[2018-05-03T15:35:22+00:00] INFO: Processing powershell_script[Install IIS] action run (learn_chef_iis::default line 6)172.31.62.107 [2018-05-03T15:35:22+00:00] INFO: Processing powershell_script[Install IIS] action run (learn_chef_iis::default line 6)172.31.62.107 [2018-05-03T15:35:22+00:00] INFO: Processing powershell_script[Guard resource] action run (dynamically defined)172.31.62.107 [2018-05-03T15:35:22+00:00] INFO: Processing powershell_script[Guard resource] action run (dynamically defined)172.31.62.107 [2018-05-03T15:35:23+00:00] INFO: powershell_script[Guard resource] ran successfully172.31.62.107 [2018-05-03T15:35:23+00:00] INFO: powershell_script[Guard resource] ran successfully172.31.62.107 (skipped due to not_if)172.31.62.107 * windows_service[w3svc] action enable[2018-05-03T15:35:23+00:00] INFO: Processing windows_service[w3svc] action enable (learn_chef_iis::default line 12)172.31.62.107 [2018-05-03T15:35:23+00:00] INFO: Processing windows_service[w3svc] action enable (learn_chef_iis::default line 12)172.31.62.107 (up to date)172.31.62.107 * windows_service[w3svc] action start[2018-05-03T15:35:23+00:00] INFO: Processing windows_service[w3svc] action start (learn_chef_iis::default line 12)172.31.62.107 [2018-05-03T15:35:23+00:00] INFO: Processing windows_service[w3svc] action start (learn_chef_iis::default line 12)172.31.62.107 (up to date)172.31.62.107 * directory[c:\inetpub\wwwroot] action create[2018-05-03T15:35:23+00:00] INFO: Processing directory[c:\inetpub\wwwroot] action create (learn_chef_iis::default line 16)172.31.62.107 [2018-05-03T15:35:23+00:00] INFO: Processing directory[c:\inetpub\wwwroot] action create (learn_chef_iis::default line 16)172.31.62.107 (up to date)172.31.62.107 * template[c:\inetpub\wwwroot\Default.htm] action create[2018-05-03T15:35:23+00:00] INFO: Processing template[c:\inetpub\wwwroot\Default.htm] action create (learn_chef_iis::default line 22)172.31.62.107 [2018-05-03T15:35:23+00:00] INFO: Processing template[c:\inetpub\wwwroot\Default.htm] action create (learn_chef_iis::default line 22)172.31.62.107 (up to date)172.31.62.107 [2018-05-03T15:35:23+00:00] INFO: Chef Run complete in 3.046781 seconds172.31.62.107 [2018-05-03T15:35:23+00:00] INFO: Chef Run complete in 3.046781 seconds172.31.62.107 172.31.62.107 Running handlers:172.31.62.107 [2018-05-03T15:35:23+00:00] INFO: Running report handlers172.31.62.107 [2018-05-03T15:35:23+00:00] INFO: Running report handlers172.31.62.107 Running handlers complete172.31.62.107 [2018-05-03T15:35:23+00:00] INFO: Report handlers complete172.31.62.107 [2018-05-03T15:35:23+00:00] INFO: Report handlers complete172.31.62.107 Chef Client finished, 7/14 resources updated in 07 seconds
|
You can see from the output that the chef-client cookbook set up chef-client as a service on your node.
You can run the knife status command to display a brief summary of the nodes on your Chef server, including the time of the most recent successful chef-client run.
Terminal: ~/learn-chef
$ | knife status 'role:web' --run-list1 minute ago, node1-windows, ["role[web]"], windows 6.3.9600.
|
Every 5–6 minutes you'll see that your node performed a recent check-in with the Chef server and ran chef-client.
4. Next steps
Now that chef-client is set up to run every 5—6 minutes, now's a great time to experiment with your node. Here are some ideas to start with.
- Repeat the steps where you make a change to the
learn_chef_iis cookbook, bump its version in the metadata, and upload your changes to Chef server. Even a small change to the home page template, Default.htm.erb, is enough to practice the process. Watch your change appear in your web browser the next time chef-client runs. - Manually log in to your node and stop IIS or delete the home page,
c:\inetpub\wwwroot\Default.htm. Refresh your browser window or run curl to see that your web server is down. What do you expect to happen the next time chef-client runs? - Write a cookbook that configures a piece of software that you use. See if there are any cookbooks on Chef Supermarket that you can use to get started.
If you're interested in managing your Chef server, check out the knife opc command. knife opc enables you to manage organizations and users in Chef server from your workstation.
How to clean up your environment
You can continue to experiment with your Chef server and your node. When you're done, you can perform these optional steps if you want to clean up your Chef server or you want to repeat the module from the beginning.
Delete the node from the Chef server
As you experiment, it's a good idea to delete information about your node from the Chef server when you no longer need it. That way, your Chef server contains only relevant information. In practice, it's up to you whether to delete node information when you retire a production system from service.
From your workstation, run these commands to delete the data about your node from the Chef server.
Terminal: ~/learn-chef
$ | knife node delete node1-windows --yesDeleted node[node1-windows]
|
Terminal: ~/learn-chef
$ | knife client delete node1-windows --yesDeleted client[node1-windows]
|
Chef makes a distinction between the nodes that are being managed and the clients that are authorized to make API calls to the Chef server. Therefore, you need to run knife node delete to remove the node's metadata from the Chef server and knife client delete to delete the entry (including the public part of the RSA key pair) from the Chef server's API client list.
Delete your cookbook from the Chef server
Here's how to delete the learn_chef_iis cookbook from the Chef server.
Terminal: ~/learn-chef
$ | knife cookbook delete learn_chef_iis --all --yesDeleted cookbook[learn_chef_iis][0.3.1]Deleted cookbook[learn_chef_iis][0.3.0]Deleted cookbook[learn_chef_iis][0.2.0]Deleted cookbook[learn_chef_iis][0.1.0]
|
If you omit the --all argument, you'll be prompted to select which version to delete. In practice, you might delete version '0.3.0' of the learn_chef_iis cookbook because you know it contains a configuration policy that will always fail.
Delete the role from the Chef server
Here's how to delete the web role from the Chef server.
Terminal: ~/learn-chef
$ | knife role delete web --yesDeleted role[web]
|
Delete the RSA private key from your node
During the bootstrap process, an RSA private key is generated on your node to enable your node to make API calls to the Chef server. The default location of this key is C:\chef\client.pem on Windows systems.
If you plan to bootstrap your node a second time, for example, to practice the process, you'll need to log in to your node and delete the RSA private key file, like this.
Windows PowerShell: ~
PS > | rm C:\chef\client.pem
|
Tear down your instance
Deleting a node from your Chef server removes any data about that node from the server – it doesn't automatically tear down the instance.
Don't forget to tear down any cloud instances or local virtual machines that you used to complete the module.
Conclusion
In this module, you brought up a Chef server, bootstrapped a node, and applied a basic web server configuration. You also practiced updating your cookbook, uploading it to the Chef server, and seeing the changes appear on your node. As a bonus, you resolved an error in your configuration and set up chef-client to run periodically.
To update your cookbook you used a template. A template enables you to write a single, general recipe that's customized for a particular node as the recipe runs. That means you don’t have to write a custom version of your recipe for every node.
You also ran knife winrm to update your node. knife winrm invokes the command you specify over a WinRM connection on a node – in our case chef-client. You didn't have to specify the run-list because you already set that up when you bootstrapped the node. Search enables you to run chef-client on multiple nodes at once. A role enables you define your node's behavior and attributes based on its function.
That's it for this module. When you're done experimenting, be sure to clean up your environment.
Be sure to check out Get started with Test Kitchen, where you'll learn how local development with Test Kitchen can help you iterate faster and correct mistakes earlier in the development process. With local development, you verify your cookbooks on local test instances that resemble production before you apply your work to a bootstrapped node.