Adding comments to files
Theansible.builtin.commentfilter lets you create comments in a file from text in a template, with a variety of comment styles. By default, Ansible uses#to start a comment line and adds a blank comment line above and below your comment text. For example the following:
produces this output:
Ansible offers styles for comments in C (//...), C block
(/*...*/), Erlang (%...) and XML (
):
You can define a custom comment character. This filter:
produces:
You can fully customize the comment style: