error Command failed with errors on Ansible machine

0 votes

I am using Ansible task in the Azure DevOps release pipeline, when I run the release pipeline it got failed with "command failed with errors on ansible machine" but the all tasks in playbook was executed successfully.

If I uncheck the Fail on STDErr option in ansible task, then the pipeline is not capturing the failed tasks.

Am I missing something? Please advice.

Dec 16, 2020 in Ansible by Vicky
• 120 points
361 views

1 answer to this question.

0 votes

Hi@Vicky,

By default, if one task fails, then the playbook will not run. But in your case, you have avoided that case. That is why your playbook runs successfully. But if you have dependent tasks, then you need to troubleshoot your failed task. If possible paste your playbook and error here.

answered Dec 17, 2020 by MD
• 95,140 points
Hi @MD I have added ignore_errors: yes in some of the tasks in playbook as per our requirement. and if other task's any one task fails  the playbook will not run. please find the attachment of my error log file.

2020-12-16T16:33:25.2807138Z Callback Exception:
2020-12-16T16:33:25.2808504Z   File "/usr/lib/python2.7/site-packages/ansible/executor/task_queue_manager.py", line 333, in send_callback
2020-12-16T16:33:25.2809447Z     method(*new_args, **kwargs)
2020-12-16T16:33:25.2810763Z    File "/usr/lib/python2.7/site-packages/ansible/plugins/callback/__init__.py", line 337, in v2_runner_on_ok
2020-12-16T16:33:25.2811746Z     self.runner_on_ok(host, result._result)
2020-12-16T16:33:25.2813074Z    File "/usr/lib/python2.7/site-packages/ansible/plugins/callback/log_plays.py", line 80, in runner_on_ok
2020-12-16T16:33:25.2815298Z     self.log(host, 'OK', res)
2020-12-16T16:33:25.2817849Z    File "/usr/lib/python2.7/site-packages/ansible/plugins/callback/log_plays.py", line 73, in log
2020-12-16T16:33:25.2818744Z     with open(path, "ab") as fd:
2020-12-16T16:33:25.2819622Z META: ran handlers
2020-12-16T16:33:25.2849150Z
2020-12-16T16:33:25.2850207Z PLAY RECAP *********************************************************************
2020-12-16T16:33:25.2851121Z xx.xx.xx.xxx             : ok=228  changed=130  unreachable=0    failed=0    skipped=59   rescued=0    ignored=1   
2020-12-16T16:33:25.2852304Z localhost                  : ok=99   changed=50   unreachable=0    failed=0    skipped=37   rescued=0    ignored=0   
2020-12-16T16:33:25.2853072Z
2020-12-16T16:33:25.2856549Z Wednesday 16 December 2020  16:33:25 +0000 (0:00:01.424)       0:44:35.259 ****
2020-12-16T16:33:25.2859629Z ===============================================================================
2020-12-16T16:33:25.3709281Z ##[error]Command failed with errors on Ansible machine.
2020-12-16T16:33:25.3729355Z ##[section]Finishing: Run playbook
Hi@vicky,

Can you share your playbook? It is very hard to tell the exact steps without seeing your scripts. But before that check all the connectivity with the ping module.

Related Questions In Ansible

0 votes
1 answer
+1 vote
3 answers
+1 vote
2 answers

Running ansible command on a single server when it is deployed to multiple servers

You can try the run_once attribute: Example from ...READ MORE

answered Jun 13, 2018 in Ansible by DareDev
• 6,890 points
1,050 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 26, 2018 in DevOps & Agile by DragonLord999
• 8,450 points
1,037 views
+2 votes
1 answer
0 votes
1 answer

bash: ansible: command not found. Failed to search for file: Cannot update read-only repo

Hi@akhtar, By default, Ansible is not part of ...READ MORE

answered Jul 28, 2020 in Ansible by MD
• 95,140 points
2,470 views