Using bare variables is deprecated

Hi

i try do run my play and i get this “Using bare variables is deprecated” and its work but … not for long

  • name: Gather facts
    action: ec2_facts
    register: ec2_facts
    tags: test

  • name: Add tag to instances
    become: no
    become_user: root
    local_action: ec2_tag resource={{item}} region=us-west-2 state=present
    with_items: ec2_facts.ansible_facts.ansible_ec2_instance_id
    args:
    tags:
    Status: Done
    tags: test

so if i will do what you see i will get this Error and after goole many many docs i found that
with_items:{{ ec2_facts.ansible_facts.ansible_ec2_instance_id }}

if i just add {{}} to the withe_items it will work and i dont understand what i missing ?
what is the 2.0 way to do this ?

Thanks

Due to how yaml parses things, you also need to add quotes:

with_items: “{{ ec2_facts.ansible_facts.ansible_ec2_instance_id }}”