Skip to content

commonpath

Collection Note

This module is part of the ansible.builtin collection. To install the collection, use:

ansible-galaxy collection install ansible.builtin
Added in version 2.15.

Synopsis

  • Returns the longest common path from the given list of paths.

Parameters

Parameter Defaults / Choices Comments
_input
list / elements=path
required
A list of paths.

Examples

# To get the longest common path (for example - '/foo/bar') from the given list of paths
# (for example - ['/foo/bar/foobar','/foo/bar'])
{{ listofpaths | commonpath }}

Return Values

Key Data Type Description Returned
_value path The longest common path from the given list of paths.

Authors

  • Shivam Durgbuns