user5368329
user5368329

Reputation:

**failed": true} msg: Failed to lock apt for exclusive operationFATAL: all hosts have already failed -- aborting**

I get the error

{"**failed": true} msg: Failed to lock apt for exclusive operation

FATAL: all hosts have already failed -- aborting**

But I can successfully ssh into the remote host

This is the content of my playbook

- 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

Kindly help me figure this out

Upvotes: 1

Views: 4626

Answers (2)

chishaku
chishaku

Reputation: 4643

As tchap said, "You need to use root to lock apt or use apt-commands in your system."

However, from ansible 1.9, sudo has been deprecated. You now need to add the become and become_user directives to your playbook.

- hosts: 127.0.0.1
  become: true
  become_user: root

Upvotes: 2

tchap
tchap

Reputation: 3432

You need to use root to lock apt or use apt-commands in your system, so just add :

sudo: yes

to your task (and I guess sudo: True on the role does not work) and it will work.

Upvotes: 2

Related Questions