Tyler Jones <jonestyler806@gmail.com>
New in version 2018.3.0.
The Docker Swarm Module is used to manage and create Docker Swarms.
Docker installed on the host
Docker python sdk >= 2.5.1
pip install -U docker
More information: https://docker-py.readthedocs.io/en/stable/
Join a Swarm Worker to the cluster
The manager node you want to connect to for the swarm
Listen address used for inter-manager communication if the node gets promoted to manager, as well as determining the networking interface used for the VXLAN Tunnel Endpoint (VTEP)
Either the manager join token or the worker join token.
You can get the worker or manager token via salt '*' swarm.swarm_tokens
CLI Example:
salt '*' swarm.joinswarm remote_addr=192.168.50.10 listen_addr='0.0.0.0' token='SWMTKN-1-64tux2g0701r84ofq93zppcih0pe081akq45owe9ts61f30x4t-06trjugdu7x2z47j938s54il'
Force the minion to leave the swarm
Will force the minion/worker/manager to leave the swarm
CLI Example:
salt '*' swarm.leave_swarm force=False
Displays Information about Swarm Nodes with passing in the server
The minion/server name
CLI Example:
salt '*' swarm.node_ls server=minion1
Remove a node from a swarm and the target needs to be a swarm manager
The node id from the return of swarm.node_ls
Forcefully remove the node/minion from the service
CLI Example:
salt '*' swarm.remove_node node_id=z4gjbe9rwmqahc2a91snvolm5 force=false
Remove Swarm Service
The name of the service
CLI Example:
salt '*' swarm.remove_service service=Test_Service
Create Docker Swarm Service Create
The docker image
Is the service name
The docker command to run in the container at launch
The hostname of the containers
How many replicas you want running in the swarm
The target port on the container
port that's published on the host/os
CLI Example:
salt '*' swarm.service_create image=httpd name=Test_Service command=None hostname=salthttpd replicas=6 target_port=80 published_port=80
Initialize Docker on Minion as a Swarm Manager
The ip of the manager
Listen address used for inter-manager communication, as well as determining the networking interface used for the VXLAN Tunnel Endpoint (VTEP). This can either be an address/port combination in the form 192.168.1.1:4567, or an interface followed by a port number, like eth0:4567
Force a new cluster if True is passed
CLI Example:
salt '*' swarm.swarm_init advertise_addr='192.168.50.10' listen_addr='0.0.0.0' force_new_cluster=False
Swarm Service Information
The name of the service that you want information on about the service
CLI Example:
salt '*' swarm.swarm_service_info service_name=Test_Service
Get the Docker Swarm Manager or Worker join tokens
CLI Example:
salt '*' swarm.swarm_tokens
Updates docker swarm nodes/needs to target a manager node/minion
Drain or Active
minion/node
role of manager or worker
The Id and that can be obtained via swarm.node_ls
Is obtained by swarm.node_ls
CLI Example:
salt '*' swarm.update_node availability=drain node_name=minion2 role=worker node_id=3k9x7t8m4pel9c0nqr3iajnzp version=19