Skip to content

Instantly share code, notes, and snippets.

View ericcalabretta's full-sized avatar

Eric Calabretta ericcalabretta

  • Harness Software
  • San Francisco
View GitHub Profile
@ericcalabretta
ericcalabretta / chef-zero-with-policyfile-archive.MD
Last active July 20, 2020 16:44
Using chef zero with policyfile archive

Using chef zero with policyfile archive

Prep Steps:

  1. Create the archive to share. This includes all the cookbooks, dependencies and config needed to run Chef-Client in a local mode. It's also versioned so you can track what exactly you ran.
git clone the desired cookbook 
move into directory
chef install
chef export -a path_to_cookbook_destination
@ericcalabretta
ericcalabretta / knifebootstrap.md
Last active July 6, 2020 16:29
knife bootstrap example

Bootstrap chef client

To bootstrap a node we need to install install Chef-Client and configure Chef-Client to talk to Chef-Server. We can either use knife bootstrap or the validator bootstrap methods each with different stregths.

Knife Bootstrap

Requires SSH or winrm access to the node & access.

The nodes also need access to download.chef.io to download the chef-client.

@ericcalabretta
ericcalabretta / chef-client-validator-bootstrap.md
Last active August 20, 2020 13:38
chef-client validator bootstrap

Bootstrap chef client with Validator Bootstrap Option

To bootstrap a node we need to install install Chef-Client and configure Chef-Client to talk to Chef-Server.

The validator bootstrap option has the client bootstrap itself, and is commonly used with another tool like vRA, Terraform or SCCM to perform the initial fleet bootstrap.

Steps:

1. Download appropriate chef-client from https://downloads.chef.io/

@ericcalabretta
ericcalabretta / configure-your-workstation.md
Last active April 24, 2020 13:54
Configure your workstation

Step 1: Configure your workstation to talk to chef-server

First you'll need to install Chef-Workstation on your laptop. This includes all the tools you need to use Chef.

https://downloads.chef.io/chef-workstation/0.17.5

Test your chef-workstation install with chef --version command.

Chef Workstation version: 0.7.4
@ericcalabretta
ericcalabretta / install.sh
Created April 22, 2020 20:03
example kitchen install.sh
wget http://34.221.48.134:8081/artifactory/example-repo-local/chef-15.8.23-1.el7.x86_64.rpm -O /tmp/chef-15.8.23-1.el7.x86_64.rpm
sudo rpm -ivh /tmp/chef-15.8.23-1.el7.x86_64.rpm
@ericcalabretta
ericcalabretta / kitchen.yml
Created April 22, 2020 20:02
example linux kitchen airgapped with Omnibus method
driver:
name: vagrant
# Air-gap settings to pull box from internal repo
box: centoss-7-v202002.04.0
box_url: http://34.223.67.135:8081/artifactory/example-repo-local/centoss-7-v202002.04.0.box
box_download_insecure: True
provisioner:
name: chef_zero
# Air-gap settings to pull chef-client from internal repo
@ericcalabretta
ericcalabretta / default.rb
Last active April 24, 2020 13:56
audit cookbook default value
include_recipe 'audit::default'
node.default['audit']['reporter'] = 'chef-server-automate'
node.default['audit']['fetcher'] = 'chef-server'
case node['platform']
when 'centos'
node.default['audit']['profiles']['cis-centos7-level1-server'] = {
'compliance': 'admin/cis-centos7-level1-server',
'version': '2.2.0-14'
@ericcalabretta
ericcalabretta / instructions.md
Last active April 29, 2020 19:04
Pilot Automate + Chef Server install
@ericcalabretta
ericcalabretta / kitchen.yml
Last active April 21, 2020 22:03
Example linux kitchen.yml with "air-gap" virtual box/chef-client downloads
driver:
name: vagrant
# Air-gap settings to pull box from internal repo
box: linux-box-name
box_url: http://URL_to-linux-virtual-box.box
box_download_insecure: True
provisioner:
name: chef_zero
# Air-gap settings to pull chef-client from internal repo
@ericcalabretta
ericcalabretta / kitchen.yml
Last active April 22, 2020 15:29
Example Windows kitchen.yml with "air-gap" virtual box/chef-client downloads
driver:
name: vagrant
# box: windows-box-name
# box_url: http://FQDN_to-windows-virtual-box.box
# box_download_insecure: True
boot_timeout: 1200
gui: false
provisioner:
name: chef_zero