Ansible loop not execute if same value

Viewed 35

can i know in an Ansible loop is there a way not to execute repeated statement . Below is my code

vars.yml

type_of_fruit:
  - "lemon"
  - "orange"
  - "orange"
  - "pineapple"

main.yml

- name: Type of frutis
  debug:
    msg: "{{ item }}"
  loop: "{{ type_of_fruit }}"

Expected

"lemon"
"orange"
"pineapple"
1 Answers

Filter the items, e.q.

    loop: "{{ type_of_fruit|unique }}"
Related