codeauthor: | Tyler Jones <jonestyler806@gmail.com> |
---|
New in version 2018.3.0.
The Docker Swarm Module is used to manage and create Docker Swarms.
pip install -U docker
More information: https://docker-py.readthedocs.io/en/stable/
salt.modules.swarm.
joinswarm
(remote_addr=<class 'int'>, listen_addr=<class 'int'>, token=<class 'str'>)¶Join a Swarm Worker to the cluster
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'
salt.modules.swarm.
leave_swarm
(force=<class 'bool'>)¶Force the minion to leave the swarm
CLI Example:
salt '*' swarm.leave_swarm force=False
salt.modules.swarm.
node_ls
(server=<class 'str'>)¶Displays Information about Swarm Nodes with passing in the server
CLI Example:
salt '*' swarm.node_ls server=minion1
salt.modules.swarm.
remove_node
(node_id=<class 'str'>, force=<class 'bool'>)¶Remove a node from a swarm and the target needs to be a swarm manager
CLI Example:
salt '*' swarm.remove_node node_id=z4gjbe9rwmqahc2a91snvolm5 force=false
salt.modules.swarm.
remove_service
(service=<class 'str'>)¶Remove Swarm Service
CLI Example:
salt '*' swarm.remove_service service=Test_Service
salt.modules.swarm.
service_create
(image=<class 'str'>, name=<class 'str'>, command=<class 'str'>, hostname=<class 'str'>, replicas=<class 'int'>, target_port=<class 'int'>, published_port=<class 'int'>)¶Create Docker Swarm Service Create
CLI Example:
salt '*' swarm.service_create image=httpd name=Test_Service command=None hostname=salthttpd replicas=6 target_port=80 published_port=80
salt.modules.swarm.
swarm_init
(advertise_addr=<class 'str'>, listen_addr=<class 'int'>, force_new_cluster=<class 'bool'>)¶Initalize Docker on Minion as a Swarm Manager
CLI Example:
salt '*' swarm.swarm_init advertise_addr='192.168.50.10' listen_addr='0.0.0.0' force_new_cluster=False
salt.modules.swarm.
swarm_service_info
(service_name=<class 'str'>)¶Swarm Service Information
CLI Example:
salt '*' swarm.swarm_service_info service_name=Test_Service
salt.modules.swarm.
swarm_tokens
()¶Get the Docker Swarm Manager or Worker join tokens
CLI Example:
salt '*' swarm.swarm_tokens
salt.modules.swarm.
update_node
(availability=<class 'str'>, node_name=<class 'str'>, role=<class 'str'>, node_id=<class 'str'>, version=<class 'int'>)¶Updates docker swarm nodes/needs to target a manager node/minion
CLI Example:
salt '*' docker_util.update_node availability=drain node_name=minion2 role=worker node_id=3k9x7t8m4pel9c0nqr3iajnzp version=19
Docs for previous releases are available on readthedocs.org.
Latest Salt release: 2018.3.3