Base OS packages
- Ubuntu '>= 14.04'
- Debian '>= 7.0'
- Rhel '>= 6.0'
- Chef '>= 12.5'
- apt
- cop_ntp
- build-essentials
- apt
- htop
- vim
- nano
node['packages']['install']
= array of packages to install.
Here's an example base
role that will install basic OS packages. This example adds the net-tools package.
name 'base'
description 'install base OS packages'
override_attributes(
'packages' => {
'install' => {
'net-tools'
}
}
)
run_list(
'recipe[cop_base::default]'
)
You can set environment variables for projects by following the following format:
default['environment_vars'] = {
'VARIABLE': 'VALUE',
'VARIABLE_TWO': 'VALUE_TWO'
}
It will loop through each key value pair and add them to the environment's /etc/environment
file.
NOTE: You will not have access to these variables within the context of chef so you will have to use the :environment
property within the commands that need context.
Testing is handled with ServerSpec, via Test Kitchen, which uses Docker to spin up VMs.
ServerSpec and Test Kitchen are bundled in the ChefDK package.
Get a listing of your instances with:
$ kitchen list
Run Chef on an instance, in this case default-ubuntu-1204, with:
$ kitchen converge default-ubuntu-1204
Destroy all instances with:
$ kitchen destroy
Run through and test all the instances in serial by running:
$ kitchen test