Ansible 1.9以降のansible.cfgでhostfileを定義すると怒られる
概要
Ansible 2.4.0.0のansible.cfgで、
hostfile = ./hosts
みたいに書いていると、以下のエラーが出力されplaybookを実行できない
[DEPRECATION WARNING]: [defaults]hostfile option, The key is misleading as it can also be a list of hosts, a directory or a list of paths . This feature
will be removed in version 2.8. Deprecation warnings can be disabled by setting deprecation_warnings=False in ansible.cfg.
[WARNING]: Could not match supplied host pattern, ignoring: all
[WARNING]: provided hosts list is empty, only localhost is available
解決策
hostfile = ./hosts
↓
inventory = ./hosts
参考
1.9から変更されている模様
おまけ
hostfile自体は/etc/ansible/hostsに定義されていて、ここに書けばグローバルで使用できるっぽい