Skip to content

Instantly share code, notes, and snippets.

@lastobelus
Created April 29, 2010 02:59
Show Gist options
  • Save lastobelus/383061 to your computer and use it in GitHub Desktop.
Save lastobelus/383061 to your computer and use it in GitHub Desktop.
ruby "create the vagrant chef webui user" do
code <<-EOH
require 'rubygems'
require 'chef/webui_user'
Chef::Config[:node_name] = Chef::Config[:web_ui_client_name]
Chef::Config[:client_key] = Chef::Config[:web_ui_key]
exit(0) if Chef::WebUIUser.list.keys.include?("#{node[:vagrant][:webui_user][:username]}")
v = Chef::WebUIUser.new
v.name = "#{node[:vagrant][:webui_user][:username]}"
v.set_password "#{node[:vagrant][:webui_user][:password]}"
v.admin = true
v.create
exit 0
EOH
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment