【发布时间】:2017-11-23 23:23:38
【问题描述】:
鉴于以下剧本,在处理程序中调用具有虚拟角色 foo 的 include_role 不起作用。 According to the doc:
处理程序是任务列表,与常规任务没有任何不同,由全局唯一名称引用,并由通知程序通知。
但是,在使用 include_role(和 Ansible 2.4.1)时,它似乎不起作用。
是否有任何解决方法或其他语法可以让它运行?
- name: test roles
hosts: localhost
gather_facts: false
tasks:
- debug:
msg: "call handler"
changed_when: true
notify: "bar"
handlers:
- name: "bar handler"
include_role:
name: foo
listen: "bar"
输出:
[WARNING]: Unable to parse /etc/ansible/hosts as an inventory source
[WARNING]: No inventory was parsed, only implicit localhost is available
[WARNING]: Could not match supplied host pattern, ignoring: all
[WARNING]: provided hosts list is empty, only localhost is available
[WARNING]: Ignoring invalid attribute: listen
PLAYBOOK: playbook.yml *****************************************************************************
1 plays in playbook.yml
PLAY [test roles] *****************************************************************************
ERROR! Unexpected Exception, this is probably a bug: 'IncludeRole' object has no attribute 'listen'
【问题讨论】:
标签: ansible