Ansible playbooks for automating Raspberry Pi OS Lite setup, including Docker, Docker Compose, and Apache2 in Docker.
GPL-3.0 License
PiAnsible is an Ansible project designed to automate the setup of services on Raspberry Pi OS Lite. This repository includes playbooks to install and configure Docker, Docker Compose, disable IPv6, install Netdata, and install Apache2 in Docker.
Note: This playbook has only been tested on a Raspberry Pi 4 B running Raspberry Pi OS Lite 64-bit. It should work on other distros and architectures, however if there are any issues create an issue and I will look into it when I have the time.
Your project should include the following directory structure:
PiAnsible/
├── tasks/
│ ├── update-upgrade.yml
│ ├── docker-compose.yml
│ ├── apache-docker.yml
│ ├── disable-ipv6.yml
│ ├── install_netdata.yml
├── vars/
│ ├── netdata_credentials.yml
├── inventory.example.ini
├── main.yml
└── index.html # Create this file as described below
index.html
FilePiAnsible
repository.index.html
file with the following command: touch index.html
index.html
file to include your desired content. Here's a simple example:<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Welcome to PiAnsible!</title>
<style>
body {
font-family: Arial, sans-serif;
background-color: #f4f4f9;
color: #333;
margin: 0;
padding: 0;
text-align: center;
}
.container {
max-width: 800px;
margin: 50px auto;
padding: 20px;
background: #fff;
border-radius: 8px;
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
}
h1 {
color: #0056b3;
}
p {
font-size: 1.2em;
line-height: 1.6;
}
.footer {
margin-top: 30px;
font-size: 0.9em;
color: #777;
}
a.button {
display: inline-block;
padding: 10px 20px;
font-size: 1em;
color: #fff;
background-color: #0056b3;
border: none;
border-radius: 5px;
text-decoration: none;
transition: background-color 0.3s ease;
}
a.button:hover {
background-color: #003d7a;
}
</style>
</head>
<body>
<div class="container">
<h1>Welcome to PiAnsible!</h1>
<p>This is the default page served by your Apache2 Docker container. PiAnsible is an Ansible project designed to automate the setup of services on Raspberry Pi OS Lite.</p>
<p>For more information and to get started, visit the project repository on GitHub.</p>
<a href="https://github.com/wbreiler/PiAnsible" class="button">Visit GitHub Repository</a>
<div class="footer">
<p>© 2024 PiAnsible. All rights reserved.</p>
</div>
</div>
</body>
</html>
Store your Netdata credentials in the vars/netdata_credentials.yml
file
touch vars/netdata_credentials.yml
Open the file in your favorite text editor
Your credentials file should look like this:
---
claim_token: "your-claim-token-here"
claim_rooms: "your-claim-rooms-here"
Set up the Inventory File: Copy inventory.example.ini
to inventory.ini
, and edit it to match your setup
[all]
pi.local ansible_user=pi
Run the Playbook
ansible-playbook main.yml
This project is licensed under the GNU General Public License v3.0 (GPL-3.0).
The GPL-3.0 is a free software license that guarantees end users the freedom to run, study, share, and modify the software. The key aspects of GPL-3.0 include:
If you distribute copies or modified versions of the software, you must pass on the same freedoms to others. That means you must distribute the source code and keep the GPL license intact.