Giter Site home page Giter Site logo

chef-plugin's Introduction

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

chef-plugin's People

Contributors

melezhik avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

chef-plugin's Issues

Facing error in configuring chef plugin in jenkins

Hi,

I am not able to configure the chef plugin for running chef-client at remote machine.
Please refer to the attachment for screenshots.
SSH host - giving IP of the remote machine.
SSH Login-: Username
s1
s2

Regards
Amandeep Singh

Configuration settings are not getting saved in jenkins for this plugin

Hi,
I have installed this plugin to jenkins and configure the ssh details as suggested.
But after clicking on save button in jenkins job, the configuration details wiped out and if i again click on configure job to change the chef-client details it is not showing me any previous entered details.
chef-client

attaching a screenshot.
Please suggest.

Regards
Amandeep Singh

Error in installing Chef-Jenkins plugin.

Hi

I am using Jenkins version 1.583. When I tried installing Chef-Jenkins plugin. It gave me following error:

<<<< ERROR Starts>>>>

Installing Plugins/Upgrades
Preparation

chef
Failure -

java.io.IOException: Failed to dynamically deploy this plugin
at hudson.model.UpdateCenter$InstallationJob._run(UpdateCenter.java:1317)
at hudson.model.UpdateCenter$DownloadJob.run(UpdateCenter.java:1116)
at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source)
at java.util.concurrent.FutureTask.run(Unknown Source)
at hudson.remoting.AtmostOneThreadExecutor$Worker.run(AtmostOneThreadExecutor.java:104)
at java.lang.Thread.run(Unknown Source)
Caused by: java.io.IOException: Failed to install chef plugin
at hudson.PluginManager.dynamicLoad(PluginManager.java:453)
at hudson.model.UpdateCenter$InstallationJob._run(UpdateCenter.java:1313)
... 6 more
Caused by: java.io.IOException: Dependency ruby-runtime (0.10) doesn't exist
at hudson.PluginWrapper.resolvePluginDependencies(PluginWrapper.java:488)
at hudson.PluginManager.dynamicLoad(PluginManager.java:443)
... 7 more

<<<>>>

Please have a look.

Regards
Manish Mehra

--force-formatter is passed to a version of chef-client that does not support it.

Hey
We are using chef 10.30 (in some nodes) which does not support the --force-formatter option
Is it possible to add a check box in the advanced section to disable it?

bash -c "export LC_ALL=en_US.UTF-8 && ssh -o 'StrictHostKeyChecking no' -i /var/lib/jenkins/.ssh/id_rsa root@gw 'sudo chef-client --force-formatter -l info -j /tmp/deploy-to-gw-by-root-chef.json   --color'"
/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/mixlib-cli-1.4.0/lib/mixlib/cli.rb:229:in `parse_options': invalid option: --force-formatter (OptionParser::InvalidOption)
    from /opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-10.30.2/lib/chef/application.rb:70:in `configure_chef'
    from /opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-10.30.2/lib/chef/application.rb:57:in `reconfigure'
    from /opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-10.30.2/lib/chef/application/client.rb:195:in `reconfigure'
    from /opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-10.30.2/lib/chef/application.rb:63:in `run'
    from /opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-10.30.2/bin/chef-client:26:in `<top (required)>'
    from /usr/bin/chef-client:23:in `load'
    from /usr/bin/chef-client:23:in `<main>'
ERROR:  (Java::Hudson::AbortException)


Use search queries / list of IPs instead of single host field

I think this plugin will be significantly more useful if instead of a single hosts you can specify Chef search query or a list of fqdns/ips. They should both accept expressions (tokens, e.g using the Token Macro plugin)
You will be be then able to get a list of servers using e.g Scriptler script, save the list in a variable and pass this to the chef-plugin.
Alternatively, if the servers are already registered with a Chef server you will be able to use a search query to determine the targets.

Failure in trying to setup a build step

When i click on 'Run chef client on remote host' nothing happens.
I'm trying this from a Mac and when i observed the network I see the following request failure

Request URL:    http://localhost:9090/$stapler/bound/483943d3-9f58-4999-ad2b-1b3587b527fb/render
Request Method:     POST
Status Code:    HTTP/1.1 500 Server Error
Request Headers 22:25:49.000
X-Requested-With:   XMLHttpRequest
X-Prototype-Version:    1.7
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.10; rv:38.0) Gecko/20100101 Firefox/38.0
Referer:    http://localhost:9090/job/Items1/configure
Pragma: no-cache
Host:   localhost:9090
Crumb:  654c68bf-da54-4df8-b9ed-6407361872d9
Content-Type:   application/x-stapler-method-invocation;charset=UTF-8
Content-Length: 2
Connection: keep-alive
Cache-Control:  no-cache
Accept-Language:    en-US,en;q=0.5
Accept-Encoding:    gzip, deflate
Accept: text/javascript, text/html, application/xml, text/xml, */*
Sent Cookie
JSESSIONID.f33706b0:    3w9nbg8tzieltqwvcg02vg5l
Response Headers ฮ”19ms
X-SSH-Endpoint: localhost:56919
X-Jenkins-Session:  72e5cf87
X-Jenkins-CLI2-Port:    56920
X-Jenkins-CLI-Port: 56920
X-Jenkins:  1.626
X-Instance-Identity:    MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAj9yZ8jC7qetQKeAkLlyFlUIITf23yMZ5QyHoeJclb6jNefGOmydEkHik3piyJWmaw/gABnphsu+EDAxSuODT1+7pCQGpYJyQFbEfjMSP0xVNmbY+qbueJD9FAOSmAXZRxICkRDMIS7jVecc9L6lxzU6sdZyMcrhcA4OUKTH0wp9zfcMyQcGXFIL/sRliuof6Bg1BjtJTXLavGhBYQ7sl+m5S2vfI/2t+jJvazm2Wp5NaUSmIxCJ9uLAPg2K+bjUGHIwlVRnsSceblIRnVjBFHwtp+Tk9wAByNhBoG0K9ULrGAmcoSQ3+xm3Gy+WwsIaMwx31ei4Al5XSXX4uUnNczwIDAQAB
X-Hudson-Theme: default
X-Hudson-CLI-Port:  56920
X-Hudson:   1.395
x-frame-options:    sameorigin
X-Content-Type-Options: nosniff
Server: Jetty(winstone-2.8)
Expires:    0
Content-Type:   text/html;charset=UTF-8
Content-Length: 4958
Content-Encoding:   gzip
Cache-Control:  no-cache,no-store,must-revalidate

jenkins chef plugin does not accept the license

When building jenkins pipeline with chef plugin,
Failed in branch cookstyle when running command "chef exec cookstyle . --format progress"
Error message: Chef Workstation cannot execute without accepting the license
Looks like the chef plugin does not accept the license so we have got to run the chef command on the Chef Workstation and accept the license once before chef command can be executed on the jenkens...
Capture

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.