**失败":true} msg:无法锁定 apt 以进行独占操作致命一死:所有主机都已失败 - 正在中止**



我得到错误

{"** Failed ": true} msg:锁apt失败

FATAL: all hosts has already failed——aborting**

但是我可以成功ssh到远程主机

这是我剧本的内容

- hosts: 172.30.0.12
  roles:
  - java
  - tomcat
    sudo: True
  vars:
    tomcat_version: 7
    java_version: 7
    tomcat_jmxremote_enable: true
    tomcat_jmxremote_port: 10003

请帮我解决这个问题

您需要在系统中使用root来锁定apt或使用apt-命令,因此只需添加:

sudo: yes

到你的任务(我猜sudo: True对角色不起作用)它会起作用

正如上文所说,"您需要使用root来锁定apt,或者在系统中使用apt-命令。"

然而,从ansible 1.9开始,sudo已被弃用。现在需要将becomebecome_user指令添加到剧本中。

- hosts: 127.0.0.1
  become: true
  become_user: root

相关内容

最新更新