-
-
Save rmetzler/aabad57a7817e55d64a6ab500e0ea17a to your computer and use it in GitHub Desktop.
ara with ansible-runner
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
# Proof of concept ara with ansible-runner | |
# Requires https://github.com/ansible/ansible-runner/issues/219#issuecomment-496191227 | |
import ansible_runner | |
import os | |
from ara.setup import callback_plugins | |
PLAYBOOK = """ | |
- name: Test for ansible-runner | |
hosts: localhost | |
gather_facts: no | |
tasks: | |
- name: Do something | |
debug: | |
msg: something | |
""".lstrip() | |
def main(): | |
os.environ["ANSIBLE_CALLBACK_PLUGINS"] = callback_plugins | |
playbook = "/tmp/test-playbook.yml" | |
with open(playbook, 'w+') as f: | |
f.write(PLAYBOOK) | |
ansible_runner.run(playbook=playbook) | |
if __name__ == "__main__": | |
main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment