Skip to content

Instantly share code, notes, and snippets.

@rmetzler
Forked from dmsimard/test.py
Created June 5, 2019 19:52
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rmetzler/aabad57a7817e55d64a6ab500e0ea17a to your computer and use it in GitHub Desktop.
Save rmetzler/aabad57a7817e55d64a6ab500e0ea17a to your computer and use it in GitHub Desktop.
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