feat: Add abspath to collection.
This commit is contained in:
22
plugins/filter/abspath.yml
Normal file
22
plugins/filter/abspath.yml
Normal file
@@ -0,0 +1,22 @@
|
||||
DOCUMENTATION:
|
||||
name: abspath
|
||||
author: Laur Ivan
|
||||
version_added: "1.0"
|
||||
short_description: Make a path absolute
|
||||
positional: _input
|
||||
description:
|
||||
- Converts the given path to a absolute path.
|
||||
options:
|
||||
_input:
|
||||
description: A path.
|
||||
type: str
|
||||
required: true
|
||||
|
||||
EXAMPLES: |
|
||||
# foobar => ../test/me.txt
|
||||
testing: "{{ '~/me.txt' | abspath }}"
|
||||
otherrelpath: "{{ mypath | relpath }}"
|
||||
RETURN:
|
||||
_value:
|
||||
description: The absolute path.
|
||||
type: str
|
||||
9
plugins/filter/files.py
Normal file
9
plugins/filter/files.py
Normal file
@@ -0,0 +1,9 @@
|
||||
from functools import partial
|
||||
from ansible.utils.unicode import unicode_wrap
|
||||
|
||||
class FilterModule(object):
|
||||
''' Ansible file jinja2 filters '''
|
||||
def filters(self):
|
||||
return {
|
||||
'abspath': partial(unicode_wrap, os.path.abspath)
|
||||
}
|
||||
Reference in New Issue
Block a user