Skip to content

Instantly share code, notes, and snippets.

@karstenmueller
Last active May 20, 2017 05:40
Show Gist options
  • Save karstenmueller/0c2257684b8e6a44bac9526c52074e18 to your computer and use it in GitHub Desktop.
Save karstenmueller/0c2257684b8e6a44bac9526c52074e18 to your computer and use it in GitHub Desktop.
Basic Workstation Configuration
chocolatey_package 'git' do
package_name 'git'
options '-params /GitAndUnixToolsOnPath'
end
packages = %w[conemu visualstudiocode 7zip winmerge vagrant autohotkey]
packages.each do |pkg|
chocolatey_package pkg
end
gems = %w[kitchen-pester kitchen-hyperv kitchen-dsc kitchen-azurerm azure-credentials pry pry-byebug pry-stack_explorer appbundle-updater]
gems.each do |gem|
chef_gem gem do
compile_time false if respond_to?(:compile_time)
end
end
extensions = %w[ ms-vscode.PowerShell msazurermtools.azurerm-vscode-tools Pendrica.Chef ]
extensions.each do |ext|
execute "install vscode extension #{ext}" do
command "code --install-extension #{ext}"
end
end
powershell_script 'Install-PackageProvider -Name NuGet -MinimumVersion 2.8.5.201 -Force' do
end
modules = %w[ PSReadline ]
modules.each do |mod|
powershell_script "Install-Module #{mod} -Force" do
end
end
directory 'C:\Work\Chef' do
recursive true
action :create
end
execute 'chef generate repo example_repo -p' do
cwd 'C:\Work\Chef'
end
# Setup my execution policy for both the 64 bit and 32 bit shells
set-executionpolicy remotesigned
start-job -runas32 {set-executionpolicy remotesigned} | receive-job -wait
# Install fixed version of ChefDK
invoke-restmethod 'https://omnitruck.chef.io/install.ps1' | iex
install-project chefdk -verbose -version 1.1.16
# Install Chocolatey
invoke-expression ((new-object net.webclient).DownloadString('https://chocolatey.org/install.ps1'))
choco feature enable -n allowGlobalConfirmation
# Get a basic setup recipe
Invoke-RestMethod -UseBasicParsing 'https://gist.githubusercontent.com/karstenmueller/0c2257684b8e6a44bac9526c52074e18/raw/a150048b7ffbfe202f90fdce446b8095b3e7858c/basic.rb' | out-file -encoding ascii -filepath c:/basic.rb
# We dont need any Windows 10 Apps
Get-AppxPackage | Remove-AppxPackage 2>&1>$null
# Use Chef Apply to setup
chef-apply c:/basic.rb
write-host "executed chef recipe c:/basic.rb"
@karstenmueller
Copy link
Author

karstenmueller commented Dec 8, 2016

Setting Up A Windows Workstation for Chef Development - The Easy Way

This is based on Steve Murawskis work. See his blog post on simplified-chef-workstation

What I really really want is ... using boxstarter instead of chocolatey:)

@ctrl78
Copy link

ctrl78 commented Dec 26, 2016

Nice work , agree with you to use boxstarter, if you need some help ping me !

@jugatsu
Copy link

jugatsu commented May 20, 2017

You can use powershell_package resource instead of powershell_script.
https://github.com/chef/chef/blob/master/lib/chef/resource/powershell_package.rb

powershell_package 'PSReadline' do
  action :install
end

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment