From 5f2a74b059805022e9db759254103e57dc7e6cdb Mon Sep 17 00:00:00 2001 From: lza_menace Date: Sat, 20 Mar 2021 10:59:07 -0700 Subject: [PATCH] add simple ansible export page --- app/routes/api.py | 14 +++++++++++++- app/templates/export_ansible.html | 9 +++++++++ 2 files changed, 22 insertions(+), 1 deletion(-) create mode 100644 app/templates/export_ansible.html diff --git a/app/routes/api.py b/app/routes/api.py index 2a398f2..a610150 100644 --- a/app/routes/api.py +++ b/app/routes/api.py @@ -1,6 +1,7 @@ -from flask import Blueprint +from flask import Blueprint, render_template from app.models import Operation from app.library.cache import cache +from app import config bp = Blueprint('api', 'api') @@ -13,3 +14,14 @@ def get_info(codename): return cache.get_info(op.codename) else: return {} + +@bp.route('/api/export/ansible') +def export_ansible(): + ops = Operation.query.filter( + Operation.droplet_id > 0 + ) + return render_template( + 'export_ansible.html', + ops=ops, + domain=config.DO_DOMAIN + ) diff --git a/app/templates/export_ansible.html b/app/templates/export_ansible.html new file mode 100644 index 0000000..1b6e78d --- /dev/null +++ b/app/templates/export_ansible.html @@ -0,0 +1,9 @@ +[xmrcannon] +
+{% for op in ops %} +{{ op.codename }}.{{ domain }}
+{% endfor %} +
+[xmrcannon:vars] +
+ansible_ssh_user=root