Coder Social home page Coder Social logo

packer-pi-hole's Introduction

Packer: Pi-Hole

A script for building a Pi Hole image using Packer.

Prerequisites

First, install Packer on your system. For Debian/Ubuntu based systems:

curl -fsSL https://apt.releases.hashicorp.com/gpg | sudo apt-key add -
sudo apt-add-repository "deb [arch=amd64] https://apt.releases.hashicorp.com $(lsb_release -cs) main"
sudo apt-get update && sudo apt-get install packer

Then you need to install the ARM image plugin. This requires a working install of Go.

git clone https://github.com/solo-io/packer-builder-arm-image
cd packer-builder-arm-image
go mod download
go build

There is an alternative Packer ARM plugin if you want more control: https://github.com/mkaczanowski/packer-builder-arm.

After building the plugin, you need to copy the binary to a location where Packer can pick it up (e.g. $HOME/.packer.d/plugins). However, you will most likely run the build a root, so keep that in mind:

sudo mkdir -p /root/packer.d/plugins/
sudo mv packer-builder-arm-image /root/packer.d/plugins/

Lastly, you also need to instrall kpartx and qemu:

sudo apt install kpartx qemu-user-static

Building

You need to create a config file named vars.json which contains a bit of configuration:

{
  "user_name": "<user>",
  "user_password": "<password>",
  "user_public_key": "<public ssh key for user>",
  "pi_password": "<another password>",
  "pihole_web_password": "<yet anotehr password>",
  "host_name": "piholr",
  "ipv4_address": "10.0.0.10/24"
}
Variable Description
user_name If not empty a new user with this name will created.
user_password The password for the new user.
user_public_key The SSH public key for the new user.
pi_password A new password for the default pi user.
pihole_web_password The password for the Pi-hole web interface.
host_name The host name (default: pihole).
ipv4_address The IPv4 address of the machine (used by Pi-hole).
ipv6_address The IPv6 address of the machine. Can be left empty.

When you've created the vars.json file you can build the image with:

sudo make build

The resulting image output-arm-image/image can be burned to a micro-SD card.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.