[chef] How to use setuped credentials and parameters in ruby script to access with Chef::REST ?


Chronological Thread 
  • From: Vladimir Skubriev < >
  • To:
  • Subject: [chef] How to use setuped credentials and parameters in ruby script to access with Chef::REST ?
  • Date: Tue, 26 Aug 2014 14:44:44 +0400

Knife can operate with chef server normally, by using knife.rb and saved admin.pem in user home.

I have script on chef admin's machine and I want that this script can operate with chef server with same configs as knife operate with it. I.e. without additional configuration as follows:

# Define chef server parameters
    chef_server_url="https://chef.example.com"
    client_name = "adminws.example.local"
    signing_key_filename="/etc/chef/client.pem"
...

That's part of this script, where i need this variables:
...
# Operate with chef server:
    rest = Chef::REST.new(chef_server_url, client_name, signing_key_filename)
    #puts rest.get_rest("/data/#{bag}/#{item}")
    rest.get_rest("/data/#{bag}/#{item}")
...

How i can make my script "universe"?

--
Faithfully yours,

CVision Lab System Administrator
Vladimir Skubriev




Archive powered by MHonArc 2.6.16.

§