系统为 OSX。
如果在 playbook 里写 hosts: localhost,不设置 ansible.cfg 和本地的 hosts 文件,就可以正常使用 docker 模块。以下是-vvvv 输出结果:
changed: [localhost] => {
"ansible_facts": {
"docker_containers": [
省略
"msg": "started 1 container, created 1 container.",
"reload_reasons": null,
"summary": {
省略
}
如果在本地 hosts 文件里写明 localhost ansible_connection=local,就会出现如下问题:
"msg": "`docker-py` doesn't seem to be installed, but is required for the Ansible Docker module."