Created
December 20, 2011 12:45
-
-
Save rcmorano/1501462 to your computer and use it in GitHub Desktop.
Create a databag through Chef's REST API
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/ruby | |
require 'chef/config' | |
require 'chef/log' | |
require 'chef/rest' | |
$chef_server_url = "https://localhost" | |
$client_name = "chef-admin" | |
$signing_key_filename="/root/.chef/chef-admin.pem" | |
rest = Chef::REST.new($chef_server_url, $client_name, $signing_key_filename) | |
unless rest.get_rest('/data/').include? 'users' | |
databag = { | |
"name" => "users" | |
} | |
rest.post_rest('/data/',databag) | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment