From cd1b144c0ab3a8b14aa63b6f7eab9675e5306a9c Mon Sep 17 00:00:00 2001 From: Cedric Pimenta Date: Tue, 9 Jan 2018 00:07:32 +0100 Subject: [PATCH] Improve documentation about Comment filter (#34539) Include a mention to the decoration option, which allows someone to specify the character comment to be used. --- docs/docsite/rst/playbooks_filters.rst | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/docs/docsite/rst/playbooks_filters.rst b/docs/docsite/rst/playbooks_filters.rst index 4b8eddc0df..623091a609 100644 --- a/docs/docsite/rst/playbooks_filters.rst +++ b/docs/docsite/rst/playbooks_filters.rst @@ -450,7 +450,7 @@ The ``parse_xml`` filter will load the spec file and pass the command output through formatted as JSON. The spec file should be valid formatted YAML. It defines how to parse the XML -output and return JSON data. +output and return JSON data. Below is an example of a valid spec file that will parse the output from the ``show vlan | display xml`` command.:: @@ -505,7 +505,7 @@ value using the same ``show vlan | display xml`` command.:: The value of ``top`` is the XPath relative to the XML root node. In the example XML output given below, the value of ``top`` is ``configuration/vlans/vlan``, -which is an XPath expression relative to the root node (). +which is an XPath expression relative to the root node (). ``configuration`` in the value of ``top`` is the outer most container node, and ``vlan`` is the inner-most container node. @@ -561,7 +561,7 @@ To get a sha512 password hash (random salt):: To get a sha256 password hash with a specific salt:: {{ 'secretpassword'|password_hash('sha256', 'mysecretsalt') }} - + An idempotent method to generate unique hashes per system is to use a salt that is consistent between runs:: {{ 'secretpassword'|password_hash('sha512', 65534|random(seed=inventory_hostname)|string) }} @@ -666,6 +666,17 @@ Similar way can be applied style for C (``//...``), C block {{ "Erlang style" | comment('erlang') }} {{ "XML style" | comment('xml') }} +If you need a specific comment character that is not included by any of the +above, you can customize it with:: + + {{ "My Special Case" | comment(decoration="! ") }} + +producing:: + + ! + ! My Special Case + ! + It is also possible to fully customize the comment style:: {{ "Custom style" | comment('plain', prefix='#######\n#', postfix='#\n#######\n ###\n #') }}