Thanks to visit codestin.com
Credit goes to github.com

Skip to content

brpaz/ansible-role-swarm

Repository files navigation

Ansible Docker Swarm Role

A simple Ansible role to set up a single-node Docker Swarm cluster

Requirements

  • Ansible 2.10+
  • Docker

Installation

Using Ansible Galaxy

You can install this role directly from Ansible Galaxy:

ansible-galaxy install brpaz.swarm

Using requirements.yml

For 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.docker

Then install with:

ansible-galaxy install -r requirements.yml

Manual Installation

Alternatively, 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.swarm

Testing

Molecule Testing

Run the Molecule tests:

task test

Role Variables

This 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

Dependencies

  • community.docker collection

Example Playbook

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.swarm

Contributing

Check CONTRIBUTING.md for details.

🫶 Support

If you find this project helpful and would like to support its development, there are a few ways you can contribute:

Sponsor me on GitHub

Buy Me A Coffee

📃 License

Distributed under the MIT License. See LICENSE file for details.

📩 Contact

✉️ Email - [email protected]

🖇️ Source code: https://github.com/brpaz/ansible-role-swarm

About

An Ansible role to bootstrap a simple Docker Swarm cluster

Resources

License

Contributing

Stars

Watchers

Forks

Packages

No packages published

Contributors 2

  •  
  •