An Ansible role for provisioning servers with docker swarm agents.
This role ensures that a docker swarm master instance is running on a host.
Usually used with the emmetog.swarm-master role which installs swarm masters on hosts.
This role requires the
emmetog.docker-compose role since docker-compose is used to start the swarm services.
Also, a respectably recent version of Docker should be already installed on the hosts.
The role assumes that a consul agent is reachable on the same host on port 8500.
You can use the emmetog.consul role to install consul.
This role doesn't need any variables.
First install the role from ansible galaxy:
$ ansible-galaxy install emmetog.swarm-agent
Then use the role in a playbook as follows:
- hosts: swarm_agents roles: - emmetog.swarm-agent
If used with the emmetog.swarm-master role then you might decide to run both in one block like this:
- hosts: swarm_nodes roles: - emmetog.swarm-master - emmetog.swarm-agent
Note: That will run both a swarm master and a swam agent on each node, which may or may not be what you want to do. Add salt to taste.
Made with love by Emmet O'Grady.
I am the founder of NimbleCI which builds Docker containers for feature branch workflow projects in Github.