【发布时间】:2017-01-31 14:27:09
【问题描述】:
我正在尝试编写一个设置一些 docker 容器然后在它们上运行角色的 ansible playbook:
- hosts: localhost
gather_facts: no
vars:
- docker_test_hosts:
- container_name: 'test_precise'
image_name: 'ubuntu'
image_tag: '12.04'
- container_name: 'test_trusty'
image_name: 'ubuntu'
image_tag: '14.04'
# "Registry returned more than one result for ubuntu:16.04"
#- container_name: 'xenial'
#- image_name: 'ubuntu'
#- image_tag: '16.04'
tasks:
- pip:
name: docker-py
# >= 1.7.0
# using 1.9.0 due to https://github.com/ansible/ansible/issues/17495
version: 1.9.0
state: present
- docker_container:
name: '{{item.container_name}}'
image: '{{item.image_name}}:{{item.image_tag}}'
pull: yes
with_items: '{{docker_test_hosts}}'
- add_host:
name: '{{item.container_name}}'
hostname: '{{item.container_name}}'
ansible_host: '{{item.container_name}}'
ansible_connection: docker
ansible_user: root
groups: docker
with_items: '{{docker_test_hosts}}'
- hosts: docker
tasks:
- debug:
msg: 'hello'
第二局一直失败:
播放 [本地主机]
[...]
任务 [add_host] 更改:[localhost] => (item={u'image_tag': u'12.04', u'image_name': u'ubuntu', u'container_name': u'test_precise'}) 更改:[localhost] => (item={u'image_tag': u'14.04', u'image_name': u'ubuntu', u'container_name': u'test_trusty'})
播放 [泊坞窗]
任务 [设置] 致命:[test_precise]:无法访问! => {"changed": false, "msg": "身份验证或权限失败。在某些情况下,您可能已经能够进行身份验证并且没有远程目录的权限。考虑更改 ansible.cfg 中的远程临时路径到以 \"/tmp\" 为根的路径。失败的命令是:( umask 77 && mkdir -p \"
echo $HOME/.ansible/tmp/ansible/tmp-1474479086.86-239783828445202\" && echo ansible-tmp-1474479086.86-239783828445202=\"echo $HOME/.ansible/tmp/ansible-tmp-1474479086.86-239783828445202\" ),退出结果为 1", "unreachable": true}[...]
有什么想法吗?
码头工人 1.11.2 可靠的 2.1.1.0 蟒蛇2.7.12 Linux Mint 18 莎拉
【问题讨论】:
-
您是否在任何地方设置自定义
TMP或TMPDIR环境变量? -
目前我没有。