我一直在寻找测试ansible playbook 的不同方法,并偶然发现了Jeff Geerling的这篇博文。
但是,复制他的确切示例有效,但是,当我复制它但通过 pipenv 安装管理 python(和 ansible)时,我收到以下错误
ERROR! the role 'ansible-test' was not found in /Users/philip/Desktop/ansible-test/tests/roles:/Users/philip/ansible-test:/Users/philip/Desktop/ansible-test/tests
The error appears to have been in '/Users/philip/Desktop/ansible-test/tests/test.yml': line 4, column 7, but may
be elsewhere in the file depending on the exact syntax problem.
The offending line appears to be:
roles:
- ansible-test
^ here
的内容test.yml
是
- hosts: localhost
remote_user: root
roles:
- ansible-test
通过yamlint很好。
ansible.cfg
包含
[defaults]
roles_path = ../../ansible-test
我猜这与在 Virtualenv 中有关,但无法解释。