【发布时间】:2018-12-17 14:58:47
【问题描述】:
我需要针对一个列表执行多项任务。所以,我创建了任务列表和
将其包含在主要剧本中。
但是,看起来 ansible 没有将任务列表识别为任务列表,而是将其识别为剧本:
错误! 'set_fact' 不是 Play 的有效属性
主要剧本:
---
- name: main playbook
hosts: all
tasks:
- name: subtasks.yaml
include_tasks: subtasks.yaml
loop: "{{ names_list }}"
loop_control:
loop_var: name
任务列表:
---
- name: "create name for the future vm {{ name }}_{{ ansible_date_time.iso8601 }}"
set_fact:
cloned_vm_name: "{{ name }}_{{ ansible_date_time.iso8601 }}"
ansible 版本:2.7.5
操作系统:Ubuntu 16.04.3
【问题讨论】:
标签: loops ansible syntax-error