在Ansible 2.0之前,即使在include中添加了标签,也会被忽略,请注意
因为我陷入困境,所以做了记录。
事件
-
- includeにtagをつけてもtagが見つからないと言われる
- 要するに無視されている模様
$ ansible-playbook site.yml -i stage --tags hoge
ERROR: tag(s) not found in playbook: hoge. possible values:
环境
- ansible 1.8.4
$ ansible --version
ansible 1.8.4
$ tree ./
./
├── fuga.yml
├── hoge.yml
├── roles
│ ├── absent_file
│ │ └── tasks
│ │ └── main.yml
│ └── ensure_file
│ ├── files
│ │ └── hoge.txt
│ └── tasks
│ └── main.yml
├── stage
└── site.yml
- include: hoge.yml
tags:
- hoge
- include: fuga.yml
tags:
- fuga
- hosts: all
roles:
- ensure_file
- hosts: all
roles:
- absent_file
- file: path=/root/hoge.txt mode=0644 state=absent
- copy: dest=/root/hoge.txt src=hoge.txt mode=0644
The given prompt does not provide any context or information to be paraphrased. Could you please provide more details or a specific sentence that should be paraphrased?
已知的问题
https://github.com/ansible/ansible/issues/9862
https://github.com/ansible/ansible/issues/11309
据说最初根本无法符合顶级PlayBook的要求。
看起来会在2.0或更高版本中提供支持。
查看diff时,最初的include模块没有加载标签的功能,所以进行了添加和修复。
https://github.com/ansible/ansible/commit/7c1d569a26b2b7a41d6b4bc9f442fbd7f8b8a188