ansible 2.3.0.0 with python version 2.7.5
host_vars:
manager: Tom
asst_managers:
- Gail
- Susan
- Larry
hotels:
hotel1:
address: 1113 Mockingbird ln
rooms: 40
hotel2:
address: 2222 BlueJay Ln
rooms: 20
task
- name: hot hotels
template:
src: hothotels.j2
dest: /abc
with_items: "{{ asst_manager }}"
with_dict: "{{ hotels }}"
**ERROR! duplicate loop in task: items**
template: hothotels.j2
"{{ manager }}"
assistant managers:
{% for asst in asst_managers %}
"{{ asst }}"
{% endfor %}
{% for (key,value) in hotels.iteritems(() %)
{{ item.key }}
address: {{ item.value.address }}
rooms: {{ item.value.address }}
{% endfor % }
如果我在没有“with_items”的情况下运行任务,而模板没有经理和asst经理信息,那么它会运行但是hotel2在文件中两次,而hotel1就是它。
感谢