def build_napalm_ansible_module_docs(app):
<EOL>status = subprocess.call(<EOL>"<STR_LIT>", stdout=sys.stdout, stderr=sys.stderr<EOL>)<EOL>if status != <NUM_LIT:0>:<EOL><INDENT>print("<STR_LIT>")<EOL>sys.exit(-<NUM_LIT:1>)<EOL><DEDENT>env = Environment(loader=FileSystemLoader("<STR_LIT:.>"))<EOL>modules_dir = "<STR_LIT>"<EOL>module_files = glob("<STR_LIT>".format(modules_dir))<EOL>for module_file in module_files:<EOL><INDENT>with open(module_file, "<STR_LIT:r>") as f:<EOL><INDENT>module = module_file.split("<STR_LIT:/>")[-<NUM_LIT:1>].split("<STR_LIT:.>")[<NUM_LIT:0>]<EOL>data = json.loads(f.read())<EOL>data["<STR_LIT:name>"] = module<EOL><DEDENT>module_dir = "<STR_LIT>".format(module)<EOL>try:<EOL><INDENT>os.stat(module_dir)<EOL><DEDENT>except Exception:<EOL><INDENT>os.mkdir(module_dir)<EOL><DEDENT>template_file = env.get_template("<STR_LIT>")<EOL>rendered_template = template_file.render(**data)<EOL>with open("<STR_LIT>".format(module_dir), "<STR_LIT:w>") as f:<EOL><INDENT>f.write(rendered_template)<EOL><DEDENT><DEDENT>
Create documentation for Ansible modules.