Run Boxstarter scripts inside Chef!
This cookbook provides a light weight resource allowing you to embed Boxstarter scripts inside your Chef recipes. Boxstarter adds value to your Windows installs by:
- Providing an unattended install experience for installs that may require one or many reboots
- Adds the ability to easily install any chocolatey package
- Adds several windows specific configuration commands such as tweaking the task bar, customizing explorer options and much more. See here for details
- Supplies an Install-WindowsUpdates command that can install all available critical updates locally or remotely and reboot as many times as necessary
Boxstarter can only run on Windows platforms from versions 7/2008R2 and above.
default['boxstarter']['tmp_dir'] = "#{ENV['TEMP']}/boxstarter"
default['boxstarter']['version'] = "2.4.152"
No version is specified by default, installing the latest boxstarter modules.
Just include boxstarter
in your node's run_list
:
{
"name":"my_node",
"run_list": [
"recipe[boxstarter]"
]
}
This will install Chocolatey and the Boxstarter powershell modules required to run boxstartr scripts and load the boxstarter resource.
include_recipe 'boxstarter::default'
boxstarter "boxstarter run" do
password default['my_box_cookbook']['my_secret_password']
disable_reboots false
code <<-EOH
Set-WindowsExplorerOptions -EnableShowHiddenFilesFoldersDrives -EnableShowProtectedOSFiles -EnableShowFileExtensions
Enable-RemoteDesktop
cinst console2
cinst fiddler4
cinst git-credential-winstore
cinst poshgit
cinst dotpeek
cinst IIS-WebServerRole -source windowsfeatures
Install-WindowsUpdate -acceptEula
EOH
end
password
is the password of the account under which chef-client is running. This is used for two purposes which may not apply to all scenarios:
- The password is used to log back into the machine after a reboot so that the script can be restarted. If you do not anticipate reboots or have disabled them (see below), then this will not apply.
- If boxstarter is running remotely from a winrm session (chef-metal, knife bootstrap, test-kitchen or vagrant provisioner), boxstarter may need to create a scheduled task for certain operations in order to run in a local context. This is true for installing windows updates, windows features and MSI installs. Boxstarter will need to create the task with admin credentials and expects the passwoed to belong to the running account.
disable_reboots
set this to true if you want to ensure that boxstarter will not initiate a reboot.
Normally, boxstarter will automatically logon and restart its script upon reboot. However, if chef-client is installed and the node is regularly converging, boxstarter will not logon and restart. It doesn't need to becuse the chef-client service will automatically start and initiate a convergence which will effectively restart the boxstarter run.
Also note that because the chef-client runs under the local system account by default, the boxstarter logs will not be in their usual location but in %systemdrive%\ProgramData\Boxstarter
.
Visit http://boxstarter.org for complete documentation, as well as links to source code, discussions and bug tracking.
- Fork the repository on Github
- Create a named feature branch (like
add_component_x
) - Write your change
- Write tests for your change (if applicable)
- Run the tests, ensuring they all pass
- Submit a Pull Request using Github
Author: Matt Wrock ([email protected] @mwrockx) Licensed under Apache 2