GitXplorerGitXplorer
e

chef_pihole

public
1 stars
0 forks
0 issues

Commits

List of commits on branch master.
Unverified
07b2b4fc117bcce2ce347457883e43e912012f60

downgraded ruby for version pinning and stability

eedrapac committed 5 years ago
Unverified
06910e691821bb89cbe48c5711cb51c053d70098

license issue fixed

eedrapac committed 5 years ago
Unverified
a3c5790a8d2957988fc63f3f34ba12afff9dab03

software install summary

eedrapac committed 5 years ago
Unverified
7cc9ea115ef9bcfa7b33b4c8b731ef2207c1ad08

fixed template name

eedrapac committed 5 years ago
Unverified
fe4a805c09f6a72c1fe3d42f2a4765b3df8f9bb3

finished readme

eedrapac committed 5 years ago
Unverified
0409845114be030ff1bcd8b53614db011012028a

more readme and cookbook maturation

eedrapac committed 5 years ago

README

The README file for this repository.

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