feat(ansible): scope picker in run form + create_run() DB inventory generation
This commit is contained in:
@@ -71,18 +71,37 @@
|
||||
readonly style="color:var(--text-muted);" value="">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>Inventory</label>
|
||||
<select name="inventory_path">
|
||||
{% for inv in sd.inventories %}
|
||||
<option value="{{ inv }}">{{ inv }}</option>
|
||||
{% endfor %}
|
||||
<option value="">— Enter manually below —</option>
|
||||
<label>Run Against</label>
|
||||
<select name="inventory_scope">
|
||||
{% if targets %}
|
||||
<optgroup label="All Targets">
|
||||
<option value="steward:all">All targets ({{ targets | length }})</option>
|
||||
</optgroup>
|
||||
{% if groups %}
|
||||
<optgroup label="Group">
|
||||
{% for grp in groups %}
|
||||
<option value="steward:group:{{ grp.id }}">Group: {{ grp.name }}</option>
|
||||
{% endfor %}
|
||||
</optgroup>
|
||||
{% endif %}
|
||||
<optgroup label="Single Target">
|
||||
{% for tgt in targets %}
|
||||
<option value="steward:target:{{ tgt.id }}">{{ tgt.name }}</option>
|
||||
{% endfor %}
|
||||
</optgroup>
|
||||
{% endif %}
|
||||
{% if sd.inventories %}
|
||||
<optgroup label="Repo Inventory File">
|
||||
{% for inv in sd.inventories %}
|
||||
<option value="repo:{{ sd.source.name }}:{{ inv }}">{{ sd.source.name }}/{{ inv }}</option>
|
||||
{% endfor %}
|
||||
</optgroup>
|
||||
{% endif %}
|
||||
{% if not targets and not sd.inventories %}
|
||||
<option value="" disabled>No targets or inventory files — add targets at /ansible/inventory/targets</option>
|
||||
{% endif %}
|
||||
</select>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>Or enter inventory path manually</label>
|
||||
<input type="text" id="manual-inv-{{ sd.source.name }}" placeholder="inventories/production/hosts">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>Extra vars <span style="color:var(--text-muted);font-weight:normal;">(optional, one key=value per line)</span></label>
|
||||
<textarea name="extra_vars" rows="2" placeholder="version=1.2.3 restart=true"
|
||||
@@ -103,10 +122,7 @@
|
||||
</label>
|
||||
</div>
|
||||
<div style="display:flex;gap:0.75rem;align-items:center;">
|
||||
<button type="button" class="btn"
|
||||
onclick="var manual=document.getElementById('manual-inv-{{ sd.source.name }}').value.trim();
|
||||
if(manual){this.closest('form').querySelector('[name=inventory_path]').value=manual;}
|
||||
htmx.trigger(this.closest('form'),'submit');">Execute</button>
|
||||
<button type="submit" class="btn">Execute</button>
|
||||
<a href="#" onclick="document.getElementById('run-form-{{ sd.source.name }}').style.display='none';return false;"
|
||||
class="btn btn-ghost btn-sm">Cancel</a>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user