PiAnsible

Ansible playbooks for automating Raspberry Pi OS Lite setup, including Docker, Docker Compose, and Apache2 in Docker.

GPL-3.0 License

Stars
0
Committers
2

PiAnsible

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.

Getting Started

Prerequisites

  • Ansible installed on your local machine.
  • Access to a computer or computers running Debian.
  • SSH access to the computer(s).

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.

Directory Structure

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

Creating the index.html File

  1. Navigate to the root directory of your PiAnsible repository.
  2. Create an index.html file with the following command:
   touch index.html
  1. Edit the 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>&copy; 2024 PiAnsible. All rights reserved.</p>
    </div>
  </div>
</body>
</html>

Using this playbook

  1. 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"
      
  2. Set up the Inventory File: Copy inventory.example.ini to inventory.ini, and edit it to match your setup

    • Example:
    [all]
    pi.local ansible_user=pi
    
  3. Run the Playbook

ansible-playbook main.yml

License

This project is licensed under the GNU General Public License v3.0 (GPL-3.0).

What This Means

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:

  • Freedom to Use: You can use the software for any purpose.
  • Freedom to Study and Modify: You can study how the program works and change it to make it do what you wish. Access to the source code is a precondition for this.
  • Freedom to Distribute Copies: You can redistribute copies of the original program so you can help others.
  • Freedom to Distribute Modified Versions: You can distribute copies of your modified versions to others. By doing this you can give the whole community a chance to benefit from your changes. Access to the source code is a precondition for this.

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.

Related Projects