Created
July 2, 2014 03:49
-
-
Save ctdk/a2d40f03ddfc616e0d42 to your computer and use it in GitHub Desktop.
Create a bunch of nodes & clients with chef-api and fauxhai
This file contains 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/env ruby | |
require 'chef-api' | |
require 'fauxhai' | |
include ChefAPI::Resource | |
ChefAPI.configure do |config| | |
config.endpoint = 'http://nineveh.local:4545' | |
config.client = 'admin' | |
config.key = '~/etc/goiardi/admin.pem' | |
end | |
(0..1000).each do |x| | |
auto = Fauxhai.mock(platform:'debian', version:'7.2') do |node| | |
node['hostname'] = "server#{x}.example.com" | |
end | |
n = Node.new | |
n.name = "server#{x}.example.com" | |
n.automatic = auto.data | |
n.save | |
Client.create(:name => n.name) | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment