Using any (ASCII) character for commenting in Ansible comment filter

I needed to have comment in a PHP ini file where the prefix for commenting is ; , This is something I didn’t find in the documentation for the comment filter, so I looked in the code for the comment (in my case: /usr/lib/python2.7/site-packages/ansible/plugins/filter/core.py )

And found the decoration keywork (which dose not mention in the documentations), so I tried using it like this,
{{ ansible_managed | comment(decoration='; ') }}
And it works 🙂

 

Related Post

Leave a Reply

Your email address will not be published. Required fields are marked *