【发布时间】:2014-02-27 19:22:04
【问题描述】:
我的剧本运行一个角色列表:
roles:
- common
- postgres
- nginx
- supervisord
- { role: deploy_app, app_name: myapp }
- { role: deploy_app, app_name: otherapp }
我还有另一个角色celery,我只想在使用deploy_app 创建名为myapp 的应用程序时运行它。我在想我应该像这样将参数传递给角色:
- { role: deploy_app, app_name: myapp, celery: yes }
然后在我的deploy_app 角色中,我将使用when 条件:
- name: create celery worker for application
<RUN ROLE HERE>
when: '{{ celery }}' == 'yes'
如何有条件地从任务列表中运行角色?
【问题讨论】:
标签: ansible