Working to convert bash scripts to Ansible, I’ve been wrestling with the following ( and having no luck ). It runs perfectly from a shell CLI so the problem appears to be my Ansible syntax.Specifically, the f.write line with the filename in ()'s is being flagged by Ansible as a syntax issue, plesase see below
Write the python out into a script file, then use the script: module to transfer it out and execute it. Far easier than trying to quote it all in yaml/jinja.
Thanks Jesse!! That crossed my mind but I wanted to see if I was unaware of some additional Ansible functionality. But the script method seems the way to go.