ansible - ansible 中的 apt 模块产生“无法锁定 apt 以进行独占操作”
问题描述
我有一本剧本,它一次为本地主机运行相同的角色,一次为两个远程主机运行。
- hosts: remote
connection: local
become: yes
roles:
- installBasicDeb
除了单个任务外,该角色为空:
- name: check that basics packages are present
apt:
name:
- apt-transport-https
- software-properties-common
- members
- filezilla
- net-tools
state: present
update_cache: true
become: true
register: apt_output
- debug: var=apt_output
该剧本与sudo ansible-playbook -b -i ./hosts install2_playbook.yml
(我也尝试过--ask-become-pass
)一起运行,任务成功两次,一次失败,并出现“无法锁定 apt 以进行独占操作”。
我可以ssh
在两台远程主机上,使用sudo
(使用相同的密码)并执行apt update
命令。我没有看到另一个 apt 作业正在运行(计算机是一个几个小时..)。
失败的主机是(ARM aarch64)ubuntu 20.10,suceedng 主机是 Debian 10 安装。这是否解释了差异?
我必须改变什么才能使所有主机都成功?我是anisble的新用户...谢谢您的帮助!
解决方案
推荐阅读
- cross-platform - 什么文件格式可以跨windows、linux和mac执行
- javascript - 在 JS 中循环遍历数组并在引导程序中为 HTML 提要生成帖子?
- vb.net - 在 Windows 资源管理器中,“日期”和“获取日期”给出实际拍摄照片或视频的日期。如何在 vb.net 中轻松访问它?
- php - Laravel 油门不起作用
- java - Spring:@Value 与其他类中的 lombok
- google-apps-script - Google 幻灯片中的自定义菜单
- node.js - Mocha 测试并需要缓存问题
- html - Doxygen 包含 css 到 htmlinclude 文件
- java - 通过 JAVA 运行 GDB LINUX 命令
- java - 地图
给空