This repo installs all of the packages required to run Chef on a RaspberryPi as well as all the requirements to run Docker containers on ARM architecture. Additonally, the last bash resource in the dockerPiHole recipe will install a parrotOS bash theme which although totally optional is also totally rad.
- A running Chef Server or cloud Chef Server instance
- A chef Workstation w/ChefDK and Chef installed
The above configuration is how we will start out, with your local development environment as the workstation, a cloud hosted instance of Chef as the server and the RaspberryPi as the node.
To get started, you will need a Linux/Unix dev env that is supported by Chef (I recommend Ubuntu or Debian). Whether that means you are running Linux locally as your main OS, in a VM, or in a Docker container that is up to you, macOS is also totally fine.
- A note about VMs: If you choose to have your workstation as a VM, to make the process as simple as possible when configuring networking settings, have the VM in a bridged adapter mode. The VM will then be seen as a logical host on your network with an IP address independent of your physical machine
For sake of simplicity this we will set up a hosted chef-server instance.
- Navigate to https://manage.chef.io/signup/
- Create a new account and sign up for a free hosted version of chef-server (free up to 5 nodes)
- Create an orginization https://manage.chef.io/
- MAKE SURE TO SAVE YOUR PRIVATE KEY THAT WAS JUST CREATED SOMEWHERE SECURE AND EASILY ACCESSIBLE YOU WILL NEED IT
For now this is all we need to do with the chef server, we will revisit it soon though.
-
Install Chef (and most importantly knife) on your workstation. The commands for this vary
macOS
brew cask install chef/chef/chef-workstation
Ubuntu/Debian
apt-get install chef
-
Install the ChefDk
macOS
Follow this guide: https://docs.chef.io/install_dk.html
Ubuntu/Debian
wget https://packages.chef.io/files/stable/chefdk/3.2.30/ubuntu/18.04/chefdk_3.2.30-1_amd64.deb dpkg -i chefdk_3.2.30-1_amd64.deb
- Log back into your chef server https://manage.chef.io/
- Go to the Administration tab, selection your new organization and click Generate Knife Config
- Save knife.rb to ~/.chef on your Workstation
- Save your private key you created when you registered the org also to the ~/.chef directory on your Workstation
- Perform a quick test that your Workstation can communicate with your Chef server by running
knife ssl check
- By default, the
knife.rb
file you downloaded will have set your cookbook path to~/cookbooks
if that directory does not exist, create it now viamkdir cookbooks
in your home dir - Now run
mv dockerPiHole/ ~/cookbooks/
- Now run
knife cookbook upload dockerPihole
- Finally, run the following command to bootstrap chef-client onto your RaspberryPi and run the recipe
knife bootstrap PI_IP_ADDRESS -t raspbian-jessie-gems.erb --ssh-user pi --ssh-password 'raspberry' --sudo --use-sudo-password --node-name 'NODE_NAME' --run-list 'recipe[dockerPiHole]'