aoh

A tool for running Ansible playbooks with `curl <url> | python` commands
git clone https://git.ashermorgan.net/aoh/
Log | Files | Refs | README

commit 8922f9ece9ce7a8209639592454458bb3d3d858d
parent 82037b2b3977b203db1e73d6945490e31bcb21e6
Author: Asher Morgan <asher@ashermorgan.net>
Date:   Sat, 15 Aug 2026 13:08:11 -0700

Move connection plugin out of project directory

Diffstat:
Rdemo/connection_plugins/http.py -> connection_plugins/http.py | 0
Minstall.py | 6+++---
Mmain.py | 16++++++++++++++--
3 files changed, 17 insertions(+), 5 deletions(-)

diff --git a/demo/connection_plugins/http.py b/connection_plugins/http.py diff --git a/install.py b/install.py @@ -14,9 +14,9 @@ assert res.status_code == 201 job_url = f'{API}{res.headers['Location']}' while True: - status = requests.get(job_url, cookies=res.cookies).content - print(f'Status: {status.decode()}') + data = requests.get(job_url, cookies=res.cookies).json() + print(f'Status: {data['status']}') - if status not in [b'started', b'running']: + if data['status'] not in ['started', 'running']: break time.sleep(1) diff --git a/main.py b/main.py @@ -9,7 +9,7 @@ DATA = {} PLAYBOOK = os.path.abspath('./demo/playbook.yml') # TODO app = Flask(__name__) -app.secret_key = b'_5#y2L"F4Q8z\n\xec]/' # TODO +app.secret_key = os.urandom(16) # TODO @app.get('/install') @@ -32,10 +32,20 @@ def job_new(): }, }, } + env = { + 'ANSIBLE_CONNECTION_PLUGINS': ':'.join([ + os.path.abspath('./connection_plugins/'), # TODO + # Default paths: + 'demo/plugins/connection', # TODO + '/usr/share/ansible/plugins/connection', + ]) + } _, r = ansible_runner.run_async(private_data_dir='private', limit=request.json['host'], inventory=inv, + envvars=env, playbook=PLAYBOOK, + ident=id, verbosity=4 ) DATA[id] = r @@ -49,7 +59,9 @@ def job_status(id): if id != session.get('runner'): abort(401) - return DATA[id].status + return { + 'status': DATA[id].status, + } if __name__ == '__main__':