1
0
Fork 0
mirror of https://github.com/mmumshad/ansible-playable.git synced 2025-03-09 23:38:54 +00:00

Add helper scripts and copy helper scripts to Ansible host machine prior to execution

This commit is contained in:
Mumshad Mannambeth 2017-06-11 21:20:12 -04:00
parent 24c493a869
commit 4d5eb24980
5 changed files with 658 additions and 19 deletions

15
helpers/dir_tree.py Normal file
View file

@ -0,0 +1,15 @@
import os
import json
def path_to_dict(path):
d = {'name': os.path.basename(path),'path': os.path.abspath(path)}
if os.path.isdir(path):
d['type'] = "directory"
d['children'] = [path_to_dict(os.path.join(path,x)) for x in os.listdir\
(path)]
else:
d['type'] = "file"
filename, d['extension'] = os.path.splitext(path)
return d
print json.dumps(path_to_dict('.'))