def METHOD_NAME(self, task_name, jinja_template):
    inventory = 'lab'
    ansible_root = '../ansible/'
    playbook_name = 'accton_os_cmd_exec.yml'
    jinja_name = 'accton_os_cmd_exec.j2'
    playbook_text = '- hosts: {}\n'.format(self.hostname) + \
                    '  gather_facts: no\n\n' + \
                    '  tasks:\n' + \
                    '  - conn_graph_facts: host={{ inventory_hostname }}\n' + \
                    '    delegate_to: localhost\n' + \
                    '    tags: always\n\n' + \
                    '  - set_fact:\n' + \
                    '      peer_host: \"{{device_info[inventory_hostname][\'mgmtip\']}}\"\n' + \
                    '      peer_hwsku: \"{{device_info[inventory_hostname][\'HwSku\']}}\"\n\n' + \
                    '  - name: {}\n'.format(task_name) + \
                    '    action: apswitch template={}\n'.format(jinja_name) + \
                    '    args:\n' + \
                    '      host: \"{{peer_host}}\"\n' + \
                    '      login: \"{{switch_login[hwsku_map[peer_hwsku]]}}\"\n' + \
                    '      os_name: {}\n'.format('aos') + \
                    '    connection: switch\n'
    with open(ansible_root + jinja_name, 'w') as f:
        f.write(jinja_template)
    with open(ansible_root + playbook_name, 'w') as f:
        f.write(playbook_text)
    res = self.exec_template(ansible_root, playbook_name, inventory)
    os.system("rm {}".format(ansible_root + jinja_name))
    os.system("rm {}".format(ansible_root + playbook_name))
    return res