Skip to content

Instantly share code, notes, and snippets.

@sawanoboly
Created September 17, 2015 07:39
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 sawanoboly/10c60e01382efba3505a to your computer and use it in GitHub Desktop.
Save sawanoboly/10c60e01382efba3505a to your computer and use it in GitHub Desktop.
Role(Ruby DSL) with knife-zero.
Dir.glob("roles/*.rb").each do |rf|
role = Chef::Role.new
role.name(File.basename(rf, ".rb"))
role.from_file(rf)
File.open(rf.gsub(".rb", ".json"),"w") {|f| f.puts(role.to_json)}
end
local_mode true
chef_repo_path File.expand_path("../", __FILE__)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment