Information Technology Reference
In-Depth Information
With your handy programmer's text editor, edit the file files/default/motd you just created in
your motd cookbook. We think all messages are more effective when spoken by a friendly
warning cow, so we added a bit of ASCII art to our file, as shown in Example 7-2 .
Example 7-2. chefdk/motd/files/default/motd
_________________________________________________
< YOU ARE ON A SIMULATED CHEF NODE ENVIRONMENT! >
-----------------------------------------------
\ ^__^
\ (oo)\_______
(__))\/\ \
||----w |
|| ||
Introducing the Cookbook_file Resource
We'll use Chef to help us more easily determine that we are running on a guest virtual ma-
chine node by writing some automation to change the Linux message of the day . On Linux,
the message of the day is displayed when a user logs in. The message of the day is used by
Linux administrators to communicate with users. You can change the message of the day by
editing the file /etc/motd . When a user successfully logs in, the contents of the /etc/motd file
will be displayed as the message of the day.
chef cookbook generate created a recipes/default.rb file for you. By convention, this is
the default location for your Chef code. All recipe .rb files containing Chef code are expec-
ted to be in the recipes/ subdirectory of a cookbook.
At the moment, recipes/default.rb doesn't have very much in it, just some comments:
#
# Cookbook Name:: motd
# Recipe:: default
#
# Copyright (C) 2014
#
#
#
Search WWH ::




Custom Search