【发布时间】:2018-03-29 12:23:31
【问题描述】:
我正在使用 Ansible 2.3.2.0,并且正在调用一个正在运行 4 个不同任务的角色。
当我通过剧本调用角色并指定特定标签时,整个角色和所有任务都在运行。我看到这是 ansible 2.0 之后的一个已知问题,建议的修复是在 include 语句下添加一个静态指令。我试过了,但所有任务仍然运行。 这是剧本中的角色声明...
roles:
- {role: ansible-role-auto-deploy, tags: [ 'ami', 'launch_config', 'asg']}
这里是角色的 main.yml
---
- include: ami.yml
static: yes
tags:
- ami
- include: launch_config.yml
static: yes
tags:
- launch_config
- include: asg.yml
static: yes
tags:
- asg
- include: ami_lc_cleanup.yml
static: yes
tags:
- ami_lc_cleanup
当我使用上面的角色语句运行它时,我希望运行 ami、launch_config 和 asg 任务,但此外,ami_lc_cleanup 任务也正在运行。
所有任务都可以工作,我只是不知道如何限制正在运行的任务。有没有人对如何让它工作(能够通过标签指定任务)有任何建议?
【问题讨论】: