"读取包标题时出错"使用Ansible yum安装模块时

时间:2016-06-13 18:23:09

标签: yaml ansible

我有一个看起来像这样的ansible脚本,它昨天正常工作 -

- name: Dockerfile
  hosts: localhost
  connection: local
  tasks:
     - name: Install repositories packages
       yum:
         name: "{{ item }}"
         state: present
       with_items:
         - https://centos7.iuscommunity.org/ius-release.rpm
         - http://download.gluster.org/pub/gluster/glusterfs/3.7/3.7.10/CentOS/glusterfs-epel.repo

然而今天早上运行时,我收到以下错误 -

failed: [localhost] (item=[u'https://centos7.iuscommunity.org/ius-release.rpm', u'http://download.gluster.org/pub/gluster/glusterfs/3.7/3.7.10/CentOS/glusterfs-epel.repo']) => {"failed": true, "invocation": {"module_name": "yum"}, "item": ["https://centos7.iuscommunity.org/ius-release.rpm", "http://download.gluster.org/pub/gluster/glusterfs/3.7/3.7.10/CentOS/glusterfs-epel.repo"], "module_stderr": "Traceback (most recent call last):\n  File \"/tmp/ansible_mdVzzz/ansible_module_yum.py\", line 1064, in <module>\n    main()\n  File \"/tmp/ansible_mdVzzz/ansible_module_yum.py\", line 1053, in main\n    disablerepo, disable_gpg_check, exclude, repoquery)\n  File \"/tmp/ansible_mdVzzz/ansible_module_yum.py\", line 969, in ensure\n    res = install(module, pkgs, repoq, yum_basecmd, conf_file, en_repos, dis_repos)\n  File \"/tmp/ansible_mdVzzz/ansible_module_yum.py\", line 595, in install\n    pkg_name = local_name(module, package)\n  File \"/tmp/ansible_mdVzzz/ansible_module_yum.py\", line 492, in local_name\n    header = ts.hdrFromFdno(fd)\n  File \"/usr/lib64/python2.7/site-packages/rpm/transaction.py\", line 160, in hdrFromFdno\n    raise rpm.error(\"error reading package header\")\n_rpm.error: error reading package header\n", "module_stdout": "", "msg": "MODULE FAILURE", "parsed": false}

实际的错误描述是

raise rpm.error(\"error reading package header\")\n_rpm.error: error reading package header\n", "module_stdout": "", "msg": "MODULE FAILURE", "parsed": false}

我有什么打破的吗?或者这更像是gluster RPM的一个问题?

1 个答案:

答案 0 :(得分:1)

你试过这个吗?

     - name: Install repositories packages
       yum:
         name: "{{ item }}"
         state: present
       with_items:
         - https://centos7.iuscommunity.org/ius-release.rpm

     - name: Install the gluster repo
       get_url:
         url: "http://download.gluster.org/pub/gluster/glusterfs/3.7/3.7.10/CentOS/glusterfs-epel.repo" 
         dest: "/etc/yum.repos.d/glusterfs-epel.repo"
         mode: 0644