A simple Ansible role to set up a single-node Docker Swarm cluster
- Ansible 2.10+
- Docker
You can install this role directly from Ansible Galaxy:
ansible-galaxy install brpaz.swarmFor version-controlled, repeatable role installations, add to your requirements.yml:
---
roles:
- name: brpaz.swarm
version: v1.0.0 # Specify the version you want
collections:
- name: community.dockerThen install with:
ansible-galaxy install -r requirements.ymlAlternatively, you can clone the repository directly:
# Create a roles directory if it doesn't exist
mkdir -p ~/.ansible/roles
# Clone the repository
git clone https://github.com/brpaz/ansible-role-swarm.git ~/.ansible/roles/brpaz.swarmRun the Molecule tests:
task testThis role includes the following variables for configuration:
| Variable | Default Value | Description |
|---|---|---|
swarm_advertise_addr |
{{ ansible_default_ipv4.address }} |
IP address to advertise for this node |
swarm_network |
swarm_network |
The name of the default Swarm overlay network to be created |
- community.docker collection
This example sets up a single-node Docker Swarm cluster:
---
- name: Setup Single-Node Docker Swarm Cluster
hosts: swarm_host
become: true
roles:
- role: brpaz.swarmCheck CONTRIBUTING.md for details.
If you find this project helpful and would like to support its development, there are a few ways you can contribute:
Distributed under the MIT License. See LICENSE file for details.
✉️ Email - [email protected]
🖇️ Source code: https://github.com/brpaz/ansible-role-swarm