From d5bf357c8010bb1219d04ede14ce699b409e93c5 Mon Sep 17 00:00:00 2001 From: Determinant Date: Sun, 30 Aug 2020 00:15:08 -0400 Subject: fix the connection issue with --notls flag on; WIP: deployment example --- scripts/deploy/gen_inventory.py | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 scripts/deploy/gen_inventory.py (limited to 'scripts/deploy/gen_inventory.py') diff --git a/scripts/deploy/gen_inventory.py b/scripts/deploy/gen_inventory.py new file mode 100644 index 0000000..23af205 --- /dev/null +++ b/scripts/deploy/gen_inventory.py @@ -0,0 +1,34 @@ +import argparse + +if __name__ == "__main__": + parser = argparse.ArgumentParser(description='Generate configuration files for a run.') + parser.add_argument('--replicas', type=str, default='replicas.txt', + help='text file with all replicas IPs (each row is " ", repeat a line if you would like to share the same machine)') + parser.add_argument('--clients', type=str, default='clients.txt', + help='text file with all clients IPs (each row is "")') + parser.add_argument('--prefix', type=str, default='hotstuff.gen') + args = parser.parse_args() + + print("[nodes_setup]") + host_idx_count = {} + replicas = [] + clients = [] + with open(args.replicas, "r") as rfile: + for line in rfile: + (pub_ip, priv_ip) = line.split() + replicas.append((pub_ip.strip(), priv_ip.strip())) + with open(args.clients, "r") as cfile: + for line in cfile: + clients.append(line.strip()) + machines = sorted(set([pub_ip for (pub_ip, _) in replicas] + clients)) + print("\n".join(machines)) + print("\n[nodes]") + for (i, (pub_ip, priv_ip)) in enumerate(replicas): + host_idx = host_idx_count.setdefault(pub_ip, 0) + host_idx_count[pub_ip] += 1 + print("replica{} ansible_host={} host_idx={} extra_conf={}-sec{}.conf".format( + i, pub_ip, host_idx, args.prefix, i)) + + print("\n[clients]") + for (i, ip) in enumerate(clients): + print("client{} ansible_host={} cid={}".format(i, ip, i)) -- cgit v1.2.3