aoh

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

commit 9049bdb8271a2a4d4732d8263a364c5fab10d99d
parent 0986c40b5077f1a08d01a7c44be600ae566a3172
Author: Asher Morgan <asher@ashermorgan.net>
Date:   Tue,  8 Sep 2026 20:11:59 -0700

Add Windows commands to playbook web pages

Diffstat:
Maoh/server.py | 4+++-
Maoh/static/global.css | 10+++++++---
Maoh/templates/home.html | 14++++++++++++--
3 files changed, 22 insertions(+), 6 deletions(-)

diff --git a/aoh/server.py b/aoh/server.py @@ -131,5 +131,7 @@ def web(path='main.yml'): if not playbook or playbook.web_description is None: return abort(404) + is_windows = 'indows' in request.headers.get('User-Agent', '') + return render_template('home.html', description=playbook.web_description, - playbook=playbook.name) + playbook=playbook.name, is_windows=is_windows) diff --git a/aoh/static/global.css b/aoh/static/global.css @@ -43,8 +43,6 @@ main { h1 { margin-bottom: 2rem; - color: var(--fg2); - font-size: 2rem; font-weight: 100; text-align: center; @@ -71,8 +69,14 @@ h1 { font-family: 'Menlo', 'Cascadia Code', 'Lucida Console', monospace; } #cmd::before { + color: var(--fg2); +} +#cmd:not(.win)::before { content: '$ '; } +#cmd.win::before { + content: 'PS> '; +} /* Command copy button */ #copy { @@ -93,5 +97,5 @@ h1 { width: 100%; height: 100%; - color: var(--fg1); + color: var(--fg2); } diff --git a/aoh/templates/home.html b/aoh/templates/home.html @@ -18,12 +18,22 @@ <h1>{{ description }}</h1> {% endif %} - {% set cmd = 'curl %s/run | python3' % AOH_ORIGIN %} + {% if is_windows %} + {% set cmd = '(Invoke-WebRequest %s/run).Content' % AOH_ORIGIN %} + {% else %} + {% set cmd = 'curl %s/run' % AOH_ORIGIN %} + {% endif %} + + {% set cmd = cmd + ' | python3' %} + {% if playbook != 'main.yml' %} {% set cmd = cmd + ' - %s' % playbook %} {% endif %} + <div id="cmd-bar"> - <code id="cmd">{{ cmd }}</code> + <code id="cmd" class="{% if is_windows %}win{% endif %}"> + {{ cmd }} + </code> <button id="copy" onclick="copy('{{ cmd }}')" hidden></button> </div> </main>