Skip to content

rremizov/ansible-docker-swarm

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Docker Swarm

Create and manage Docker Swarm.

1   Requirements

  • Debian 10
  • Docker Engine

2   Role Vars

2.1   docker_swarm_state

Passed as is to the docker_swarm module. Set to present to create a new single-node cluster or join an existing cluster.

2.2   docker_swarm_advertise_addr

Passed as is to the docker_swarm module. Optional.

2.3   docker_swarm_node_role

Passed as is to the docker_node module.

2.4   docker_swarm_node_labels

Passed as is to the docker_node module. Optional.

2.5   docker_swarm_managers

A list of inventory hostnames of the manager nodes. Used to update the state of worker nodes.

2.6   docker_swarm_remote_addrs

Passed as is to the docker_swarm module. Used to join new nodes.

2.7   docker_swarm_secrets

List of dictionaries with keys key, value, state. Optional.

3   Example

3.1   Create a new swarm

# 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'] }}"

3.2   Set Node Labels

docker_swarm_node_labels:
  label0: value0
  label1: value1
  label2: value2

3.3   Create secrets

docker_swarm_secrets:
  - name: secret-name-0
    value: secret-value-0
    state: present
  - name: secret-name-1
    value: secret-value-1
    state: absent

About

Ansible Role - Create and manage Docker Swarm cluster.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published