Fork me on GitHub

开启django ipython调试窗口

python manage.py shell
#导入执行剧本
from ansible_api.player import execplaybook

#导入执行主机清单
inventory=[{'host_name': '192.168.255.181'}]
#导入剧本路径
yaml_path="/django/ansible_api/builtin_playbook/ldap_file_handle_count.yml"
#导入加载变量
extra_vars={'harbor_ip': '192.168.255.181', 'container_name': 'ldap', 'lines': 50, 'ansible_path': '/django/ansible_api/lib'}
#执行剧本
execplaybook(inventory,yaml_path,extra_vars)
posted on 2024-12-24 10:19  anyux  阅读(1)  评论(0编辑  收藏  举报