Skip to content

filter plugins

This is the list of filter plugins in the ansible.builtin collection:

Plugin Description
ansible.builtin.abs Return the absolute value of the argument.
ansible.builtin.attr Get an attribute of an object.
ansible.builtin.b64decode Decode a Base64 string
ansible.builtin.b64encode Encode a string as Base64
ansible.builtin.basename get a path's base name
ansible.builtin.batch A filter that batches items.
ansible.builtin.bool coerce some well-known truthy/falsy values to a boolean
ansible.builtin.capitalize Capitalize a value.
ansible.builtin.center Centers the value in a field of a given width.
ansible.builtin.checksum checksum of input data
ansible.builtin.combinations combinations from the elements of a list
ansible.builtin.combine combine two dictionaries
ansible.builtin.comment comment out a string
ansible.builtin.commonpath gets the common path
ansible.builtin.count Return the number of items in a container.
ansible.builtin.d If the value is undefined it will return the passed default value, otherwise the value of the variable.
ansible.builtin.default If the value is undefined it will return the passed default value, otherwise the value of the variable.
ansible.builtin.dict2items Convert a dictionary into an itemized list of dictionaries
ansible.builtin.dictsort Sort a dict and yield.
ansible.builtin.difference the difference of one list from another
ansible.builtin.dirname get a path's directory name
ansible.builtin.e Replace the characters &, <, >, ', and " in the string with HTML-safe sequences.
ansible.builtin.escape Replace the characters &, <, >, ', and " in the string with HTML-safe sequences.
ansible.builtin.expanduser Returns a path with C(~) translation.
ansible.builtin.expandvars expand environment variables
ansible.builtin.extract extract a value based on an index or key
ansible.builtin.fileglob explode a path glob to matching files
ansible.builtin.filesizeformat Format the value like a 'human-readable' file size.
ansible.builtin.first Return the first item of a sequence.
ansible.builtin.flatten flatten lists within a list
ansible.builtin.float Convert the value into a floating point number.
ansible.builtin.forceescape Enforce HTML escaping.
ansible.builtin.format Apply the given values to a printf-style_ format string, like string % values.
ansible.builtin.from_json Convert JSON string into variable structure
ansible.builtin.from_yaml Convert YAML string into variable structure
ansible.builtin.from_yaml_all Convert a series of YAML documents into a variable structure
ansible.builtin.groupby Group a sequence of objects by an attribute using Python's :func:`itertools.
ansible.builtin.hash hash of input data
ansible.builtin.human_readable Make bytes/bits human-readable
ansible.builtin.human_to_bytes Get bytes from string
ansible.builtin.indent Return a copy of the string with each line indented by 4 spaces.
ansible.builtin.int Convert the value into an integer.
ansible.builtin.intersect intersection of lists
ansible.builtin.items Return an iterator over the (key, value) items of a mapping.
ansible.builtin.items2dict Consolidate a list of itemized dictionaries into a dictionary
ansible.builtin.join Return a string which is the concatenation of the strings in the sequence.
ansible.builtin.last Return the last item of a sequence.
ansible.builtin.length Return the number of items in a container.
ansible.builtin.list Convert the value into a list.
ansible.builtin.log log of (math operation)
ansible.builtin.lower Convert a value to lowercase.
ansible.builtin.mandatory make a variable's existence mandatory
ansible.builtin.map Applies a filter on a sequence of objects or looks up an attribute.
ansible.builtin.max Return the largest item from the sequence.
ansible.builtin.md5 MD5 hash of input data
ansible.builtin.min Return the smallest item from the sequence.
ansible.builtin.normpath Normalize a pathname
ansible.builtin.password_hash convert input password into password_hash
ansible.builtin.path_join Join one or more path components
ansible.builtin.permutations permutations from the elements of a list
ansible.builtin.pow power of (math operation)
ansible.builtin.pprint Pretty print a variable.
ansible.builtin.product cartesian product of lists
ansible.builtin.quote shell quoting
ansible.builtin.random random number or list item
ansible.builtin.realpath Turn path into real path
ansible.builtin.regex_escape escape regex chars
ansible.builtin.regex_findall extract all regex matches from string
ansible.builtin.regex_replace replace a string via regex
ansible.builtin.regex_search extract regex match from string
ansible.builtin.reject Filters a sequence of objects by applying a test to each object, and rejecting the objects with the test succeeding.
ansible.builtin.rejectattr Filters a sequence of objects by applying a test to the specified attribute of each object, and rejecting the objects with the test succeeding.
ansible.builtin.rekey_on_member Rekey a list of dicts into a dict using a member
ansible.builtin.relpath Make a path relative
ansible.builtin.replace Return a copy of the value with all occurrences of a substring replaced with a new one.
ansible.builtin.reverse Reverse the object or return an iterator that iterates over it the other way round.
ansible.builtin.root root of (math operation)
ansible.builtin.round Round the number to a given precision.
ansible.builtin.safe Mark the value as safe which means that in an environment with automatic escaping enabled this variable will not be escaped.
ansible.builtin.select Filters a sequence of objects by applying a test to each object, and only selecting the objects with the test succeeding.
ansible.builtin.selectattr Filters a sequence of objects by applying a test to the specified attribute of each object, and only selecting the objects with the test succeeding.
ansible.builtin.sha1 SHA-1 hash of input data
ansible.builtin.shuffle randomize a list
ansible.builtin.slice Slice an iterator and return a list of lists containing those items.
ansible.builtin.sort Sort an iterable using Python's :func:sorted.
ansible.builtin.split split a string into a list
ansible.builtin.splitext split a path into root and file extension
ansible.builtin.strftime date formatting
ansible.builtin.string Convert an object to a string if it isn't already.
ansible.builtin.striptags Strip SGML/XML tags and replace adjacent whitespace by one space.
ansible.builtin.subelements returns a product of a list and its elements
ansible.builtin.sum Returns the sum of a sequence of numbers plus the value of parameter 'start'.
ansible.builtin.symmetric_difference different items from two lists
ansible.builtin.ternary Ternary operation filter
ansible.builtin.title Return a titlecased version of the value.
ansible.builtin.to_datetime Get C(datetime) from string
ansible.builtin.to_json Convert variable to JSON string
ansible.builtin.to_nice_json Convert variable to 'nicely formatted' JSON string
ansible.builtin.to_nice_yaml Convert variable to YAML string
ansible.builtin.to_uuid namespaced UUID generator
ansible.builtin.to_yaml Convert variable to YAML string
ansible.builtin.tojson Serialize an object to a string of JSON, and mark it safe to render in HTML.
ansible.builtin.trim Strip leading and trailing characters, by default whitespace.
ansible.builtin.truncate Return a truncated copy of the string.
ansible.builtin.type_debug show input data type
ansible.builtin.union union of lists
ansible.builtin.unique set of unique items of a list
ansible.builtin.unvault Open an Ansible Vault
ansible.builtin.upper Convert a value to uppercase.
ansible.builtin.urldecode Decode percent-encoded sequences
ansible.builtin.urlencode Quote data for use in a URL path or query using UTF-8.
ansible.builtin.urlize Convert URLs in text into clickable links.
ansible.builtin.urlsplit get components from URL
ansible.builtin.vault vault your secrets
ansible.builtin.win_basename Get a Windows path's base name
ansible.builtin.win_dirname Get a Windows path's directory
ansible.builtin.win_splitdrive Split a Windows path by the drive letter
ansible.builtin.wordcount Count the words in that string.
ansible.builtin.wordwrap Wrap a string to the given width.
ansible.builtin.xmlattr Create an SGML/XML attribute string based on the items in a dict.
ansible.builtin.zip combine list elements
ansible.builtin.zip_longest combine list elements, with filler