1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

filetree: Update example and documentation for plugin (#728)

Fixes: #727

Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
This commit is contained in:
Abhijeet Kasurde 2020-08-04 18:30:41 +05:30 committed by GitHub
parent ba115031f6
commit ce48751033
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 24 additions and 20 deletions

View file

@ -68,7 +68,7 @@ EXAMPLES = """
RETURN = """ RETURN = """
_list: _list:
description: description:
- list of composed strings or dictonaries with key and value - list of composed strings or dictionaries with key and value
If a dictionary, fields shows the keys returned depending on query type If a dictionary, fields shows the keys returned depending on query type
contains: contains:
ALL: ALL:

View file

@ -4,7 +4,7 @@
from __future__ import (absolute_import, division, print_function) from __future__ import (absolute_import, division, print_function)
__metaclass__ = type __metaclass__ = type
DOCUMENTATION = ''' DOCUMENTATION = r'''
lookup: filetree lookup: filetree
author: Dag Wieers (@dagwieers) <dag@wieers.com> author: Dag Wieers (@dagwieers) <dag@wieers.com>
short_description: recursively match all files in a directory tree short_description: recursively match all files in a directory tree
@ -19,7 +19,7 @@ options:
required: True required: True
''' '''
EXAMPLES = """ EXAMPLES = r"""
- name: Create directories - name: Create directories
ansible.builtin.file: ansible.builtin.file:
path: /web/{{ item.path }} path: /web/{{ item.path }}
@ -45,46 +45,50 @@ EXAMPLES = """
mode: '{{ item.mode }}' mode: '{{ item.mode }}'
with_filetree: web/ with_filetree: web/
when: item.state == 'link' when: item.state == 'link'
- name: list all files under web/
ansible.builtin.debug:
msg: "{{ lookup('community.general.filetree', 'web/') }}"
""" """
RETURN = """ RETURN = r"""
_raw: _raw:
description: list of dictionaries with file information description: list of dictionaries with file information
contains: contains:
src: src:
description: description:
- full path to file - full path to file.
- not returned when C(item.state) is set to C(directory) - not returned when C(item.state) is set to C(directory).
root: root:
description: allows filtering by original location description: allows filtering by original location.
path: path:
description: contains the relative path to root description: contains the relative path to root.
mode: mode:
description: TODO description: The permissions the resulting file or directory.
state: state:
description: TODO description: TODO
owner: owner:
description: TODO description: Name of the user that owns the file/directory.
group: group:
description: TODO description: Name of the group that owns the file/directory.
seuser: seuser:
description: TODO description: The user part of the SELinux file context.
serole: serole:
description: TODO description: The role part of the SELinux file context.
setype: setype:
description: TODO description: The type part of the SELinux file context.
selevel: selevel:
description: TODO description: The level part of the SELinux file context.
uid: uid:
description: TODO description: Owner ID of the file/directory.
gid: gid:
description: TODO description: Group ID of the file/directory.
size: size:
description: TODO description: Size of the target.
mtime: mtime:
description: TODO description: Time of last modification.
ctime: ctime:
description: TODO description: Time of last metadata update or creation (depends on OS).
""" """
import os import os
import pwd import pwd