我试图连接到我的本地码头引擎运行在OSX (m1芯片),以创建一个动态库存。我已经用下面的配置创建了一个主机文件,确保docker_containers
模块安装得很好。
plugin: community.docker.docker_containers
docker_host: "unix://Users/ME/.docker/run/docker-cli-api.sock"
然后我运行ansible-inventory --graph -i ./hosts/hosts-docker-local.yaml
。
但我得到了以下错误:
[WARNING]: * Failed to parse /Users/ME/Projects/ansible-test/hosts/hosts-docker-local.yaml with auto plugin: inventory source '/Users/ME/Projects/ansible-test/hosts/hosts-docker-local.yaml' could not be
verified by inventory plugin 'community.docker.docker_containers'
[WARNING]: * Failed to parse /Users/ME/Projects/ansible-test/hosts/hosts-docker-local.yaml with yaml plugin: Plugin configuration YAML file, not YAML inventory
[WARNING]: * Failed to parse /Users/ME/Projects/ansible-test/hosts/hosts-docker-local.yaml with ini plugin: Invalid host pattern 'plugin:' supplied, ending in ':' is not allowed, this character is reserved to
provide a port.
[WARNING]: Unable to parse /Users/ME/Projects/ansible-test/hosts/hosts-docker-local.yaml as an inventory source
[WARNING]: No inventory was parsed, only implicit localhost is available
@all:
|--@ungrouped:
我试过了
ansible-doc -t inventory -l | grep docker
community.docker.docker_containers Ansible dynamic inv...
community.docker.docker_machine Docker Machine inve...
community.docker.docker_swarm Ansible dynamic inv...
但是如果我这么做的话,ansible localhost -i ./hosts/hosts-docker-local.yaml -m community.docker.docker_containers
它在抱怨
localhost | FAILED! => {
"msg": "The module community.docker.docker_containers was not found in configured module paths"
}
maybe something wrong with my module path, something wierd with OSX? (I installed Ansible with brew)
发布于 2022-08-11 07:49:35
正如@Zeitounator所指出的,库存文件必须以docker.yaml
结尾。
使用以
docker.[yml|yaml]
结尾的YAML配置文件。
https://stackoverflow.com/questions/73292544
复制相似问题