【问题标题】:Troubles with ansible dnf install local rpmansible dnf安装本地rpm的问题
【发布时间】:2018-09-13 09:19:50
【问题描述】:

我想安装本地 rpm 包。 在一种情况下效果很好

    - name: Atom text editor
      dnf:  name="/mnt/temp/Inbox/Soft/Atom editor/atom-1.18.0-x86_64.rpm"
      when: ansible_os_family == "RedHat" and ansible_pkg_mgr == "dnf"
      tags: [packages, work, txt, atom]

对于其他 rpm 会引发错误

    - name: wine-launcher-creator
      dnf:  name="/mnt/warehous/Warehouse/Linux/rpm/wine-launcher-creator-1.0.8-2.noarch.rpm"
      when: ansible_os_family == "RedHat" and ansible_pkg_mgr == "dnf"
      tags: [packages, env, work, wine]

错误

TASK [wine-launcher-creator] ***************************************************
An exception occurred during task execution. To see the full traceback, use -vvv. The error was: dnf.exceptions.Error: <exception str() failed>
fatal: [localhost]: FAILED! => {"changed": false, "failed": true, "module_stderr": "Traceback (most recent call last):\n  File \"/tmp/ansible_TaYSEN/ansible_module_dnf.py\", line 355, in <module>\n    main()\n  File \"/tmp/ansible_TaYSEN/ansible_module_dnf.py\", line 349, in main\n    ensure(module, base, params['state'], params['name'])\n  File \"/tmp/ansible_TaYSEN/ansible_module_dnf.py\", line 304, in ensure\n    base.do_transaction()\n  File \"/usr/lib/python2.7/site-packages/dnf/base.py\", line 591, in do_transaction\n    self._trans_error_summary(errstring))\ndnf.exceptions.Error: <exception str() failed>\n", "module_stdout": "", "msg": "MODULE FAILURE", "rc": 0}

我不明白有什么问题。

权限所有者和 SElinux 属性相同。

我尝试将麻烦的 rpm 移动到与工作相同的文件系统 (/mnt/temp/Inbox/Test/),但没有成功。

【问题讨论】:

  • 当您尝试手动安装软件包时会发生什么?
  • 非常感谢!我试图安装,但没有尝试完成! dnf 返回包冲突。但是西里尔语的错误。当我将 LANG 更改为 C 'env LANG=C ansible-playbook ...' ansible 返回正确的错误。

标签: python ansible dnf


【解决方案1】:

感谢@kfreezy 的好主意。

  1. 默认情况下 LANG=ru_RU.UTF8。 Ansible 2.3.0 无法以西里尔语显示错误。错误消息只是省略了。更改为 LANG=C 以英文显示完整的错误消息。

  2. 最好尝试完整的安装过程。运行时错误可能发生在进程的任何阶段。

UPD:

Ansible 2.4 允许为模块设置区域设置,默认设置

module_lang    = C

所以(1)已经过时了。

【讨论】:

    猜你喜欢
    • 2018-03-15
    • 1970-01-01
    • 1970-01-01
    • 2017-04-16
    • 2020-05-18
    • 2021-09-09
    • 1970-01-01
    • 2015-05-15
    • 2014-06-04
    相关资源
    最近更新 更多