• Stars
    star
    3,690
  • Rank 11,503 (Top 0.3 %)
  • Language Jinja
  • License
    MIT License
  • Created about 3 years ago
  • Updated about 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Raspberry Pi config for all things Internet.

Internet Pi

CI

A Raspberry Pi Configuration for Internet connectivity

I have had a couple Pis doing random Internet-related duties for years. It's finally time to formalize their configs and make all the DNS/ad-blocking/monitoring stuff encapsulated into one Ansible project.

So that's what this is.

Features

Internet Monitoring: Installs Prometheus and Grafana, along with a few Docker containers to monitor your Internet connection with Speedtest.net speedtests and HTTP tests so you can see uptime, ping stats, and speedtest results over time.

Internet Monitoring Dashboard in Grafana

Pi-hole: Installs the Pi-hole Docker configuration so you can use Pi-hole for network-wide ad-blocking and local DNS. Make sure to update your network router config to direct all DNS queries through your Raspberry Pi if you want to use Pi-hole effectively!

Pi-hole on the Internet Pi

Other features:

  • Shelly Plug Monitoring: Installs a shelly-plug-prometheus exporter and a Grafana dashboard, which tracks and displays power usage on a Shelly Plug running on the local network. (Disabled by default. Enable and configure using the shelly_plug_* vars in config.yml.)
  • AirGradient Monitoring: Configures airgradient-prometheus and a Grafana dashboard, which tracks and displays air quality over time via one or more AirGradient DIY monitors. (Disabled by default. Enable and configure using the airgradient_enable var in config.yml. See example configuration for ability to monitor multiple AirGradient DIY stations.)
  • Starlink Monitoring: Installs a starlink prometheus exporter and a Grafana dashboard, which tracks and displays Starlink statistics. (Disabled by default. Enable and configure using the starlink_enable var in config.yml.)

IMPORTANT NOTE: If you use the included Internet monitoring, it will download a decently-large amount of data through your Internet connection on a daily basis. Don't use it, or tune the internet-monitoring setup to not run the speedtests as often, if you have a metered connection!

Recommended Pi and OS

You should use a Raspberry Pi 4 model B or better. The Pi 4 and later generations of Pi include a full gigabit network interface and enough I/O to reliably measure fast Internet connections.

Older Pis work, but have many limitations, like a slower CPU and sometimes very-slow NICs that limit the speed test capability to 100 Mbps or 300 Mbps on the Pi 3 model B+.

Other computers and VMs may run this configuration as well, but it is only regularly tested on a Raspberry Pi.

The configuration is tested against Raspberry Pi OS, both 64-bit and 32-bit, and runs great on that or a generic Debian installation.

It should also work with Ubuntu for Pi, or Arch Linux, but has not been tested on other operating systems.

