Giter VIP home page Giter VIP logo

raspi-ubuntu-ansible's Introduction

raspi-ubuntu-ansible

Raspberry Pi Ubuntu lab provisioning with Ansible

Overview:

Repo contains necessary files to provision multiple Ubuntu Raspberry Pi in home lab. Each Pi SD card is flashed with the latest Ubuntu Server image for Ras Pi, and a user-data file with customized hostname is copied to boot partition. Once booted, cloud-init with the custom user-data file will set the hostname, install Avahi & Ansible, create an 'ansible' user with associated ssh key, and call ansible-pull to run the playbooks from this repo (though not necessary for purposes of this repo, this facilitates further Ansible configuration).

Ansible will further configure host networking (based on assigned hostname and assigned role & variables), setting IP, netmask, gateway, DNS server(s), and DNS search suffix(es) by creating a host-specific Netplan file from the included template. Ansible will set the timezone (from variable) and, based on assigned role (here 'standalone' or 'kubernetes'), install Docker & CIFS-Utils (custom need here), and make the Raspberry Pi devices ready for further configuration or package installations as appropriate.

Cloud-init portion based somewhat on https://github.com/StefanScherer/rpi-ubuntu, I like Raspberry Pi Imager instead of flash for ability to run from Windows, but at the cost of not being able to flash user-data file in same operation.

This replaces my Terraform bootstrap (https://github.com/clayshek/terraform-raspberrypi-bootstrap) for ease of use and combining provisionsing with some initial configuration.

Usage:

  • Contents here reflect my lab infrastructure, but with a few modifications should be portable elsewhere. My lab has two primary roles: 'standalone' which primarily is an Ansible control node, and misc Docker containers, and 'kubernetes' which is a 4 node k3s cluster (further setup using Rancher's Ansible Kubernetes k3s playbook. Roles and package installations can be further customized.
  • Simply flash Raspberry Pi SD card with desired Ubuntu Server version - successfully tested on v20.04 LTS; v18.04 has issues.
  • Copy user-data to boot partition of SD card (first customize hostname value, which should be reflected in Ansible inventory.yml file and have a .yml variables file in host_vars, do any user/ssh key modifications as necessary, and update Git repo location as appropriate)
  • Boot Raspberry Pi, after a few minutes, Pi should be provisioned
  • Troubleshoot logs at /var/log/cloud-init-output.log & /var/log/ansible-provision.run

raspi-ubuntu-ansible's People

Contributors

clayshek avatar

Stargazers

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

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

raspi-ubuntu-ansible's Issues

Thank you!

Thank you for making your work public! Just got lots of inspiration from your setup.

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.