Skip to content

Chef repo to provision PiHole DNS on RaspberryPi

Notifications You must be signed in to change notification settings

edrapac/chef_pihole

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

chef_pihole

Chef repo to provision PiHole DNS on RaspberryPi

What does it do?

This repo is meant for a rapid provisioning of a RaspberryPi and PiHole DNS

Summary of services installed

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.

parrotOSbashtheme

Dependencies

  • A running Chef Server or cloud Chef Server instance
  • A chef Workstation w/ChefDK and Chef installed

Usage

Workstation-Server-Node

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

Setting up the Chef Server

For sake of simplicity this we will set up a hosted chef-server instance.

  1. Navigate to https://manage.chef.io/signup/
  2. Create a new account and sign up for a free hosted version of chef-server (free up to 5 nodes)
  3. Create an orginization https://manage.chef.io/
  4. 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.

Setting up the Chef Workstation

  1. 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

  2. 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
    

Download your configs from your Chef Server

  1. Log back into your chef server https://manage.chef.io/
  2. Go to the Administration tab, selection your new organization and click Generate Knife Config
  3. Save knife.rb to ~/.chef on your Workstation
  4. Save your private key you created when you registered the org also to the ~/.chef directory on your Workstation
  5. Perform a quick test that your Workstation can communicate with your Chef server by running knife ssl check

Copy the dockerPiHole cookbook here to your cookbook dir

  1. 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 via mkdir cookbooks in your home dir
  2. Now run mv dockerPiHole/ ~/cookbooks/
  3. Now run knife cookbook upload dockerPihole

Bootstrap your RaspberryPi!

  1. 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]'

About

Chef repo to provision PiHole DNS on RaspberryPi

Resources

Stars

Watchers

Forks

Packages

No packages published