Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Any pointers on setting up Chef push jobs?

Tags:

chef-infra

I followed the Chef push jobs page, but am still confused. For example, that page describes this

Add the following default attributes on all nodes that are managed by Chef push jobs:

"push_jobs": {
  "package_url": "<package_url>",
  "package_checksum": "<checksum>"
}

But what is package_url and checksum? Where do I get those?

In general, is there a simple tutorial on how to set up Chef push jobs?

like image 845
Chris F Avatar asked Jan 27 '15 21:01

Chris F


2 Answers

You can find the URL and checksum on the Chef Push download page. After you've selected your platform, you can right click the download link and copy the source code. The page will also let you copy the checksum from below the download link.

like image 66
Michael Lapidakis Avatar answered Oct 04 '22 22:10

Michael Lapidakis


I just want to supplement the answers already given, thanks to Michael Lapidakis and kirill_I as their answers helped me to figure out how to bootstrap a windows server node to have chef client software and the push-jobs client installed using winrm.

Rather than update the push-jobs recipe's attributes file I passed the package_url and package_checksum as json attributes on the command line of the knife command. kirill_I is correct in that the hash given on the download page is SHA1 and not SHA256 so it cannot be used as the checksum. The easiest way to get a checksum on a windows box is the use the powershell command Get-FileHash because sha256sum.exe is not available without an internet download. You have to toLower() the output because by default powershell gives it in upper case and chef sees that as two different checksums:

COMPUTERNAME.DOMAIN [2015-10-27T09:25:59-07:00] FATAL: Chef::Exceptions::ChecksumMismatch: windows_package[Opscode Push Jobs Client Installer for Windows v1.1.5] (push-jobs::windows line 29) had an error: Chef::Exceptions::ChecksumMismatch: remote_file[c:/chef/cache/opscode-push-jobs-client-windows-1.1.5-1.windows.msi] (dynamically defined) had an error: Chef: :Exceptions::ChecksumMismatch: Checksum on resource (411520) does not match checksum on content (411520)

To get the hash in powershell use the following command, replacing the filename and directory with the version you downloaded from chef:

(Get-FileHash c:\Software\opscode-push-jobs-client-windows-1.1.5-1.windows.msi -Algorithm SHA256).Hash.toLower()

I then plugged that hash into the following knife bootstrap command:

knife bootstrap windows winrm COMPUTERNAME.DOMAIN --winrm-user Administrator --winrm-password 'password' --node-name COMPUTERNAME.DOMAIN --run-list 'recipe[push-jobs]' -j '{ \"push_jobs\": { \"package_url\": \"https://opscode-private-chef.s3.amazonaws.com/windows/2008r2/x86_64/opscode-push-jobs-client-windows-1.1.5-1.windows.msi\", \"package_checksum\": \"411520e6a2e3038cd018ffacee0e76e37e7badd1aa84de03f5469c19e8d6c576\" } }'

The json has to be escaped, otherwise I was getting a JSON parser error.

like image 21
James Eby Avatar answered Oct 04 '22 21:10

James Eby