From f6a08ce1ba193e8adbae98d00b3702391d13433b Mon Sep 17 00:00:00 2001 From: James Cammarata Date: Thu, 23 Jul 2015 16:57:40 -0400 Subject: [PATCH] Adding a note about chaining filters after default(omit) Fixes #10164 --- docsite/rst/playbooks_filters.rst | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/docsite/rst/playbooks_filters.rst b/docsite/rst/playbooks_filters.rst index 5be04e0f09f..2f9e83c288f 100644 --- a/docsite/rst/playbooks_filters.rst +++ b/docsite/rst/playbooks_filters.rst @@ -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: