包含变量模块指出可以使用JSON文件来加载变量。然而,当我尝试在我的playbook中使用该模块时,我遇到了YAML语法错误。
---
- hosts: my_hosts
- include_vars: out.json
- tasks:
command: hostname
语法错误如下:
错误!'include_vars' 不是 Play 的有效属性
---
- hosts: my_hosts
tasks:
- name: include vars
include_vars: out.json
- name: hostname
command: hostname
tasks
属性有其自己的列表,每个列表项代表另一个任务。