由于Centos6上的GMP包版本导致的Ansible错误

时间:2014-06-13 17:01:42

标签: centos docker centos6 gmp ansible

我有一个基于CentOS构建图像的Dockerfile(标记:centos6):

FROM centos

RUN rpm -iUvh http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
RUN yum update -y
RUN yum install ansible -y

ADD ./ansible /home/root/ansible

RUN cd /home/root/ansible;ansible-playbook -v -i hosts site.yml

在Docker点击最后一行之前一切正常,然后我收到以下错误:

 [WARNING]: The version of gmp you have installed has a known issue regarding
timing vulnerabilities when used with pycrypto. If possible, you should update
it (ie. yum update gmp).


PLAY [all] ******************************************************************** 

GATHERING FACTS *************************************************************** 
Traceback (most recent call last):
  File "/usr/bin/ansible-playbook", line 317, in <module>
    sys.exit(main(sys.argv[1:]))
  File "/usr/bin/ansible-playbook", line 257, in main
    pb.run()
  File "/usr/lib/python2.6/site-packages/ansible/playbook/__init__.py", line 319, in run
    if not self._run_play(play):
  File "/usr/lib/python2.6/site-packages/ansible/playbook/__init__.py", line 620, in _run_play
    self._do_setup_step(play)
  File "/usr/lib/python2.6/site-packages/ansible/playbook/__init__.py", line 565, in _do_setup_step
    accelerate_port=play.accelerate_port,
  File "/usr/lib/python2.6/site-packages/ansible/runner/__init__.py", line 204, in __init__
    cmd = subprocess.Popen(['ssh','-o','ControlPersist'], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
  File "/usr/lib64/python2.6/subprocess.py", line 642, in __init__
    errread, errwrite)
  File "/usr/lib64/python2.6/subprocess.py", line 1234, in _execute_child
    raise child_exception
OSError: [Errno 2] No such file or directory

Stderr from the command:

    package epel-release-6-8.noarch is already installed

我认为错误的原因是gmp包不是最新的。 GitHub上有一个相关问题:https://github.com/ansible/ansible/issues/6941

但目前似乎没有任何解决方案...... 有任何想法吗 ? 提前谢谢!

我的site.yml剧本:

- hosts: all

  pre_tasks:
    - shell: echo 'hello'

2 个答案:

答案 0 :(得分:2)

确保您要添加到site.yml的目录中存在hosts/home/root/ansible个文件。

旁注,您可以使用WORKDIR

来简化Dockerfile
WORKDIR /home/root/ansible
RUN ansible-playbook -v -i hosts site.yml

答案 1 :(得分:-2)

PyCrypto依赖于GMP,警告告诉你在更新pycrypto后更新它(在你的ansible主机上)。

yum -y update gmp pip install --upgrade PyCrypto