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 in Ansible by Ruth
202 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 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
34 views
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
39 views
+13 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 26, 2018 in DevOps & Agile by DragonLord999
• 8,380 points
124 views
0 votes
1 answer