ansible.builtin.normpath filter – Normalize a pathname

Note

This filter plugin is part of ansible-core and included in all Ansible installations. In most cases, you can use the short plugin name normpath. However, we recommend you use the Fully Qualified Collection Name (FQCN) ansible.builtin.normpath for easy linking to the plugin documentation and to avoid conflicting with other collections that may have the same filter plugin name.

New in ansible-core 2.15

Synopsis

  • Returns the normalized pathname by collapsing redundant separators and up-level references.

Input

This describes the input of the filter, the value before | ansible.builtin.normpath.

Parameter

Comments

Input

path / required

A path.

See Also

See also

ansible.builtin.basename filter plugin

get a path’s base name.

Examples

# To get a normalized path (for example - '/foo/bar') from the path (for example - '/foo//bar')
{{ path | normpath }}

Return Value

Key

Description

Return value

path

The normalized path from the path given.

Returned: success

Authors

  • Shivam Durgbuns

Hint

Configuration entries for each entry type have a low to high priority order. For example, a variable that is lower in the list will override a variable that is higher up.