Skip to content

This Ansible playbook initializes a Docker Swarm cluster on a group of Raspberry Pi devices. It includes roles for system updates, Docker installation, Keepalived configuration system configuration, and Swarm cluster initialization.

License

Notifications You must be signed in to change notification settings

iMartzen/bootstrap-swarm-project

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Bootstrap Swarm Project

Bootstrap Swarm Project

Description

This Ansible playbook initializes a Docker Swarm cluster on a group of Raspberry Pi devices. It includes roles for system updates, Docker installation, Keepalived configuration system configuration, and Swarm cluster initialization.

Please read through the project to get a better understanding of what it does and what you need in order to be successful.

Requirements

  • Ansible 2.9 or higher
  • Raspberry Pi with Raspbian
  • SSH access to the nodes

Installation

To use this playbook, ensure Ansible is installed on your machine. For macOS, you can install Ansible using Homebrew:

brew install ansible

Alternatively, for other platforms, install via pip:

pip install ansible

Once Ansible is installed, clone this repository and run the playbook with the following command:

ansible-playbook -i <inventory_file> playbooks/main.yml

Replace <inventory_file> with the path to your Ansible inventory file, which should contain the list of hosts for your Swarm cluster.

Basic Usage

Simply run the playbook using the command above, specifying the hosts you want to include in your Swarm cluster. The playbook will handle updating the system, installing Docker, configuring the system, and initializing the Swarm cluster.

Example:

ansible-playbook -i inventory playbooks/main.yml

This will execute the playbook on all hosts listed in the inventory file.

Advanced Usage

Customizing Message Of The Day (MOTD)

You can create a custom message of the day (MOTD), which appears when logging into your system. Update the this MOTD role's variables to define your MOTD message.

Using Docker Visualizer

The swarm-initialization role includes a step to create a Docker service running Docker Visualizer, which is published on port 8081.

Ansible roles

Bootstraps a Raspbian system with Python and essential packages.

Features:

  • Updates the package list.
  • Installs Python and pip.
  • Installs essential Python packages.

Upgrades system packages to their latest versions.

Features:

Features:

  • Updates the package list.
  • Upgrades all installed packages.
  • Optionally reboots the system if required.

Installs and configures Docker on a target system.

Features:

  • Downloads and runs the Docker installation script.
  • Adds the current user to the Docker group.
  • Configures Docker to start with systemd.
  • Sets up Docker daemon configuration.

Configures various system settings on a target host.

Features:

  • Configures system timezone.
  • Sets up hostname and hosts file.
  • Manages user accounts and groups.
  • Configures SSH settings.

Initializes a Docker Swarm on a target host.

Features:

  • Initializes a Docker Swarm on the nodes.
  • Manages invitations for managers and workers to join the Swarm.
  • Configures Docker Swarm settings.
  • Creates a Docker Visualizer service.

Installs and configures Keepalived for high availability using VRRP on target nodes.

Features:

  • Installs Keepalived via the apt package manager.
  • Configures VRRP to ensure high availability of network services.
  • Dynamically assigns priorities to nodes to define the master and backup roles.
  • Manages Keepalived services, ensuring they are properly restarted and running.
  • Automatically handles failover between nodes in case of failure.

License

GPLv3

About

This Ansible playbook initializes a Docker Swarm cluster on a group of Raspberry Pi devices. It includes roles for system updates, Docker installation, Keepalived configuration system configuration, and Swarm cluster initialization.

Topics

Resources

License

Stars

Watchers

Forks

Languages