Ansible Yum 模块挂起交易错误

标签 ansible yum

我对 Ansible 很陌生。
我正在尝试遵循有关 Ansible 中角色概念的教程。
我有以下大师手册:

--- # Master Playbook for Webservers
- hosts: apacheweb
  user: test
  sudo: yes
  connection: ssh
  roles:
    - webservers

它指的是具有以下任务/main.yml 的网络服务器角色:
- name: Install Apache Web Server
  yum: pkg=httpd state=latest
  notify: Restart HTTPD

还有一个处理程序/main.yml:
- name: Restart HTTPD
  service: name=httpd state=started

当我执行上面提到的 Master Playbook 时,我收到以下错误:
TASK [webservers : Install Apache Web Server] **********************************
fatal: [test.server.com]: FAILED! => {"changed": false, "failed": true, "msg": "The following packages have pending transactions: httpd-x86_64", "rc": 128, "results": ["The following packages have pending transactions: httpd-x86_64"]}

我无法理解这个错误对应的是什么。根据我的研究,似乎没有任何类似的东西可能表明我使用 Yum 模块的方式存在问题。

注意:Ansible 版本:
ansible 2.2.1.0
  config file = /etc/ansible/ansible.cfg

最佳答案

目标主机上似乎有未完成/待处理的事务。
尝试安装 yum-utils运行包yum-complete-transaction到给出错误的目标主机。

# yum-complete-transaction --cleanup-only

Fixing There are unfinished transactions剩下的更多细节。

yum-complete-transaction is a program which finds incomplete or aborted yum transactions on a system and attempts to complete them. It looks at the transaction-all* and transaction-done* files which can normally be found in /var/lib/yum if a yum transaction aborted in the middle of execution.

If it finds more than one unfinished transaction it will attempt to complete the most recent one first. You can run it more than once to clean up all unfinished transactions.

关于Ansible Yum 模块挂起交易错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42038633/

相关文章:

ssh - 如何以正确的方式将 Ansible playbook 运行到多个服务器?

linux - 导入错误 : No module named cElementTree - Redhat

linux - 无法在 Red Hat 中安装 openJDK 8

Linux - Bash - 获取 $releasever 和 $basearch 值?

ansible - 如何使用 Ansible 复制与 glob 模式匹配的文件

ansible - 如何从环境变量安装多个 ssh 公钥?

ansible - 一个正确的 YAML 文件是否足以用于正确的 ansible 剧本,除了语法错误吗?

kubernetes - Ansible Galaxy 角色安装到特定目录?

linux - 如何在ansible中使用yum模块禁用所有存储库?

linux - 尝试在我的服务器上更新 OpenSSL ... GLIBC 错误