diff --git a/tasks/setup-swarm-labels.yml b/tasks/setup-swarm-labels.yml index 881b925..b609b8b 100644 --- a/tasks/setup-swarm-labels.yml +++ b/tasks/setup-swarm-labels.yml @@ -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: