開啟django ipython調(diào)試窗口
python manage.py shell
#導(dǎo)入執(zhí)行劇本
from ansible_api.player import execplaybook
#導(dǎo)入執(zhí)行主機(jī)清單
inventory=[{'host_name': '192.168.255.181'}]
#導(dǎo)入劇本路徑
yaml_path="/django/ansible_api/builtin_playbook/ldap_file_handle_count.yml"
#導(dǎo)入加載變量
extra_vars={'harbor_ip': '192.168.255.181', 'container_name': 'ldap', 'lines': 50, 'ansible_path': '/django/ansible_api/lib'}
#執(zhí)行劇本
execplaybook(inventory,yaml_path,extra_vars)
浙公網(wǎng)安備 33010602011771號(hào)