The List manipulation doesnt work

Hi Ansible Gurus,

I have created a list and from that list i want to prepare some customise list as per my need.
But when i execute my playbook i get at last step when i want to see my customised list i get an error .
Can someone guide me where i am doing wrong.

TASK [Display Lists] ************************************************************************************************************************************************************************
ok: [localhost] => (item={ best_fav }}) => {
“msg”: “{ best_fav }}”
}
ok: [localhost] => (item=[AnsibleUndefined]) => {
“msg”: “[AnsibleUndefined]”
}
ok: [localhost] => (item=[AnsibleUndefined]) => {
“msg”: “[AnsibleUndefined]”
}

My playbook is as follows

Kindly Help me on this as i am stuck

> - hosts: localhost
> tasks:
> - name: Create a list
> set_fact:
> some_value:
> - avenger
> - mk11
> - witcher
> - gow
> - saintsrow
>
> - debug:
> msg: "{{ some_value }}"
>
> - name: Print avenger
> set_fact:
> avenger_record: "{{ item }}"
> when: item is defined and item == 'avenger'
> with_items: "{{ somevalue }}"

The name of the variable is 'some_value'. Correct other references as well

          with_items: "{{ some_value }}"

> [...]
> - name: Display Lists
> debug:
> msg: "{{ item }}"
> with_items:
> - "{ best_fav }}"
> - "{{ good_fav }}"
> - "{{ better_fav }}"
> when: item != None

Balance the braces. Correct

          with_items:
            - "{{ best_fav }}"

Notes:

* Use 'loop' instead of 'with_items'. See
  https://docs.ansible.com/ansible/latest/porting_guides/porting_guide_2.5.html#migrating-from-with-x-to-loop
* The variable 'item' is always defined in a loop (when not explicitly
  renamed). The condition 'when: item is defined ...' is redundant. It is
  enough to test e.g. 'when: item == "avenger"'
* The condition 'when: item != None' in the last task is also redundant. An
  iteration will be skipped if the list is empty.
* Give a try to 'ansible-lint' and 'yamllint'

HTH,

  -vlado