Skip to content

Instantly share code, notes, and snippets.

@Sam-Martin
Created February 22, 2018 15:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Sam-Martin/ded3a8db0481d763e4cb0f9170f00d10 to your computer and use it in GitHub Desktop.
Save Sam-Martin/ded3a8db0481d763e4cb0f9170f00d10 to your computer and use it in GitHub Desktop.
Install Chef Windows
if(test-path C:\chef\){
Write-Host "C:\chef exists!"
Start-Sleep -Seconds 3600
}
Set-ExecutionPolicy unrestricted -force
$VerbosePreference = 'continue'
$InstallPS1 = "https://omnitruck.chef.io/install.ps1"
$InstallPS1LocalPath = "$env:temp\install-chef.ps1"
$orgName = 'CHEF ORG NAME'
$ChefPackageUri = 'https://packages.chef.io/files/stable/chef/12.21.31/windows/2012r2/chef-client-12.21.31-1-x64.msi'
(New-Object Net.WebClient).DownloadFile($installps1, $installps1localpath)
.$InstallPS1LocalPath
Install-Project -project chef-client -version 12 -download_url_override $ChefPackageUri
@"
chef_server_url "https://api.chef.io/organizations/$orgName"
validation_client_name "$orgName-validator"
log_location STDOUT
"@ | Set-Content C:\chef\client.rb
@"
-----BEGIN RSA PRIVATE KEY-----
INSERT
YOUR
RSA
KEY
HERE
-----END RSA PRIVATE KEY-----
"@ | Set-content C:\chef\validation.pem
C:\opscode\chef\bin\chef-client -r 'role[7d-base]'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment