Created
February 22, 2018 15:55
-
-
Save Sam-Martin/ded3a8db0481d763e4cb0f9170f00d10 to your computer and use it in GitHub Desktop.
Install Chef Windows
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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