Skip to content
This repository has been archived by the owner on Feb 20, 2024. It is now read-only.

Commit

Permalink
Adding a note about chaining filters after default(omit)
Browse files Browse the repository at this point in the history
  • Loading branch information
jimi-c committed Jul 23, 2015
1 parent 3bf1edf commit f6a08ce
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions docsite/rst/playbooks_filters.rst
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,10 @@ As of Ansible 1.8, it is possible to use the default filter to omit variables an
For the first two files in the list, the default mode will be determined by the umask of the system as the `mode=`
parameter will not be sent to the file module while the final file will receive the `mode=0444` option.

.. note:: If you are "chaining" additional filters after the `default(omit)` filter, you should instead do something like this:
`"{{ foo | default(None) | some_filter or omit }}"`. In this example, the default `None` (python null) value will cause the
later filters to fail, which will trigger the `or omit` portion of the logic. Using omit in this manner is very specific to
the later filters you're chaining though, so be prepared for some trial and error if you do this.

.. _list_filters:

Expand Down

0 comments on commit f6a08ce

Please sign in to comment.