6
6

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Ansible 2.0以前ではincludeにtagをつけても無視されるので注意

Posted at

はまったのでメモです。

事象

  • 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
$ tree ./
./
├── fuga.yml
├── hoge.yml
├── roles
│   ├── absent_file
│   │   └── tasks
│   │       └── main.yml
│   └── ensure_file
│       ├── files
│       │   └── hoge.txt
│       └── tasks
│           └── main.yml
├── stage
└── site.yml
site.yml
- include: hoge.yml
  tags:
    - hoge

- include: fuga.yml
  tags:
    - fuga
hoge.yml
- hosts: all
  roles:
    - ensure_file
fuga.yml
- hosts: all
  roles:
    - absent_file
roles/absent_file/tasks.yml
- file: path=/root/hoge.txt mode=0644 state=absent
roles/ensure_file/tasks.yml
- copy: dest=/root/hoge.txt src=hoge.txt mode=0644

原因

既知のIssue
https://github.com/ansible/ansible/issues/9862
https://github.com/ansible/ansible/issues/11309

本来はそもそもトップレベルのPlayBookにタグれなかったとのこと。
2.0もしくはそれ以上でサポートされた(る)模様。

diffを見ると、そもそもincludeモジュールにtagを読み込む機能がなかったので足して直してますね。
https://github.com/ansible/ansible/commit/7c1d569a26b2b7a41d6b4bc9f442fbd7f8b8a188

6
6
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
6
6

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?