@@ -0,0 +1,1074 @@
+import tempfile%0Aimport logging%0Afrom mariner.util import api_endpoint, which%0A%0Alogger = logging.getLogger(__name__)%0A%0A%0Adef make_ansible_command(stderr, stdout, hosts_file, identifier, extra_vars='%7B%7D', tag=''):%0A    %22%22%22%0A    This utility will compose the command needed to run ansible, capture its%0A    stdout and stderr to a file%0A    %22%22%22%0A    ansible_path = which('ansible-playbook')%0A    url = api_endpoint('tasks', identifier, 'completed')%0A    command = '%7Bansible_path%7D -i %7Bhosts_file%7D --extra-vars=%22%7Bextra_vars%7D%22 --tags=%22%7Btags%7D%22'.format(%0A            ansible_path=ansible_path,%0A            hosts_file=hosts_file,%0A            extra_vars=extra_vars,%0A            tags=tags%0A    )%0A%0A    redirect = '%3E %7Bstdout%7D 2%3E %7Bstderr%7D;'.format(stdout=stdout, stderr=stderr)%0A    post = 'curl -X POST %7Burl%7D'.format(url=url)%0A    return %22%7Bcommand%7D %7Bredirect%7D %7Bpost%7D%22.format(command=command, redirect=redirect, post=post)%0A%0A%0Adef temp_file(identifier, std):%0A    return tempfile.NamedTemporaryFile(%0A        prefix=%22%7Bidentifier%7D_%7Bstd%7D%22.format(%0A            identifier=identifier, std=std), delete=False%0A    )%0A

add a process module to fire system commands