以下是我的代码:
- hosts: 11RRvEPG01
gather_facts: no
vars_files:
- /etc/ansible/epg/epg_command.yml
vars:
- output: []
tasks:
- name: run epg command
eric_eccli_command:
commands: "{{item}}"
with_items: "{{epg_command}}"
register: command_output
- name: show execution output
include_tasks:
file: /etc/ansible/epg_check_output.yml
var:
output: "{{item.stdout|last}}"
with_items: "{{command_output.results}}"
我在运行时收到错误消息:
错误!冲突的操作语句:var,include_tasks
答案 0 :(得分:0)
正确的语法是
- name: show execution output
include_tasks:
file: /etc/ansible/epg_check_output.yml
vars:
output: "{{ item.stdout|last }}"
with_items: "{{ command_output.results }}"
(将{{1}的var
改为vars
)