Ansible Blockinfile Module - Failed

@Inderpreet @kodekloud-support3 @mmumshad Task status is showing failed.

Error message: “We tried to run ‘/home/thor/ansible/playbook.yml’ on Jump Server but it failed because of incorrect inventory or playbook”

I have used below command to execute the playbook from /home/thor/ansible directory.
ansible-playbook playbook.yml -i inventory -b


@kodekloud-support3 @Inderpreet
Could you please suggest, why the status is showing as failed.

@kodekloud-support3 please let me know if anyone still looking into it.

@Lalit you need to define become option within playbook so that validation can run accordingly, Otherwise playbook gonna fail.

It means problem from validation end, otherwise playbook working fine. Shouldn’t be the task marked as successful?

UPDATE: tagging @Ayman and @kodekloud-support3 since haven’t received a response from KK support and have put myself in vacation mode after having received this identical task 2 consecutive times…

Hi @Inderpreet,

My task failed for the following reason…

As I’m sure you know, Ansible creates BEGIN/END tags around the around the code it inserts which, by default, are the ‘#’, so I used blockinfile’s ‘marker’ key to create HTML comments instead of shell script comments. In the screenshot below you can see that the curl output reflects the templated text against all 3 app servers…

I don’t want to give away the entire task solution, so I won’t post the screenshot of my complete playbook.yml file here, but I’d be more than happy to send it to you directly if you require more proof to change the task status to Success.