<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def build_napalm_ansible_module_docs(app):
 """Create documentation for Ansible modules."""


    # Add script to clone napalm-ansible repo
    status = subprocess.call(
        "./build-ansible-module-docs.sh", stdout=sys.stdout, stderr=sys.stderr
    )

    if status != 0:
        print("Something bad happened when processing the Ansible modules.")
        sys.exit(-1)

    env = Environment(loader=FileSystemLoader("."))

    modules_dir = "./integrations/ansible/modules/source"
    module_files = glob("{0}/*.json".format(modules_dir))
    for module_file in module_files:
        with open(module_file, "r") as f:
            module = module_file.split("/")[-1].split(".")[0]
            data = json.loads(f.read())
            data["name"] = module

        module_dir = "./integrations/ansible/modules/{0}".format(module)

        try:
            os.stat(module_dir)
        except Exception:
            os.mkdir(module_dir)

        template_file = env.get_template("ansible-module.j2")
        rendered_template = template_file.render(**data)

        with open("{0}/index.rst".format(module_dir), "w") as f:
            f.write(rendered_template)