Ansible playbook giving an error - all hosts have already failed - aborting

0 votes

I'm trying to run Ansible Playbook but it gives me the following error:

PLAY [test] *******************************************************************

GATHERING FACTS ***************************************************************
ok: []

TASK: [Check if Im sudo] ******************************************************
changed: []

TASK: [install packages] ******************************************************
failed: [] => {"failed": true}
msg: this module requires key=value arguments (['name:apache2', 'update_cache=yes', 'state=latest'])

FATAL: all hosts have already failed -- aborting

PLAY RECAP ********************************************************************
           to retry, use: --limit @/root/example.retry              : ok=2    changed=1    unreachable=0    failed=1


- hosts: test
  sudo: yes

    - name: Check if Im sudo
      command: echo $USER

    - name: install packages
      apt: name:apache2 update_cache=yes state=latest
      notify: start apache2

    - name: start apache2
      service: name=apache2 state=started

Jan 17 in Ansible by Ruth

1 answer to this question.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
0 votes

Hey @Ruth, you seem to have made a small mistake in your playbook. on 7th line you've written


replace it with 

answered Jan 17 by Sameer

Related Questions In Ansible

0 votes
1 answer

"FATAL: all hosts have already failed -- aborting" - Ansible error

Hey @Anju, you could change your second ...READ MORE

answered Feb 7 in Ansible by Sri
0 votes
2 answers
0 votes
1 answer

Error saying script is already running - Ansible playbook error

Remove the previous processes before running this ...READ MORE

answered Feb 8 in Ansible by Dee
+13 votes
2 answers
0 votes
1 answer

© 2018 Brain4ce Education Solutions Pvt. Ltd. All rights Reserved.
"PMP®","PMI®", "PMI-ACP®" and "PMBOK®" are registered marks of the Project Management Institute, Inc. MongoDB®, Mongo and the leaf logo are the registered trademarks of MongoDB, Inc.