ctubbsii commented on a change in pull request #278: Fixes #268: Setup fails
when swarmmanager enabled
URL: https://github.com/apache/fluo-muchos/pull/278#discussion_r320528203
##########
File path: ansible/docker.yml
##########
@@ -48,5 +48,5 @@
changed_when: "'active' not in swarm_status.stdout_lines"
- name: join worker to swarm
shell: >
- docker swarm join --token={{ swarm_token }} {{ manager_ip }}:2377
+ docker swarm leave || true && docker swarm join --token={{
swarm_token_stdout }} {{ manager_ip }}:2377
Review comment:
It seems weird to me that ansible's way of executing shells is to have `set
-e`, since `set +e` is the default shell behavior normally. It seems weird to
me, but I can't find documentation explicitly defining this behavior one way or
another, so I'll take your word for it.
In that context, it does make sense to use the `|| true` variant. However,
you don't need the `&&` in this case, and it's probably better to provide a
message, as in the following multi-line variant (I think multi-line is a bit
more readable):
```yaml
shell: |
docker swarm leave || echo "Already left swarm."
docker swarm join --token={{ swarm_token_stdout }} {{ manager_ip }}:2377
```
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services