You need proper indentation. The module name and “with_items” must align with the task name. The module args would then outdent by two space to also reflect proper indentation. I used a “debug” vs “lineinfile” to display the item.path and item.line vars and it worked just fine once indentation was corrected.
Exaclty. The error is misleading as you can see my code its straightforward {{ before item.pah. Anyways i m trying what MR. Walter has suggested. Lets c. Thanks by the way for your response.
Thanks a lot. My code and understanding was fine but as you pointed out i somehow couldn’t see space in front. And as we know ansible is not good for error prompt i mislead it.
Thanks again. it worked by add 2 spaces in with_items.
By the way any good tool or editor you can recommend which auto corrects or helps with this??
Also could you please tell me what did u do for troubleshooting is it only , debug or something else so that i ll try to do next time.
Documentation in various sites have a problem with with_items , they all start the item list from the w of the with_items , the indentation is almost incorrect in all majority of the knowledge sites for the list of items with variables.
Except rol sites(that many don’t have access) I don’t think other sites that google hit take the indentation into account for the examples…it’s up to us…