Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Run Module inside another script #158

Closed
compyy opened this issue Mar 14, 2017 · 2 comments
Closed

Run Module inside another script #158

compyy opened this issue Mar 14, 2017 · 2 comments

Comments

@compyy
Copy link

compyy commented Mar 14, 2017

Hello,

I want to run this module inside another script.

In my script user provides, username/password/hostname and command line, my script determines which platform is it and then runs those show commands on that router.

Now i want to format return of those show commands, normally i am using netmiko to get the show commands.

my requirement is, i want to call this module directly inside my script and pass username/password/hostname/show command and want a return as json object.

can i call this module directly inside my script and get result as an object ? if i have to use ansible can i create playbook/inventory file dynamically and get the result.

also the script provided doesnt work on latest ansible 2.1. as ansible runner is not supported.

@itdependsnetworks
Copy link
Contributor

You should be able to following these directions: http://docs.ansible.com/ansible/dev_guide/developing_api.html

You are correct about 2.x no working because of ansible runner, long outstanding issue need to address and integrate with testing.

@compyy
Copy link
Author

compyy commented Apr 4, 2017

I already built something, and working great, you can edit, and made part of your repository.
https://github.com/compyy/BICSapp/blob/master/ansibleapi.py

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants