Allo the file fact scanner to take a list of paths instead of just one path

This commit is contained in:
Matthew Jones
2015-06-03 11:36:25 -04:00
parent b1a8d2ce3c
commit d76ee309c6
2 changed files with 54 additions and 53 deletions

View File

@@ -6,7 +6,7 @@
- scan_packages: - scan_packages:
- scan_services: - scan_services:
- scan_files: - scan_files:
path: '{{ scan_file_path }}' paths: '{{ scan_file_paths }}'
get_checksum: '{{ scan_use_checksum }}' get_checksum: '{{ scan_use_checksum }}'
recursive: '{{ scan_use_recursive }}' recursive: '{{ scan_use_recursive }}'
when: scan_file_path is defined when: scan_file_paths is defined

View File

@@ -101,11 +101,12 @@ EXAMPLES = '''
def main(): def main():
module = AnsibleModule( module = AnsibleModule(
argument_spec = dict(path=dict(required=True), argument_spec = dict(paths=dict(required=True, type='list'),
recursive=dict(required=False, default='no', type='bool'), recursive=dict(required=False, default='no', type='bool'),
get_checksum=dict(required=False, default='no', type='bool'))) get_checksum=dict(required=False, default='no', type='bool')))
files = [] files = []
path = module.params.get('path') paths = module.params.get('paths')
for path in paths:
path = os.path.expanduser(path) path = os.path.expanduser(path)
if not os.path.exists(path) or not os.path.isdir(path): if not os.path.exists(path) or not os.path.isdir(path):
module.fail_json(msg = "Given path must exist and be a directory") module.fail_json(msg = "Given path must exist and be a directory")