Hi all, I have a Playbook which is used to push template configuration to the router, It work fine if I run command ansible-playbook playbook_name.yml But now I don't want call Playbook manually, I want to creat a file (such as pb.run) and then use it to call playbook. How I can do it? Please help me, thanks!
Vào 06:37:52 UTC+7 Chủ Nhật, ngày 24 tháng 2 năm 2013, Michael DeHaan đã viết: > > Probably the best example of running a playbook via Python code is > actually /usr/bin/ansible-playbook itself, though it uses nearly all > of the flags. > > https://github.com/ansible/ansible/blob/devel/bin/ansible-playbook > > Anything referenced there either comes from command line flags or is > constructed further up in that file. > > Hope that helps! > > > > On Sat, Feb 23, 2013 at 6:24 PM, Kyle Heath <[email protected] > <javascript:>> wrote: > > I'm new to Ansible... I would like to create a library of playbooks and > then > > use ansible's python api to run the playbooks and get the result from a > > larger python script. > > > > I see there is an example of how to use the ansible.runner.Runner() from > > python, but that seems to be useful for running modules. I would like > to > > run a playbook from a yml file (specifying the host, and private_key > > parameters directly from python). I found the playbooks.Playbook() > python > > class, but the constructor requires several parameters which I am not > sure > > how to construct... callbacks... runner callbacks... etc > > > > Any pointers or any examples of how to use the python API? > > > > Cheers, > > Kyle > > > > -- > > You received this message because you are subscribed to the Google > Groups > > "Ansible Project" group. > > To unsubscribe from this group and stop receiving emails from it, send > an > > email to [email protected] <javascript:>. > > For more options, visit https://groups.google.com/groups/opt_out. > > > > > -- You received this message because you are subscribed to the Google Groups "Ansible Project" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/3710ce2d-1be0-4652-9d5a-1e9df92010c3%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
