Information Technology Reference
In-Depth Information
- recipe [ motd - attributes : :default ]
attributes :
Create a recipe that uses the template resource to generate a /etc/motd file, but this time,
we'll use some attributes in the template file. The initial recipes/default.rb file you create
should resemble Example 8-2 .
Example 8-2. chefdk/motd-attributes/recipes/default.rb
#
# Cookbook Name:: motd-attributes
# Recipe:: default
#
# Copyright (C) 2014
#
#
#
template '/etc/motd' ddo
source 'motd.erb'
mode '0644'
end
end
Generate a template file to generate /etc/motd .
Chef Development Kit:
$ chef generate template motd
Chef Client - Linux/Mac OS X:
$ touch templates/default/motd.erb
Chef Client - Windows:
$ touch templates\default\motd.erb
Create a template /etc/motd that uses some node attributes generated by ohai , as shown in
Example 8-3 .
Example 8-3. chefdk/motd-attributes/templates/default/motd.erb
Search WWH ::




Custom Search