我想从我的主要任务文件中包含多个变量和任务,但是当我尝试这样做时,我会收到以下错误:
ERROR! unexpected parameter type in action: <class 'ansible.parsing.yaml.objects.AnsibleSequence'>..。
The offending line appears to be:
- name: install and configure [application]
^ here下面是角色中的任务/main.yml文件:
---
- name: install and configure [application]
include_vars:
- dependencies.yml
- directories.yml
- installations.yml
include_tasks:
- pre-setup.yml
- [application-23].yml
- database.yml
- [application-4].yml
- update.yml
- additional-components.yml
- ldap.yml
- test.yml我怀疑我的格式或语法是无效的,但我不确定如何修复它。
此时,我更愿意让我的变量在全球范围内可用。
发布于 2019-11-08 20:53:16
file/free-form参数中的列表,只有一个文件名。dir最终可以读取多个文件。[])吗?它们是列表的标记,可能会被解释为这样。根据我到目前为止所掌握的信息,这是我所能提出的修复当前失败任务的全部建议:
- name: Include variables
include_vars: "{{ item }}"
loop:
- dependencies.yml
- directories.yml
- installations.yml
- name: Play needed tasks in order
include_tasks: "{{ item }}"
loop:
- pre-setup.yml
- application-23.yml
- database.yml
- application-4.yml
- update.yml
- additional-components.yml
- ldap.yml
- test.yml同时,我建议您花一些时间多读一些文档,并可能熟悉角色的概念,因为上面的设计乍一看并不是一个好的设计。
https://stackoverflow.com/questions/58772082
复制相似问题