---
- hosts: consul_servers
  tasks:
  - name: get consul wan gossip pool members
    shell: docker exec consul consul members -wan | awk '$4 == "server" {print $2}' | cut -f1 -d":"
    register: result
    changed_when: no

  - set_fact: non_member_count="{{ consul_join_wan.split(' ') | difference(result.stdout_lines | list) | length }}"

  - name: join consul wan gossip pool
    command: docker exec consul consul join -wan {{ consul_join_wan }}
    when: non_member_count != "0"

---
- hosts: consul_servers
  tasks:
  - name: get consul wan gossip pool members
    shell: docker exec consul consul members -wan | awk '$4 == "server" {print $2}' | cut -f1 -d":"
    register: result
    changed_when: no

  - name: set_fact non_member_count 
    set_fact: non_member_count="{{ consul_join_wan.split(' ') | difference(result.stdout_lines | list) | length }}"

  - name: join consul wan gossip pool
    command: docker exec consul consul join -wan {{ consul_join_wan }}
    when: non_member_count != "0"

Add task name for 'set_fact non_member_count'.
Add task name for 'set_fact non_member_count'.