Setup

  1. Install Ansible. The easiest way (especially on Pi or a Debian system) is via Pip:
    1. (If on Pi/Debian): sudo apt-get install -y python3-pip
    2. (Everywhere): pip3 install ansible
  2. Clone this repository: git clone https://github.com/geerlingguy/internet-pi.git, then enter the repository directory: cd internet-pi.
  3. Install requirements: ansible-galaxy collection install -r requirements.yml (if you see ansible-galaxy: command not found, restart your SSH session or reboot the Pi and try again)
  4. Make copies of the following files and customize them to your liking:
    • example.inventory.ini to inventory.ini (replace IP address with your Pi's IP, or comment that line and uncomment the connection=local line if you're running it on the Pi you're setting up).
    • example.config.yml to config.yml
  5. Run the playbook: ansible-playbook main.yml

If running locally on the Pi: You may encounter an error like "Error while fetching server API version". If you do, please either reboot or log out and log back in, then run the playbook again.

Usage

Pi-hole

Visit the Pi's IP address (e.g. http://192.168.1.10/) and use the pihole_password you configured in your config.yml file. An existing pi-hole installation can be left unaltered by disabling the setup of this proyect's installation in your config.yml (pihole_enable: false)

Grafana

Visit the Pi's IP address with port 3030 (e.g. http://192.168.1.10:3030/), and log in with username admin and the password monitoring_grafana_admin_password you configured in your config.yml.

To find the dashboard, navigate to Dashboards, click Browse, then go to the Internet connection dashboard. If you star this dashboard, it will appear on the Grafana home page.

Note: The monitoring_grafana_admin_password is only used the first time Grafana starts up; if you need to change it later, do it via Grafana's admin UI.

Prometheus

A number of default Prometheus job configurations are included out of the box, but if you would like to add more to the prometheus.yml file, you can add a block of text that will be added to the end of the scrape_configs using the prometheus_extra_scrape_configs variable, for example:

prometheus_extra_scrape_configs: |
  - job_name: 'customjob'
    scrape_interval: 5s
    static_configs:
      - targets: ['192.168.1.1:9100']

You can also add more targets to monitor via the node exporter dashboard, say if you have a number of servers or other Pis you want to monitor on this instance. Just add them to the list, after the nodeexp:9100 entry for the main Pi:

prometheus_node_exporter_targets:
  - 'nodeexp:9100'
  # Add more targets here
  - 'another-server.local:9100'

Updating

pi-hole

To upgrade Pi-hole to the latest version, run the following commands:

cd ~/pi-hole # 
docker-compose pull             # pulls the latest images
docker-compose up -d --no-deps  # restarts containers with newer images
docker system prune --all       # deletes unused images

Configurations and internet-monitoring images

Upgrades for the other configurations are similar (go into the directory, and run the same docker-compose commands. Make sure to cd into the config_dir that you use in your config.yml file.

Alternatively, you may update the initial config.yml in the the repo folder and re-run the main playbook: ansible-playbook main.yml. At some point in the future, a dedicated upgrade playbook may be added, but for now, upgrades may be performed manually as shown above.

Backups

A guide for backing up the configurations and historical data will be posted here as part of Issue #194: Create Backup guide.

Uninstall

To remove internet-pi from your system, run the following commands (assuming the default install location of ~, your home directory):

# Enter the internet-monitoring directory.
cd ~/internet-monitoring

# Shut down internet-monitoring containers and delete data volumes.
docker-compose down -v

# Enter the pi-hole directory.
cd ~/pi-hole

# Shutdown pi-hole containers and delete data volumes.
docker-compose down -v

# Delete all the unused container images, volumes, etc. from the system.
docker system prune -f

Do the same thing for any of the other optional directories added by this project (e.g. shelly-plug-prometheus, starlink-exporter, etc.).

You can then delete the internet-monitoring, pi-hole, etc. folders and everything will be gone from your system.

License

MIT

Author

This project was created in 2021 by Jeff Geerling.

More Repositories

1

ansible-for-devops

Ansible for DevOps examples.
Python
7,475
star
2

mac-dev-playbook

Mac setup and configuration via Ansible.
Shell
5,735
star
3

macos-virtualbox-vm

Instructions and script to help you create a VirtualBox VM running macOS.
Shell
2,519
star
4

ansible-vagrant-examples

Ansible examples using Vagrant to deploy to local VMs.
2,034
star
5

raspberry-pi-dramble

DEPRECATED - Raspberry Pi Kubernetes cluster that runs HA/HP Drupal 8
Shell
1,656
star
6

ansible-role-docker

Ansible Role - Docker
1,515
star
7

drupal-vm

A VM for Drupal development
Jinja
1,371
star
8

pi-webcam

Automation to configure a Raspberry Pi as a USB OTG webcam
1,322
star
9

internet-monitoring

Monitor your network and internet speed with Docker & Prometheus
1,237
star
10

raspberry-pi-pcie-devices

Raspberry Pi PCI Express device compatibility database
HTML
1,230
star
11

ansible-role-mysql

Ansible Role - MySQL
Jinja
988
star
12

ansible-role-jenkins

Ansible Role - Jenkins CI
Groovy
802
star
13

ansible-role-nginx

Ansible Role - Nginx
Jinja
774
star
14

ansible-role-security

Ansible Role - Security
Jinja
706
star
15

ansible-role-certbot

Ansible Role - Certbot (for Let's Encrypt)
Shell
698
star
16

ansible-role-gitlab

Ansible Role - GitLab
Jinja
653
star
17

packer-boxes

Jeff Geerling's Packer build configurations for Vagrant boxes.
Shell
635
star
18

ansible-for-kubernetes

Ansible and Kubernetes examples from Ansible for Kubernetes Book
Shell
612
star
19

my-backup-plan

How I back up all my data.
Shell
576
star
20

dotfiles

My configuration. Minimalist, but helps save a few thousand keystrokes a day.
Shell
540
star
21

ansible-role-firewall

Ansible Role - iptables Firewall configuration.
Shell
481
star
22

ansible-role-postgresql

Ansible Role - PostgreSQL
Jinja
478
star
23

kubernetes-101

Kubernetes 101 - by Jeff Geerling
HTML
477
star
24

ansible-role-php

Ansible Role - PHP
Jinja
468
star
25

ansible-role-kubernetes

Ansible Role - Kubernetes
Jinja
425
star
26

Ping

A PHP class to ping hosts.
PHP
415
star
27

ansible-role-apache

Ansible Role - Apache 2.x.
Jinja
392
star
28

ansible-role-nodejs

Ansible Role - Node.js
Jinja
386
star
29

turing-pi-cluster

DEPRECATED - Turing Pi cluster configuration for Raspberry Pi Compute Modules
Jinja
347
star
30

awx-container

Ansible Container project that manages the lifecycle of AWX on Docker.
297
star
31

ansible-role-java

Ansible Role - Java
Jinja
293
star
32

ansible-role-ntp

Ansible Role - NTP
Jinja
290
star
33

pi-timelapse

Time-lapse app for Raspberry Pi computers.
Python
278
star
34

temperature-monitor

Raspberry Pi-based home temperature monitoring network.
JavaScript
256
star
35

pi-cluster

Raspberry Pi Cluster automation
Shell
231
star
36

ansible-role-awx

DEPRECATED Ansible Role - AWX
230
star
37

ansible-role-homebrew

Ansible Role - Homebrew (MOVED to geerlingguy.mac collection)
Shell
228
star
38

ansible-role-redis

Ansible Role - Redis
Jinja
228
star
39

packer-centos-7

This build has been moved - see README.md
223
star
40

ansible-collection-mac

Collection of macOS automation tools for Ansible.
Shell
220
star
41

ansible-role-dotfiles

Ansible Role - Easy and flexible dotfile installation.
214
star
42

ansible-role-nfs

Ansible Role - NFS
Jinja
207
star
43

ansible-role-haproxy

Ansible Role - HAProxy
Jinja
194
star
44

ansible-role-git

Ansible Role - Git
188
star
45

ansible-role-repo-epel

Ansible Role - EPEL Repository for RHEL/CentOS
175
star
46

ansible-role-composer

Ansible Role - Composer PHP Dependency Manager
Jinja
175
star
47

ansible-role-pip

Ansible Role - Pip (for Python)
174
star
48

turing-pi-2-cluster

DEPRECATED - Turing Pi 2 Cluster
Jinja
174
star
49

ansible-role-logstash

Ansible Role - Logstash
Jinja
168
star
50

ansible-role-elasticsearch

Ansible Role - Elasticsearch
Jinja
167
star
51

pico-w-garage-door-sensor

Wireless garage door sensor for Home Assistant powered by Raspberry Pi Pico W
Python
166
star
52

drupal-for-kubernetes

Drupal Example Site for Kubernetes
PHP
149
star
53

ansible-role-filebeat

Ansible Role - Filebeat for ELK stack
Jinja
137
star
54

ansible-role-backup

Ansible Role - Backup for simple servers
Shell
135
star
55

ansible-role-ansible

Ansible Role - Ansible
130
star
56

airgradient-prometheus

AirGradient Prometheus exporter.
C++
116
star
57

ansible-role-kibana

Ansible Role - Kibana
Jinja
115
star
58

ansible-role-swap

Ansible Role - Swap
107
star
59

obs-task-list-overlay

An HTML and Node.js-based task list overlay for OBS.
JavaScript
105
star
60

drupal-pi

Drupal on Docker on a Raspberry Pi. Pi Dramble's little brother.
Jinja
105
star
61

ansible-role-glusterfs

Ansible Role - GlusterFS
104
star
62

ansible-role-raspberry-pi

Configures a Raspberry Pi (running Raspbian).
102
star
63

docker-centos7-ansible

CentOS 7 Docker container for Ansible playbook and role testing.
Dockerfile
101
star
64

packer-ubuntu-1804

This build has been moved - see README.md
101
star
65

ansible-role-solr

Ansible Role - Apache Solr
Shell
97
star
66

ansible-mastodon

Mastodon installation on a single server using Ansible.
Jinja
95
star
67

sbc-reviews

Jeff Geerling's SBC review data - Raspberry Pi, Radxa, Orange Pi, etc.
93
star
68

ansible-role-supervisor

Ansible Role - Supervisor
Shell
92
star
69

ansible-role-docker_arm

Ansible Role - Docker for ARM and Pi
91
star
70

ansible-requirements-updater

Update your requirements.yml with this grisly Ansible playbook.
90
star
71

ansible-role-php-versions

Ansible Role - PHP Versions
88
star
72

ansible-role-ruby

Ansible Role - Ruby
Shell
86
star
73

JJG-Ansible-Windows

[DEPRECATED] Windows shell provisioning script to bootstrap Ansible from within a Vagrant VM.
Shell
85
star
74

ansible-role-mas

Ansible Role - Mac App Store CLI (MOVED to geerlingguy.mac collection)
84
star
75

ansible-role-drupal

Ansible Role - Drupal
84
star
76

ansible-role-postfix

Ansible Role - Postfix
82
star
77

tower-operator

DEPRECATED: This project was moved and renamed to: https://github.com/ansible/awx-operator
Dockerfile
82
star
78

ansible-role-varnish

Ansible Role - Varnish HTTP accelerator
Jinja
82
star
79

packer-ubuntu-1404

DEPRECATED - Packer Example - Ubuntu 14.04 Vagrant Box using Ansible provisioner
Shell
82
star
80

pi4gpu

Raspberry Pi GPU Carrier Board
OpenSCAD
82
star
81

pi-camera

A Raspberry Pi Camera
Python
79
star
82

pi-router

Raspberry Pi-based OpenWRT router config for 4G/5G Waveshare Dual Ethernet board.
Dockerfile
79
star
83

packer-centos-6

This build has been moved - see README.md
79
star
84

docker-ubuntu1804-ansible

Ubuntu 18.04 LTS (Bionic) Docker container for Ansible playbook and role testing.
Dockerfile
78
star
85

top500-benchmark

Automated Top500 benchmark for clusters or single nodes.
Jinja
76
star
86

deskpi-super6c-cluster

DEPRECATED - DeskPi Super6c 6-node Raspberry Pi CM4 Cluster
76
star
87

docker-examples

There are many like it, but this one is mine.
Python
75
star
88

youtube-10k-pods

10,000 Kubernetes Pods for 10,000 Subscribers
74
star
89

docker-ubuntu2004-ansible

Ubuntu 20.04 LTS (Focal Fossa) Docker container for Ansible playbook and role testing.
Dockerfile
74
star
90

pi-bell-slapper

The King of Ding. Internet-connected Raspberry Pi-based notification bell.
OpenSCAD
74
star
91

baby-safe-temp

Safe temperature monitor for baby's room. Made for Raspberry Pi Pico.
Python
74
star
92

ansible-role-memcached

Ansible Role - Memcached
Jinja
68
star
93

ansible-role-node_exporter

Ansible role - Node exporter
Jinja
66
star
94

ansible-role-mailhog

Ansible Role - MailHog for catching and viewing emails
Shell
62
star
95

molecule-playbook-testing

This is an example from the Ansible 101 livestream
62
star
96

ansible-role-ssh-chroot-jail

Ansible Role - SSH chroot jail config
Shell
60
star
97

pi-nvr

Raspberry Pi NVR for home CCTV recording.
Dockerfile
58
star
98

Imap

Simple wrapper class for PHP's IMAP-related email functions.
PHP
57
star
99

Request

A simple PHP HTTP request class.
PHP
56
star
100

ansible-role-samba

Ansible Role - Samba
55
star