Skip to content

melezhik/chef-plugin

Repository files navigation

SYNOPSIS

This is jenkins plugin to run chef-client on remote host. Plugin starts ssh session on remote host using public key authentication and run chef-client there.

Plugin general settings

  • host - Specifies remote host to run chef client on.
  • login - Specifies the user to log in as on the remote machine.

Plugin advanced settings

  • ssh_indetity_file - Specifies a path to file from which the identity (private key) for public key authentication is read.
  • chef_client_config - Specifies a path to file ( on remote host ) from which chef client configuration is read, default values is /etc/chef/client.rb
  • chef_json_template - Specifies chef attributes and run-list ( see chef documentation ).
  • dry_run - Use to run chef client in why-run mode, which is a type of chef-client run that does everything except modify the system, default value is false.

User interface

layout

Chef attributes and run list settings

  • Use chef_json_template to define chef attributes and run list. If you define one, plugin will parse chef_json_template data and stored result in file which in turn will passed as -j parameter into chef-client run.

  • Please check out chef wiki to learn more about chef json files.

  • Chef_json_template confirms ERB template syntax. Here is example of chef_json_template:

      <%
          runlist = %w{apache::server mysql}
          chef_json = {
              :run_list   => runlist.map { |r|  "recipe[#{r}]" } ,
              :apache     => {
                  :version => 80
              }
          }
      %>
      <%= chef_json.to_json.to_s %>
    

Prerequisites

  • ruby-runtime jenkins plugin
  • ssh client

Environment variables

You can set some environment variables qith "Jenkins/Configuration/Global properties/Environment variables" . Here the list of varibales to be processed in the plugin:

  • LC_ALL # sets encoding to avoid chef log issues

Latest stable version

0.1.7