-
Notifications
You must be signed in to change notification settings - Fork 78
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
using ansible modules to perform docker actions on swarm like init, j…
…oin, leave.
- Loading branch information
marco.tessari
committed
Jun 9, 2021
1 parent
b61d334
commit 81aa5b8
Showing
4 changed files
with
16 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,8 @@ | ||
--- | ||
- name: Add Workers to the Swarm | ||
shell: "docker swarm join --token {{ hostvars['swarm-manager']['worker_token']['stdout'] }} {{ hostvars['swarm-manager']['ansible_default_ipv4']['address'] }}:2377" | ||
docker_swarm: | ||
state: join | ||
advertise_addr: "{{ hostvars['swarm-manager']['ansible_default_ipv4']['address'] }}" | ||
join_token: "{{ hostvars['swarm-manager']['worker_token']['stdout'] }}" | ||
remote_addrs: [ "{{ hostvars['swarm-manager']['ansible_default_ipv4']['address'] }}:2377" ] | ||
tags: swarm |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,6 @@ | ||
--- | ||
- name: Nodes Leaving the Swarm | ||
shell: docker swarm leave -f | ||
docker_swarm: | ||
state: absent | ||
force: true | ||
ignore_errors: true |