abspath(path) converts path to an absolute path. Relative paths are resolved from the playbook’s working directory.
Signature
Example
Ensure that a volume mount path in a Docker run command is always absolute, regardless of whereerrand is invoked from:
./data becomes something like /home/user/project/data, which is required by docker run.
Notes
abspathresolves the path relative to the effective working directory at evaluation time.- If
pathis already absolute, it is returned cleaned but otherwise unchanged.