Skip to content

Repository that provides artifacts for Raspberry infrastructure configuration automation

Notifications You must be signed in to change notification settings

robipozzi/windfire-raspberry

Repository files navigation

Raspberry Pi automation

Introduction

This repository holds scripts, playbooks and configurations to automate infrastructure configuration tasks on Raspberry Pi boards.

Ansible configuration setup

The scripts provided are based on Ansible technology (https://www.ansible.com/) for task automation; refer to Ansible technical documentation (https://docs.ansible.com/) for detailed instructions regarding installation and setup.

Ansible uses ssh to connect to the managed infrastructure, so you will first need to generate an ssh key pair; the script ansible-initialize.sh, provided in the root folder of this repo, copies the public ssh key to a remote destination (you will need to pass it as a parameter when you launch the script), assuming you generated a key called ansible_rsa and saved it in .ssh sub-folder under your user home directory.

A file, named ansible.cfg, is also provided to set basic configurations needed to run Ansible; if you launch Ansible from the repo root directory, this file will be read and used as the source for configuration settings (unless you have set an ANSIBLE_CONFIG environment variable, which has precedence), the basic configuration you should have is something like this:

where:

  • inventory defines where Ansible will look for the inventory file, which is used by Ansible to know which servers to connect and manage.
  • private_key_file points to the SSH private key you have previously generated, used by Ansible to connect and launch tasks on the target Raspberry Pi;

Change the parameters according to your environment.

Installation automation task

The raspberry.yaml playbook is provided to do the following basic tasks on all Raspberry boxes consistently:

* update package manager repo cache and upgrade installed packages on all Raspberry Pi boxes
* install OpenSSL on all Raspberry Pi boxes

A convenient scripts install.sh is provided, using raspberry.yaml playbook to consistently configure Raspberry Pi boxes.

Playbook refers to config.yml yaml file provided in conf sub-folder for common variables setup and usage.

Software prereqs installation automation task

Once Raspberry Pi boxes are installed and configured with the common basic software stack, for each specific box (e.g.: appserver, maps_service, calendar_service, ...) a specific software stack is installed and configured.

The raspberry-sw-prereqs.yaml playbook is provided to do the following tasks on specific Raspberry boxes consistently:

* install OpenJDK on all appserver Raspberry Pi boxes
* install NodeJS, npm and pm2 on all maps_service Raspberry Pi boxes

A convenient scripts install-sw-prereqs.sh is provided, using raspberry-sw-prereqs.yaml playbook to consistently configure Raspberry Pi boxes, each with its own specific software stack.

Basic web infrastructure installation automation task

A very basic infrastructure to run web applications can be made of two major components:

  • a Web Server where web application code is actually deployed and is run from - this can be implemented using Apache2
  • a Proxy server that intercepts user requests and forward to the the Web Server, which actually serves the content back to the user - this can be implemented using Nginx

The raspberry-web.yaml playbook is provided under web sub-folder to deploy this basic web infrastructure by doing the following basic tasks on all Raspberry boxes consistently:

* update package manager repo cache and upgrade installed packages on all Raspberry Pi boxes
* install OpenSSL on all Raspberry Pi boxes
* install Nginx on Raspberry Pi boxes marked as proxies and copy utility scripts for Nginx (provided in the *scripts* sub-folder)
* install Apache2 on Raspberry Pi boxes marked as application servers and copy utility scripts for Apache2 (provided in the *scripts* sub-folder)

Some convenient scripts are provided under web sub-folder::

Docker installation automation task

To automate Docker installation on Raspberry Pi boxes using Ansible: follow instructions at https://www.rs-online.com/designspark/raspberry-pi-4-personal-datacentre-part-1-ansible-docker-and-nextcloud.

General instructions on how to install and uninstall Docker on Raspberry Pi boxes are available at https://phoenixnap.com/kb/docker-on-raspberry-pi.

The raspberry-docker.yaml playbook is provided under docker sub-folder to install Docker on all Raspberry Pi boxes.

Some convenient scripts are provided under docker sub-folder:

Projects

I use Raspberry in some projects I develop for fun.

Home Automation

This is a side project that I am developing to handle sensors for various Home Automation tasks; see https://github.com/robipozzi/windfire-home-automation

References

I wrote a more extensive article on how to use Ansible to automate various installation, configuration and application deployment tasks on Raspberry Pi, you can read it at the link here https://bit.ly/3b13V9h.

About

Repository that provides artifacts for Raspberry infrastructure configuration automation

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages