Ansible shows error: “One or more undefined variables: 'item' is undefined” when using 'with_items'

前端 未结 1 1426
佛祖请我去吃肉
佛祖请我去吃肉 2020-12-02 02:24

I am trying to count the instances inside an elb. This is my Ansible playbook:

- name: Get elb facts
  local_action:
    module: ec2_elb_facts
    name: \"{{         


        
1条回答
  •  有刺的猬
    2020-12-02 03:29

    with_items (and the whole family of with_ loops) is a dictionary key defined in a task, not as a parameter to the action.

    Fix the indentation:

    - debug:
        msg: "Instance: {{ item.instances }}"
      with_items: "{{ elb_facts.elbs }}"
    

    0 讨论(0)
提交回复
热议问题