Skip to content

Instantly share code, notes, and snippets.

@dylanz
Created November 19, 2012 20:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dylanz/4113604 to your computer and use it in GitHub Desktop.
Save dylanz/4113604 to your computer and use it in GitHub Desktop.
Chef/Ruby
# This runs, but during the loading of the recipes, and not when the cookbook should be run:
#
%w{user1 user2 user3 user4 user5 user6}.each do |u|
puts "I see this output immediately on recipe load"
directory "/home/#{u.name}" do
etc...
end
bash "I think this might be running on recipe load, but not the directory directive above?" do
puts "Do stuff here"
end
etc...
end
#We tried putting it in a ruby_block, but then it complains about "directory" not being a valid directive:
#
ruby_block "adding the user stuff" do
%w{user1 user2 user3 user4 user5 user6}.each do |u|
directory "/home/#{u.name}" do
etc...
end
etc...
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment