Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
ara with ansible-runner
#!/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
You can’t perform that action at this time.