Skip to content

Commit

Permalink
Also check that swarm_labels variable is defined
Browse files Browse the repository at this point in the history
when removing labels as they could have been added outside this role,
thus making swarm_labels undefined.

Fixes upstream issue atosatto#96.
  • Loading branch information
juanluisbaptiste committed May 20, 2021
1 parent 53bebd1 commit e2b103e
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion tasks/setup-swarm-labels.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
- name: Remove labels from swarm node.
command: docker node update --label-rm {{ item }} {{ ansible_hostname }}
with_items: "{{ docker_swarm_labels.stdout_lines }}"
when: item not in swarm_labels
when: swarm_labels is defined and item not in swarm_labels
delegate_to: "{{ groups['docker_swarm_manager'][0] }}"
delegate_facts: true
tags:
Expand Down

0 comments on commit e2b103e

Please sign in to comment.