serversideup.docker_swarm
Hello! We’re Dan and Jay. We are a two-person team passionate about open-source projects. We started Server Side Up to share what we learn.
You can find us at:
- 📖 Blog - Get the latest guides and free courses on web and mobile development.
- 🙋 Community - Get friendly help from our community members.
- 🤵♂️ Get Professional Help - Get guaranteed responses by the next business day.
- 💻 GitHub - Check out our other open-source projects.
- 📫 Newsletter - Get quality content directly to your inbox without algorithms.
- 🐥 Twitter - You can also follow Dan and Jay.
- ❤️ Sponsor Us - Consider sponsoring us so we can create more helpful resources.
Our Sponsors
All our software is free and open for everyone. We couldn’t do this without financial support from our sponsors.
Individual Supporters


Docker Swarm Ansible Role
This role makes it easy to deploy and manage Docker Swarm servers. It was inspired by Jeff Geerling but has been expanded for Docker Swarm. Please support his great work!
Requirements
Currently, this project supports only Ubuntu 22.04. You can use any host, but you need an SSH connection to a user with sudo
privileges.
Role Variables
You can find all the variables organized and documented in defaults/main.yml
. You can change any variable as needed.
---
# Edition can be either 'ce' (Community Edition) or 'ee' (Enterprise Edition).
docker_edition: 'ce'
# Docker repository URL.
docker_repo_url: https://download.docker.com/linux
# Used only for Debian/Ubuntu. Change 'stable' to 'nightly' if necessary.
docker_apt_release_channel: stable
docker_apt_arch: "{{ 'arm64' if ansible_architecture == 'aarch64' else 'amd64' }}"
docker_apt_repository: "deb [arch={{ docker_apt_arch }} signed-by=/etc/apt/trusted.gpg.d/docker.asc] {{ docker_repo_url }}/{{ ansible_distribution | lower }} {{ ansible_distribution_release }} {{ docker_apt_release_channel }}"
docker_apt_ignore_key_error: true
docker_apt_gpg_key: "{{ docker_repo_url }}/{{ ansible_distribution | lower }}/gpg"
docker_apt_gpg_key_checksum: "sha256:1500c1f56fa9e26b9b8f42452a553675796ade0807cdce11975eb98170b3a570"
# Docker user configuration.
docker_user:
username: deploy
uid: 9999
group: deploy
secondary_groups: "docker"
gid: 9999
# Uncomment to add authorized SSH keys for the docker user.
# authorized_ssh_keys:
# - "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIKNJGtd7a4DBHsQi7HGrC5xz0eAEFHZ3Ogh3FEFI2345 fake@key"
# - "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIFRfXxUZ8q9vHRcQZ6tLb0KwGHu8xjQHfYopZKLmnopQ anotherfake@key"
Dependencies
See requirements.yml
for a list of all dependencies.
To install all dependencies, run:
ansible-galaxy install -r requirements.yml
Example Playbook
Here’s an example of how to use this role, including variables passed in as parameters:
- hosts: servers
roles:
- role: serversideup.docker_swarm
ansible-galaxy install serversideup.docker_swarm