Configures a Docker Swarm cluster.
docker
installed on hosts
# Port docker swarm will communicate on
docker_swarm_port: 2377
# Network interface to use
docker_swarm_network_interface: "eth0"
When starting a docker swarm the following ports must be open:
- 2377/tcp (
docker_swarm_port
) - 7946/tcp
- 7946/udp
- 4789/udp
- 50/esp
This information can be found on docker's documentation.
This role configures hosts in group docker_swarm_manager
to be manager nodes and hosts in group docker_swarm_worker
to be worker nodes:
[docker_swarm_manager]
tests_server1_1
tests_server3_1
[docker_swarm_worker]
tests_server2_1
tests_server4_1
Swarm labels can be added to nodes by setting the docker_swarm_label
to a list of strings:
...
[docker_swarm_manager]
tests_server1_1 docker_swarm_labels="{'db':'true'}"
tests_server3_1 docker_swarm_labels="{'dog':'big'}"
[docker_swarm_worker]
tests_server2_1 docker_swarm_labels="{'docker':'17.12', 'type':'queue'}"
tests_server4_1
...
This project uses ansible-docker-runner to run tests in a docker container.
- Start Container for testing:
make setup_test
- Run Tests
make test
- Stop up container
make clean_up
MIT