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: [172.31.36.176]

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

TASK: [install packages] ******************************************************
failed: [172.31.36.176] => {"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

172.31.36.176              : ok=2    changed=1    unreachable=0    failed=1

Playbook:

---
- hosts: test
  sudo: yes

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

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

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

Jan 17, 2019 in Ansible by Ruth
2,025 views

1 answer to this question.

0 votes

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

name:apache2 

replace it with 

name=apache
answered Jan 17, 2019 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, 2019 in Ansible by Sri
1,399 views
0 votes
2 answers
0 votes
1 answer
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, 2019 in Ansible by Dee
1,208 views
+15 votes
2 answers

Git management technique when there are multiple customers and need multiple customization?

Consider this - In 'extended' Git-Flow, (Git-Multi-Flow, ...READ MORE

answered Mar 27, 2018 in DevOps & Agile by DragonLord999
• 8,450 points
4,059 views
+2 votes
1 answer
0 votes
1 answer
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP