Giter Club home page Giter Club logo

ansible-dns's Introduction

ansible-dns

Ansible Playbook to install, initialize, and deploy a high availability (HA) DNS solution utilizing Ansible, GlusterFS, Docker swarm, and Pi-hole.

Overview

Pi-hole blocks ads on your LAN but becomes a single point of failure that can bring your internet to a screeching halt if it fails for whatever reason. Having redundant Pi-hole servers will mitigate this concern.

Docker swarm is used to replicate the DNS servers.

GlusterFS is used to keep configuration in sync between servers.

Summary

Hosts

The swarm consists of 3 SBC hosts running DietPi

  • NanoPi NEO2 1G
  • NanoPi NEO2 512M
  • RaspberryPi 2 Model B

Ansible

Make sure the control node can connect via ssh to the managed nodes. Utilize ssh-agent

Install Python on nodes sudo apt install python3

GlusterFS

GlusterFS is a networked filesystem used in this instance to create a replicated volume. This solves the common issue of keeping the configuration and white/black lists in sync when running multiple Pi-hole instances. An NFS or other network share could be used but this would create a single point of failure.

I manually create a 4GB xfs partition on the SD cards with gparted. The partition is mounted and used for the GlusterFS brick. The partitions could probably be configured via Ansible but since I'm using the SD card which also houses the OS, it can't be modified while active.

A minimum of 3 hosts are used in order to avoid a split brain

Docker swarm

Docker swarm's routing mesh is being circumvented via MACVLAN routing. This allows clients to communicate directly with the Pi-hole instances resulting in proper client metrics. You will need to configure the ip-range in \roles\docker\tasks\subtasks\macvlan_config.yml. Running the playbook as is will work but I've found Docker's IPAM does not seem to distribute IPs to replicated containers correctly. The network config is deployed per node and defines the IP address the service using the network will obtain. Use the playbook as an example, you will probably need to create the network configs manually.

Portainer is deployed for swarm management. Here we can use the routing mesh. Access Portainer on port 9000 of any node in the swarm. You can use Portainer to configure a MACVLAN network or manually via the Docker CLI

Pi-hole

The admin password for is defined in the pihole_service.yml file and utilizes Ansible Vault to secure the password. The default vault password is password, but you should obviously rekey this with a more secure password or just recreate the vault.

ansible-dns's People

Contributors

jhpope avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

mcflis f4bio

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.