first commit
This commit is contained in:
12
templates/arch/base.html
Normal file
12
templates/arch/base.html
Normal file
@@ -0,0 +1,12 @@
|
||||
<html>
|
||||
<head>
|
||||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@4.3.1/dist/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
|
||||
<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script>
|
||||
<script src="https://cdn.jsdelivr.net/npm/popper.js@1.14.7/dist/umd/popper.min.js" integrity="sha384-UO2eT0CpHqdSJQ6hJty5KVphtPhzWj9WO1clHTMGa3JDZwrnQq4sF86dIHNDz0W1" crossorigin="anonymous"></script>
|
||||
<script src="https://cdn.jsdelivr.net/npm/bootstrap@4.3.1/dist/js/bootstrap.min.js" integrity="sha384-JjSmVgyd0p3pXB1rRibZUAYoIIy6OrQ6VrjIEaFf/nJGzIxFDsf4x0xIM+B07jRM" crossorigin="anonymous"></script>
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/socket.io/4.1.2/socket.io.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
{% block content %}{% endblock %}
|
||||
</body>
|
||||
</html>
|
||||
36
templates/arch/index.html
Normal file
36
templates/arch/index.html
Normal file
@@ -0,0 +1,36 @@
|
||||
{% extends 'base.html' %}
|
||||
{% block content %}
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
Select Playbook and arguments
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<form id="ansibleForm">
|
||||
<label for="os">Playbook</label>
|
||||
<select id="playbook" class="form-control" name="playbook" placeholder="Profile" required>
|
||||
{%for file in list %}
|
||||
<option value={{ file }}>{{ file }}</option>
|
||||
{%endfor%}
|
||||
</select><br>
|
||||
<label for="nom">Arguments</label>
|
||||
<input type="text" name="arguments" class="form-control" placeholder="-e "><br>
|
||||
<label for="nom">Hosts</label>
|
||||
<input type="text" name="arguments" class="form-control" placeholder="/path/to/inventory"><br>
|
||||
<button type="submit" class="btn btn-primary"onclick="submitForm()">Executer</button>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
var socket = io.connect('http://' + document.domain + ':' + location.port);
|
||||
|
||||
function submitForm() {
|
||||
var playbook = document.forms["ansibleForm"]["playbook"].value;
|
||||
var hosts = document.forms["ansibleForm"]["hosts"].value;
|
||||
var arguments = document.forms["ansibleForm"]["arguments"].value;
|
||||
|
||||
socket.emit('submit_playbook', { playbook: playbook, hosts: hosts });
|
||||
window.location.href = "/run";
|
||||
}
|
||||
</script>
|
||||
|
||||
{% endblock %}
|
||||
23
templates/arch/run.html.ok
Normal file
23
templates/arch/run.html.ok
Normal file
@@ -0,0 +1,23 @@
|
||||
<!-- templates/run.html -->
|
||||
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Ansible Output</title>
|
||||
</head>
|
||||
<body>
|
||||
<div id="output"></div>
|
||||
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/socket.io/4.1.1/socket.io.js"></script>
|
||||
<script>
|
||||
var socket = io.connect('http://' + document.domain + ':' + location.port);
|
||||
|
||||
socket.on('ansible_output', function(data) {
|
||||
var outputDiv = document.getElementById('output');
|
||||
outputDiv.innerHTML += data.data + '<br>';
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
37
templates/arch/run.html.old
Normal file
37
templates/arch/run.html.old
Normal file
@@ -0,0 +1,37 @@
|
||||
{% extends 'base.html' %}
|
||||
{% block content %}
|
||||
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
Running playbook
|
||||
</div>
|
||||
<div class="card-body">
|
||||
Command to run : <code>ansible-playbook {{ playbook }} {{ argument }}</code>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
Output
|
||||
</div>
|
||||
<div class="card-body">
|
||||
Test
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<pre id="output"></pre>
|
||||
|
||||
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/socket.io/4.1.2/socket.io.js"></script>
|
||||
<script>
|
||||
var socket = io.connect('http://' + document.domain + ':' + location.port);
|
||||
|
||||
socket.on('output', function(data) {
|
||||
document.getElementById('output').textContent += data.data;
|
||||
});
|
||||
function executeCommand() {
|
||||
socket.emit('execute_command', "ansible-playbook {{ playbook }} {{ argument }}");
|
||||
}
|
||||
</script>
|
||||
|
||||
{% endblock %}
|
||||
44
templates/base.html
Normal file
44
templates/base.html
Normal file
@@ -0,0 +1,44 @@
|
||||
<html>
|
||||
<head>
|
||||
|
||||
<script language="javascript" type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/codemirror/6.65.7/codemirror.min.js"></script>
|
||||
<script language="javascript" type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/codemirror/6.65.7/mode/perl/perl.min.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="https://cdnjs.cloudflare.com/ajax/libs/codemirror/6.65.7/codemirror.min.css"></link>
|
||||
<link rel="stylesheet" type="text/css" href="https://cdnjs.cloudflare.com/ajax/libs/codemirror/6.65.7/theme/abbott.min.css"></link>
|
||||
|
||||
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-EVSTQN3/azprG1Anm3QDgpJLIm9Nao0Yz1ztcQTwFspd3yD65VohhpuuCOmLASjC" crossorigin="anonymous">
|
||||
<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script>
|
||||
<script src="https://cdn.jsdelivr.net/npm/@popperjs/core@2.9.2/dist/umd/popper.min.js" integrity="sha384-IQsoLXl5PILFhosVNubq5LC7Qb9DXgDA9i+tQ8Zj3iwWAwPtgFTxbJ8NT4GN1R8p" crossorigin="anonymous"></script>
|
||||
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/js/bootstrap.min.js" integrity="sha384-cVKIPhGWiC2Al4u+LWgxfKTRIcfu0JTxR+EQDz/bgldoEyl4H0zUF0QKbrJ0EcQF" crossorigin="anonymous"></script>
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/socket.io/4.1.2/socket.io.js"></script>
|
||||
<link href="{{url_for('static', filename = 'style.css')}}" rel="stylesheet">
|
||||
</head>
|
||||
<body>
|
||||
<div class="container">
|
||||
{% block content %}{% endblock %}
|
||||
</div>
|
||||
<script>
|
||||
var socket = io.connect('http://' + document.domain + ':' + location.port);
|
||||
function submitForm() {
|
||||
var playbook = document.forms["ansibleForm"]["playbook"].value;
|
||||
var hosts = document.forms["ansibleForm"]["hosts"].value;
|
||||
var argument = document.forms["ansibleForm"]["argument"].value;
|
||||
var limitation = document.forms["ansibleForm"]["limitation"].value;
|
||||
socket.emit('submit_playbook', { playbook: playbook, hosts: hosts, argument: argument, limitation: limitation });
|
||||
window.location.href = "/run";
|
||||
}
|
||||
socket.on('ansible_output', function(data) {
|
||||
var outputDiv = document.getElementById('output');
|
||||
outputDiv.innerHTML += data.data + '<br>';
|
||||
});
|
||||
|
||||
var editor = CodeMirror.fromTextArea(document.getElementById('code'), {
|
||||
lineNumbers: true,
|
||||
mode: 'text/x-perl',
|
||||
theme: 'abbott',
|
||||
});
|
||||
|
||||
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
11
templates/edit_file.html
Normal file
11
templates/edit_file.html
Normal file
@@ -0,0 +1,11 @@
|
||||
{% extends 'base.html' %}
|
||||
{% block content %}
|
||||
<a href="/">< Back</a>
|
||||
<br>
|
||||
<form method="post" action="{{ url_for('edit_file') }}">
|
||||
<textarea id="code" name="file_content" class="form-control numbered">{{ file_content }}</textarea>
|
||||
<input type="hidden" id="file_path" name="file_path" value="{{ filepath }}">
|
||||
<button type="submit" value="Save Changes" class="btn btn-info" >Save</button>
|
||||
|
||||
</form>
|
||||
{% endblock %}
|
||||
48
templates/index.html
Normal file
48
templates/index.html
Normal file
@@ -0,0 +1,48 @@
|
||||
{% extends 'base.html' %}
|
||||
{% block content %}
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
Select Playbook and arguments
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<form id="ansibleForm">
|
||||
|
||||
<label for="playbook">Playbook <span style="color:red">★</span></label>
|
||||
<select id="playbook" class="form-control" name="playbook" placeholder="Profile" required>
|
||||
{%for file in list %}
|
||||
<option value={{ file }}>{{ file }}</option>
|
||||
{%endfor%}
|
||||
</select>
|
||||
<label for="hosts">Hosts:</label>
|
||||
<input type="text" name="hosts" class="form-control" placeholder="/path/to/inventory">
|
||||
<label for="argument">Arguments</label>
|
||||
<input type="text" name="argument" class="form-control" placeholder="-e "><br>
|
||||
<label for="limitation">Limitation</label>
|
||||
<input type="text" name="limitation" class="form-control" placeholder="-l "><br>
|
||||
<br>
|
||||
<button type="button" class="btn btn-info" onclick="submitForm()">Run</button>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
<br>
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
Select Playbook to edit:
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<form id="fileedit" action="/edit" method="post">
|
||||
|
||||
<label for="playbook">Playbook:</label>
|
||||
<select id="playbook" class="form-control" name="file_edit" placeholder="Profile" required>
|
||||
{%for file in list %}
|
||||
<option value={{ file }}>{{ file }}</option>
|
||||
{%endfor%}
|
||||
</select>
|
||||
<br>
|
||||
<button type="submit" class="btn btn-info">Edit</button>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
{% endblock %}
|
||||
13
templates/run.html
Normal file
13
templates/run.html
Normal file
@@ -0,0 +1,13 @@
|
||||
{% extends 'base.html' %}
|
||||
{% block content %}
|
||||
<a href="/">< Back</a>
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
Command output
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<div id="output" class="numbered"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{% endblock %}
|
||||
Reference in New Issue
Block a user