Create and manage Docker Swarm.
- Debian 10
- Docker Engine
Passed as is to the docker_swarm module.
Set to present
to create a new single-node cluster or join
an existing cluster.
Passed as is to the docker_swarm module. Optional.
Passed as is to the docker_node module.
Passed as is to the docker_node module. Optional.
A list of inventory hostnames of the manager nodes. Used to update the state of worker nodes.
Passed as is to the docker_swarm module. Used to join new nodes.
List of dictionaries with keys key
, value
, state
. Optional.
# host_vars/node-0.yml
docker_swarm_state: present
docker_swarm_node_role: manager
# host_vars/node-1.yml
docker_swarm_state: join
docker_swarm_node_role: worker
docker_swarm_managers: ["node-0"]
docker_swarm_remote_addrs:
- "{{ hostvars['node-0']['ansible_default_ipv4']['address'] }}"
# host_vars/node-2.yml
docker_swarm_state: join
docker_swarm_node_role: worker
docker_swarm_managers: ["node-0"]
docker_swarm_remote_addrs:
- "{{ hostvars['node-0']['ansible_default_ipv4']['address'] }}"
docker_swarm_node_labels:
label0: value0
label1: value1
label2: value2
docker_swarm_secrets:
- name: secret-name-0
value: secret-value-0
state: present
- name: secret-name-1
value: secret-value-1
state: absent